コード例 #1
0
 def _get_security_group_rule(self, context, id):
     try:
         query = self._model_query(context, SecurityGroupRule)
         sgr = query.filter(SecurityGroupRule.id == id).one()
     except exc.NoResultFound:
         raise ext_sg.SecurityGroupRuleNotFound(id=id)
     return sgr
コード例 #2
0
 def _get_security_group_rule(self, context, id):
     try:
         if uuidutils.is_uuid_like(id):
             query = self._model_query(context, SecurityGroupRule)
             sgr = query.filter(SecurityGroupRule.id == id).one()
         else:
             query = self._model_query(context, SecurityGroupRule)
             sgr = query.filter(SecurityGroupRule.external_id == id).one()
     except exc.NoResultFound:
         raise ext_sg.SecurityGroupRuleNotFound(id=id)
     return sgr
コード例 #3
0
    def delete_security_group_rule(self, context, sgrid):
        LOG.debug(
            _("MidonetPluginV2.delete_security_group_rule called: "
              "sgrid=%s"), sgrid)

        with context.session.begin(subtransactions=True):
            rule_db_entry = super(MidonetPluginV2,
                                  self).get_security_group_rule(
                                      context, sgrid)

            if not rule_db_entry:
                raise ext_sg.SecurityGroupRuleNotFound(id=sgrid)

            self.client.delete_for_sg_rule(rule_db_entry)
            return super(MidonetPluginV2,
                         self).delete_security_group_rule(context, sgrid)