ml2: Simplify _process_provider_create
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
This commit is contained in:
parent
e18f0cb003
commit
a3ab3eb276
@ -86,10 +86,6 @@ class TypeManager(stevedore.named.NamedExtensionManager):
|
|||||||
msg = _("network_type required")
|
msg = _("network_type required")
|
||||||
raise exc.InvalidInput(error_message=msg)
|
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):
|
def _process_provider_create(self, network):
|
||||||
if any(attributes.is_attr_set(network.get(attr))
|
if any(attributes.is_attr_set(network.get(attr))
|
||||||
for attr in provider.ATTRIBUTES):
|
for attr in provider.ATTRIBUTES):
|
||||||
@ -97,9 +93,7 @@ class TypeManager(stevedore.named.NamedExtensionManager):
|
|||||||
# at the same time.
|
# at the same time.
|
||||||
if attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
|
if attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
|
||||||
raise mpnet.SegmentsSetInConjunctionWithProviders()
|
raise mpnet.SegmentsSetInConjunctionWithProviders()
|
||||||
|
return [self._process_provider_segment(network)]
|
||||||
segments = [self._get_segment_attributes(network)]
|
|
||||||
return [self._process_provider_segment(s) for s in segments]
|
|
||||||
elif attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
|
elif attributes.is_attr_set(network.get(mpnet.SEGMENTS)):
|
||||||
segments = [self._process_provider_segment(s)
|
segments = [self._process_provider_segment(s)
|
||||||
for s in network[mpnet.SEGMENTS]]
|
for s in network[mpnet.SEGMENTS]]
|
||||||
|
Loading…
Reference in New Issue
Block a user