Fix issue updating single segment networks

Updating single segment networks created with this
module failed with:
  "Cannot update provider:physical_network in
   existing network"

Single segment networks have the physical_network
set at the network level. For multi-segment networks
the physical_network is only set on the segments.

Due to the incremental addition of support for multiple
segments in THT the nameing convention for the base
segment and additional segments are not identical.

This change relaxes the test for physical_network
change not allowed so that it accepts both naming
conventions.

Change-Id: Ie66907eb1953b671031bd42ad9e40760cfe1a84c
This commit is contained in:
Harald Jensås 2020-11-21 05:38:03 +01:00
parent 2e77f1f238
commit feb3ce7e9a
1 changed files with 2 additions and 2 deletions

View File

@ -167,8 +167,8 @@ def validate_network_update(module, network, net_spec):
# NOTE(hjensas): When a network have multiple segments,
# attributes provider:network_type, provider:physical_network is None
# for the network.
if (network.provider_physical_network != net_spec.pop(
'provider:physical_network')
if (net_spec.pop('provider:physical_network')
not in [network.provider_physical_network, net_spec['name']]
and network.provider_physical_network is not None):
module.fail_json(
msg='Cannot update provider:physical_network in existing network')