summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Gibizer <balazs.gibizer@est.tech>2022-03-20 09:47:10 +0100
committerSean Mooney <work@seanmooney.info>2022-11-17 15:09:04 +0000
commit683cbd06336bba37d033c292c4c0ea83e06d9c07 (patch)
treecd4163ca81e9477c64d1c13096d675bce68455fd
parent17ae907569e45cc0f5c7da9511bb668a877b7b2e (diff)
downloadnova-683cbd06336bba37d033c292c4c0ea83e06d9c07.tar.gz
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 8d2776fb34339b311c713992a39507452c4ae42f)
-rw-r--r--nova/network/neutron.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/nova/network/neutron.py b/nova/network/neutron.py
index 2021bdb58f..1e7d33f73e 100644
--- a/nova/network/neutron.py
+++ b/nova/network/neutron.py
@@ -3694,25 +3694,6 @@ class API:
return None
return device
- def _update_port_pci_binding_profile(self, pci_dev, binding_profile):
- """Update the binding profile dict with new PCI device data.
-
- :param pci_dev: The PciDevice object to update the profile with.
- :param binding_profile: The dict to update.
- """
- binding_profile.update({'pci_slot': pci_dev.address})
- if binding_profile.get('card_serial_number'):
- binding_profile.update({
- 'card_serial_number': pci_dev.card_serial_number})
- if binding_profile.get('pf_mac_address'):
- binding_profile.update({
- 'pf_mac_address': pci_utils.get_mac_by_pci_address(
- pci_dev.parent_addr)})
- if binding_profile.get('vf_num'):
- binding_profile.update({
- 'vf_num': pci_utils.get_vf_num_by_pci_address(
- pci_dev.address)})
-
def _update_port_binding_for_instance(
self, context, instance, host, migration=None,
provider_mappings=None):
@@ -3781,8 +3762,9 @@ class API:
else:
pci_dev = self._get_port_pci_dev(context, instance, p)
if pci_dev:
- self._update_port_pci_binding_profile(pci_dev,
- binding_profile)
+ binding_profile.update(
+ self._get_pci_device_profile(pci_dev)
+ )
updates[constants.BINDING_PROFILE] = binding_profile
# NOTE(gibi): during live migration the conductor already sets the