diff options
author | Balazs Gibizer <gibi@redhat.com> | 2022-08-06 16:09:54 +0200 |
---|---|---|
committer | Balazs Gibizer <gibi@redhat.com> | 2022-08-10 17:08:34 +0200 |
commit | a93092e0d5c1483f9ad48276708ee35c54ce44fe (patch) | |
tree | 3ce23bb4cc36c3b320a37383049181e36ac67c8e /nova/compute/api.py | |
parent | 6d602c6b734c2e360fa319ba22c2fced02ad3d29 (diff) | |
download | nova-a93092e0d5c1483f9ad48276708ee35c54ce44fe.tar.gz |
Update RequestSpec.pci_request for resize
Nova uses the RequestSpec.pci_request in the PciPassthroughFilter to
decide if the PCI devicesm, requested via the pci_alias in the flavor
extra_spec, are available on a potential target host. During resize the
new flavor might contain different pci_alias request than the old flavor
of the instance. In this case Nova should use the pci_alias from the new
flavor to scheduler the destination host of the resize. However this
logic was missing and Nova used the old pci_request value based on the
old flavor. This patch adds the missing logic.
Closes-Bug: #1983753
Closes-Bug: #1941005
Change-Id: I73c9ae27e9c42ee211a53bed3d849650b65f08be
Diffstat (limited to 'nova/compute/api.py')
-rw-r--r-- | nova/compute/api.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 26ae3cf0f3..66543f57dc 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -4227,6 +4227,19 @@ class API: if not same_flavor: request_spec.numa_topology = hardware.numa_get_constraints( new_flavor, instance.image_meta) + # if the flavor is changed then we need to recalculate the + # pci_requests as well because the new flavor might request + # different pci_aliases + new_pci_requests = pci_request.get_pci_requests_from_flavor( + new_flavor) + new_pci_requests.instance_uuid = instance.uuid + # The neutron based InstancePCIRequest cannot change during resize, + # so we just need to copy them from the old request + for request in request_spec.pci_requests.requests or []: + if request.source == objects.InstancePCIRequest.NEUTRON_PORT: + new_pci_requests.requests.append(request) + request_spec.pci_requests = new_pci_requests + # TODO(huaqiang): Remove in Wallaby # check nova-compute nodes have been updated to Victoria to resize # instance to a new mixed instance from a dedicated or shared |