Skip to content

Commit 683cbd0

Browse files
Balazs GibizerSeanMooney
authored andcommitted
refactor: remove duplicated logic
Remove _update_port_pci_binding_profile and replace its usage with _get_pci_device_profile. Change-Id: I34dae6fdb746205f0baa4997e69eec55634bec4d (cherry picked from commit 8d2776f)
1 parent 17ae907 commit 683cbd0

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

nova/network/neutron.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,25 +3694,6 @@ def _get_port_pci_dev(self, context, instance, port):
36943694
return None
36953695
return device
36963696

3697-
def _update_port_pci_binding_profile(self, pci_dev, binding_profile):
3698-
"""Update the binding profile dict with new PCI device data.
3699-
3700-
:param pci_dev: The PciDevice object to update the profile with.
3701-
:param binding_profile: The dict to update.
3702-
"""
3703-
binding_profile.update({'pci_slot': pci_dev.address})
3704-
if binding_profile.get('card_serial_number'):
3705-
binding_profile.update({
3706-
'card_serial_number': pci_dev.card_serial_number})
3707-
if binding_profile.get('pf_mac_address'):
3708-
binding_profile.update({
3709-
'pf_mac_address': pci_utils.get_mac_by_pci_address(
3710-
pci_dev.parent_addr)})
3711-
if binding_profile.get('vf_num'):
3712-
binding_profile.update({
3713-
'vf_num': pci_utils.get_vf_num_by_pci_address(
3714-
pci_dev.address)})
3715-
37163697
def _update_port_binding_for_instance(
37173698
self, context, instance, host, migration=None,
37183699
provider_mappings=None):
@@ -3781,8 +3762,9 @@ def _update_port_binding_for_instance(
37813762
else:
37823763
pci_dev = self._get_port_pci_dev(context, instance, p)
37833764
if pci_dev:
3784-
self._update_port_pci_binding_profile(pci_dev,
3785-
binding_profile)
3765+
binding_profile.update(
3766+
self._get_pci_device_profile(pci_dev)
3767+
)
37863768
updates[constants.BINDING_PROFILE] = binding_profile
37873769

37883770
# NOTE(gibi): during live migration the conductor already sets the

0 commit comments

Comments
 (0)