There are a few things we need to do to make that work:
* Always set the PCIRequest's requester_id. Previously, this was only
done for resource requests. The requester_id is the port UUID, so we
can use that to correlate which port to update with which pci_slot
(in the case of multiple SRIOV ports per instance).
This has the side effect of making the fix work only for instances
created *after* this patch has been applied. It's not ideal, but
there does not appear to be a better way.
* Call setup_networks_on_host() within the instance_claim context.
This means the instance's pci_devices are updated when we call it,
allowing us to get the pci_slot information from them.
With the two previous changes in place, we can figure out the port's
new pci_slot in _update_port_binding_for_instance().
Closes: bug 1851545
Change-Id: Icfa8c1d6e84eab758af6223a2870078685584aaa
(cherry picked from commit 00f1d4757e503bb9807d7a8d7035c061a97db983)
Reviewed: https:/ /review. opendev. org/c/openstack /nova/+ /790711 /opendev. org/openstack/ nova/commit/ bf7254b794f2296 cdb701a21abb9e5 708c951542
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/wallaby
commit bf7254b794f2296 cdb701a21abb9e5 708c951542
Author: Artom Lifshitz <email address hidden>
Date: Wed Mar 31 16:57:35 2021 -0400
Update SRIOV port pci_slot when unshelving
There are a few things we need to do to make that work:
* Always set the PCIRequest's requester_id. Previously, this was only
done for resource requests. The requester_id is the port UUID, so we
can use that to correlate which port to update with which pci_slot
(in the case of multiple SRIOV ports per instance).
This has the side effect of making the fix work only for instances
created *after* this patch has been applied. It's not ideal, but
there does not appear to be a better way.
* Call setup_networks_ on_host( ) within the instance_claim context.
This means the instance's pci_devices are updated when we call it,
allowing us to get the pci_slot information from them.
With the two previous changes in place, we can figure out the port's port_binding_ for_instance( ).
new pci_slot in _update_
Closes: bug 1851545 758af6223a28700 78685584aaa 9807d7a8d7035c0 61a97db983)
Change-Id: Icfa8c1d6e84eab
(cherry picked from commit 00f1d4757e503bb