diff options
author | Balazs Gibizer <balazs.gibizer@est.tech> | 2022-03-20 09:47:10 +0100 |
---|---|---|
committer | Balazs Gibizer <balazs.gibizer@est.tech> | 2022-03-20 09:47:10 +0100 |
commit | 8d2776fb34339b311c713992a39507452c4ae42f (patch) | |
tree | 5ea235cc73c4784244cfeafa5b663157ea815a3c /nova/network | |
parent | de10013328895c0a2c29d833c3c26209a258bc8f (diff) | |
download | nova-8d2776fb34339b311c713992a39507452c4ae42f.tar.gz |
refactor: remove duplicated logic
Remove _update_port_pci_binding_profile and replace its usage with
_get_pci_device_profile.
Change-Id: I34dae6fdb746205f0baa4997e69eec55634bec4d
Diffstat (limited to 'nova/network')
-rw-r--r-- | nova/network/neutron.py | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/nova/network/neutron.py b/nova/network/neutron.py index 3ee9774d24..9ba834f82a 100644 --- a/nova/network/neutron.py +++ b/nova/network/neutron.py @@ -3693,25 +3693,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): @@ -3780,8 +3761,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 |