Skip to content

Commit 8d2776f

Browse files
author
Balazs Gibizer
committed
refactor: remove duplicated logic
Remove _update_port_pci_binding_profile and replace its usage with _get_pci_device_profile. Change-Id: I34dae6fdb746205f0baa4997e69eec55634bec4d
1 parent de10013 commit 8d2776f

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
@@ -3693,25 +3693,6 @@ def _get_port_pci_dev(self, context, instance, port):
36933693
return None
36943694
return device
36953695

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

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

0 commit comments

Comments
 (0)