]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ml2: Simplify _process_provider_create
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Thu, 29 Jan 2015 07:10:27 +0000 (16:10 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 4 Feb 2015 04:04:40 +0000 (13:04 +0900)
There's little point to extract attributes from a dict,
construct another dict, and make _process_provider_segment
extract attributes from the dict again.

Change-Id: I19ad6e8805aaaeaff2c60e8a2854681b2b59d2fa

neutron/plugins/ml2/managers.py

index 84142f87799a4fedce9106025613612a271a49c1..d1bbe482037db59498932886eadbe53b16a7735a 100644 (file)
@@ -86,10 +86,6 @@ class TypeManager(stevedore.named.NamedExtensionManager):
         msg = _("network_type required")
         raise exc.InvalidInput(error_message=msg)
 
-    def _get_segment_attributes(self, network):
-        return {attr: self._get_attribute(network, attr)
-                for attr in provider.ATTRIBUTES}
-
     def _process_provider_create(self, network):
         if any(attributes.is_attr_set(network.get(attr))
                for attr in provider.ATTRIBUTES):
@@ -97,9 +93,7 @@ class TypeManager(stevedore.named.NamedExtensionManager):
             # at the same time.
             if attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
                 raise mpnet.SegmentsSetInConjunctionWithProviders()
-
-            segments = [self._get_segment_attributes(network)]
-            return [self._process_provider_segment(s) for s in segments]
+            return [self._process_provider_segment(network)]
         elif attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
             segments = [self._process_provider_segment(s)
                         for s in network[mpnet.SEGMENTS]]