]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix SG interface to reflect the reality
authorTomoe Sugihara <tomoe@midokura.com>
Mon, 18 Feb 2013 06:24:55 +0000 (15:24 +0900)
committerTomoe Sugihara <tomoe@midokura.com>
Mon, 18 Feb 2013 06:49:38 +0000 (15:49 +0900)
The signitures of abstract methods in SecurityGroupPluginBase
has diverged from db mixin implementation.
This patch updates the methods to fix the divergence, mainly
by removing update method from the base. Note that there's an
issue for missing update(bug #1124865).

Fixes: bug #1119080
Change-Id: I6631b86ab2fdf4b81ad575e9a8f92dfe041ffe9a
Signed-off-by: Tomoe Sugihara <tomoe@midokura.com>
quantum/db/securitygroups_db.py
quantum/extensions/securitygroup.py

index 7eba36cf53d722ef46bad7494bb71cab6baacb28..52956306088e8f600ed954736b2b7c3298eea911 100644 (file)
@@ -398,11 +398,11 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
             raise ext_sg.SecurityGroupRuleNotFound(id=id)
         return sgr
 
-    def delete_security_group_rule(self, context, sgrid):
+    def delete_security_group_rule(self, context, id):
         if (cfg.CONF.SECURITYGROUP.proxy_mode and not context.is_admin):
             raise ext_sg.SecurityGroupProxyModeNotAdmin()
         with context.session.begin(subtransactions=True):
-            rule = self._get_security_group_rule(context, sgrid)
+            rule = self._get_security_group_rule(context, id)
             context.session.delete(rule)
 
     def _extend_port_dict_security_group(self, context, port):
index 756c0753c2684a13379848161e5b96c4c37f9308..8dd342e4cdaf6f01e9df6cb82f3dc3ad205a87c2 100644 (file)
@@ -15,6 +15,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from abc import ABCMeta
 from abc import abstractmethod
 
 from quantum.api import extensions
@@ -315,16 +316,14 @@ class Securitygroup(extensions.ExtensionDescriptor):
 
 
 class SecurityGroupPluginBase(object):
-    @abstractmethod
-    def create_security_group(self, context, security_group):
-        pass
+    __metaclass__ = ABCMeta
 
     @abstractmethod
-    def delete_security_group(self, context, security_group):
+    def create_security_group(self, context, security_group):
         pass
 
     @abstractmethod
-    def update_security_group(self, context, security_group):
+    def delete_security_group(self, context, id):
         pass
 
     @abstractmethod
@@ -340,7 +339,7 @@ class SecurityGroupPluginBase(object):
         pass
 
     @abstractmethod
-    def delete_security_group_rule(self, context, sgrid):
+    def delete_security_group_rule(self, context, id):
         pass
 
     @abstractmethod