Comment 5 for bug 1941005

Revision history for this message
李亚冲 (879228763-6) wrote (last edit ):

HI everybody , I read the code, find in the resize workflow ,no method to update pci_requests, so I add new code_line in method of resize, in /nova/compute/api.py.

```
    @reject_vdpa_instances(instance_actions.RESIZE)
    @block_accelerators()
    @check_instance_lock
    @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
    @check_instance_host(check_is_up=True)
    def resize(self, context, instance, flavor_id=None, clean_shutdown=True,
               host_name=None, auto_disk_config=None):
        ...

        filter_properties = {'ignore_hosts': []}
        if not self._allow_resize_to_same_host(same_instance_type, instance):
            filter_properties['ignore_hosts'].append(instance.host)

        request_spec = objects.RequestSpec.get_by_instance_uuid(
            context, instance.uuid)
        request_spec.ignore_hosts = filter_properties['ignore_hosts']

        # add new code
        if new_instance_type != current_instance_type:
            request_spec.pci_requests = pci_request.get_pci_requests_from_flavor(new_instance_type)
        ...
```

It work , at resize finished , the DB of placement will be update