Fix neutron plugin get network_type

Some neutron integrations might not have the provider:network_type
and provider:segmentation_id set in the network information. The
plugin is changed to read from dict using get method to avoid
key error exception.

Closes-bug: #1987315
Change-Id: I9a7460135a0c613c10a91fcef471d4da4f17f041
This commit is contained in:
Felipe Rodrigues 2022-09-20 18:51:40 -03:00
parent e597c4b5e6
commit 48bc4656f8
2 changed files with 10 additions and 3 deletions

View File

@ -398,13 +398,13 @@ class NeutronNetworkPlugin(network.NetworkBaseAPI):
"(found: %s)." % (phy, phy_nets)) "(found: %s)." % (phy, phy_nets))
raise exception.NetworkBadConfigurationException(reason=msg) raise exception.NetworkBadConfigurationException(reason=msg)
else: else:
network_type = net_info['provider:network_type'] network_type = net_info.get('provider:network_type')
segmentation_id = net_info['provider:segmentation_id'] segmentation_id = net_info.get('provider:segmentation_id')
provider_nw_dict = { provider_nw_dict = {
'network_type': network_type, 'network_type': network_type,
'segmentation_id': segmentation_id, 'segmentation_id': segmentation_id,
'mtu': net_info['mtu'], 'mtu': net_info.get('mtu'),
} }
share_network_subnet.update(provider_nw_dict) share_network_subnet.update(provider_nw_dict)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Some neutron integrations might not have the network type, so the neutron network
plugin is fixed by taking that scenario in consideration.
`Launchpad bug #1987315 <https://bugs.launchpad.ne/manila/+bug/1987315>`_
for more details.