Skip to content

Commit a2eca74

Browse files
committed
fix(neutron): read physical_network from port binding if able
If we are able to read the physical_network from the port binding information then we should do that over looking it up. Uses: https://review.opendev.org/c/openstack/ironic/+/964570
1 parent 3772188 commit a2eca74

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

python/neutron-understack/neutron_understack/neutron_understack_mech.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from neutron_lib import constants as p_const
55
from neutron_lib.api.definitions import portbindings
6+
from neutron_lib.api.definitions import segment as seg_def
67
from neutron_lib.callbacks import events
78
from neutron_lib.callbacks import registry
89
from neutron_lib.callbacks import resources
@@ -115,16 +116,18 @@ def _update_port_baremetal(self, context: PortContext) -> None:
115116
current_vif_other = context.vif_type == portbindings.VIF_TYPE_OTHER
116117

117118
if current_vif_unbound and original_vif_other:
118-
local_link_info = utils.local_link_from_binding_profile(
119-
context.original[portbindings.PROFILE]
120-
)
119+
port = context.original
121120
else:
122-
local_link_info = utils.local_link_from_binding_profile(
123-
context.current[portbindings.PROFILE]
124-
)
125-
vlan_group_name = self.ironic_client.baremetal_port_physical_network(
126-
local_link_info
121+
port = context.current
122+
123+
local_link_info = utils.local_link_from_binding_profile(
124+
port[portbindings.PROFILE]
127125
)
126+
vlan_group_name = port[portbindings.PROFILE].get(seg_def.PHYSICAL_NETWORK)
127+
if vlan_group_name is None and local_link_info is not None:
128+
vlan_group_name = self.ironic_client.baremetal_port_physical_network(
129+
local_link_info
130+
)
128131

129132
if current_vif_unbound and original_vif_other:
130133
self._tenant_network_port_cleanup(context)

0 commit comments

Comments
 (0)