コード例 #1
0
 def get_vip(self, context, id):
     vip_binding = vcns_db.get_vcns_edge_vip_binding(context.session, id)
     edge_id = vip_binding[vcns_const.EDGE_ID]
     vip_vseid = vip_binding['vip_vseid']
     try:
         response = self.vcns.get_vip(edge_id, vip_vseid)[1]
     except vcns_exc.VcnsApiException:
         with excutils.save_and_reraise_exception():
             LOG.exception(_("Failed to get vip on edge"))
     return self._restore_lb_vip(context, edge_id, response)
コード例 #2
0
 def get_vip(self, context, id):
     vip_binding = vcns_db.get_vcns_edge_vip_binding(context.session, id)
     edge_id = vip_binding[vcns_const.EDGE_ID]
     vip_vseid = vip_binding['vip_vseid']
     try:
         response = self.vcns.get_vip(edge_id, vip_vseid)[1]
     except vcns_exc.VcnsApiException:
         with excutils.save_and_reraise_exception():
             LOG.exception(_("Failed to get vip on edge"))
     return self._restore_lb_vip(context, edge_id, response)
コード例 #3
0
 def _get_vip_binding(self, session, id):
     vip_binding = vcns_db.get_vcns_edge_vip_binding(session, id)
     if not vip_binding:
         msg = (_("vip_binding not found with id: %(id)s "
                  "edge_id: %(edge_id)s") % {
                'id': id,
                'edge_id': vip_binding[vcns_const.EDGE_ID]})
         LOG.error(msg)
         raise vcns_exc.VcnsNotFound(
             resource='router_service_binding', msg=msg)
     return vip_binding
コード例 #4
0
 def _get_vip_binding(self, session, id):
     vip_binding = vcns_db.get_vcns_edge_vip_binding(session, id)
     if not vip_binding:
         msg = (_("vip_binding not found with id: %(id)s "
                  "edge_id: %(edge_id)s") % {
                'id': id,
                'edge_id': vip_binding[vcns_const.EDGE_ID]})
         LOG.error(msg)
         raise vcns_exc.VcnsNotFound(
             resource='router_service_binding', msg=msg)
     return vip_binding
コード例 #5
0
    def update_vip(self, context, vip):
        vip_binding = vcns_db.get_vcns_edge_vip_binding(
            context.session, vip['id'])
        edge_id = vip_binding[vcns_const.EDGE_ID]
        vip_vseid = vip_binding.get('vip_vseid')
        app_profileid = vip_binding.get('app_profileid')

        vip_new = self._convert_lb_vip(context, edge_id, vip, app_profileid)
        try:
            self.vcns.update_vip(edge_id, vip_vseid, vip_new)
        except vcns_exc.VcnsApiException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_("Failed to update vip on edge: %s"), edge_id)
コード例 #6
0
    def delete_vip(self, context, id):
        vip_binding = vcns_db.get_vcns_edge_vip_binding(context.session, id)
        edge_id = vip_binding[vcns_const.EDGE_ID]
        vip_vseid = vip_binding['vip_vseid']
        app_profileid = vip_binding['app_profileid']

        try:
            self.vcns.delete_vip(edge_id, vip_vseid)
            self.vcns.delete_app_profile(edge_id, app_profileid)
        except vcns_exc.VcnsApiException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_("Failed to delete vip on edge: %s"), edge_id)
        vcns_db.delete_vcns_edge_vip_binding(context.session, id)
コード例 #7
0
    def update_vip(self, context, vip):
        vip_binding = vcns_db.get_vcns_edge_vip_binding(
            context.session, vip['id'])
        edge_id = vip_binding[vcns_const.EDGE_ID]
        vip_vseid = vip_binding.get('vip_vseid')
        app_profileid = vip_binding.get('app_profileid')

        vip_new = self._convert_lb_vip(context, edge_id, vip, app_profileid)
        try:
            self.vcns.update_vip(edge_id, vip_vseid, vip_new)
        except vcns_exc.VcnsApiException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_("Failed to update vip on edge: %s"), edge_id)
コード例 #8
0
    def delete_vip(self, context, id):
        vip_binding = vcns_db.get_vcns_edge_vip_binding(
            context.session, id)
        edge_id = vip_binding[vcns_const.EDGE_ID]
        vip_vseid = vip_binding['vip_vseid']
        app_profileid = vip_binding['app_profileid']

        try:
            self.vcns.delete_vip(edge_id, vip_vseid)
            self.vcns.delete_app_profile(edge_id, app_profileid)
        except vcns_exc.VcnsApiException:
            with excutils.save_and_reraise_exception():
                LOG.exception(_("Failed to delete vip on edge: %s"), edge_id)
        vcns_db.delete_vcns_edge_vip_binding(context.session, id)