Reviewed: https://review.openstack.org/515530 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d2690d6b038e200efed05bf7773898a0a8bb01d7 Submitter: Zuul Branch: master
commit d2690d6b038e200efed05bf7773898a0a8bb01d7 Author: Matt Riedemann <mriedem...@gmail.com> Date: Thu Oct 26 17:33:35 2017 -0400 Pass the correct image to build_request_spec in conductor.rebuild_instance If we're calling build_request_spec in conductor.rebuild_instance, it's because we are evacuating and the instance is so old it does not have a request spec. We need the request_spec to pass to the scheduler to pick a destination host for the evacuation. For evacuate, nova-api does not pass any image reference parameters, and even if it did, those are image IDs, not an image meta dict that build_request_spec expects, so this code has just always been wrong. This change fixes the problem by passing a primitive version of the instance.image_meta which build_request_spec will then return back to conductor and that gets used to build a RequestSpec object from primitives. It's important to use the correct image meta so that the scheduler can properly filter hosts using things like the AggregateImagePropertiesIsolation and ImagePropertiesFilter filters. Change-Id: I0c8ce65016287de7be921c312493667a8c7f762e Closes-Bug: #1727855 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1727855 Title: conductor rebuild_instance does not properly handle image_ref if request_spec is not provided Status in OpenStack Compute (nova): Fix Released Status in OpenStack Compute (nova) ocata series: In Progress Status in OpenStack Compute (nova) pike series: In Progress Bug description: Maybe this doesn't actually matter for rebuild, but the image_ref used in this code: https://github.com/openstack/nova/blob/d36dcd52c24c32418fd358d245688c86664025d5/nova/conductor/manager.py#L830 Is a string image id, it's not a dict or ImageMeta object, it comes through the rebuild action API from the user. It's important, however, for how scheduler_utils.build_request_spec uses it here: https://github.com/openstack/nova/blob/d36dcd52c24c32418fd358d245688c86664025d5/nova/scheduler/utils.py#L79 Because I was trying to figure out if the image parameter to build_request_spec is an ImageMeta object, dict or string - since the code appears to assume it's a dict if not provided. Conductor will then call RequestSpec.from_primitives and the image is used here: https://github.com/openstack/nova/blob/d36dcd52c24c32418fd358d245688c86664025d5/nova/objects/request_spec.py#L250 And eventually ignored here since it's an unexpected type: https://github.com/openstack/nova/blob/d36dcd52c24c32418fd358d245688c86664025d5/nova/objects/request_spec.py#L135 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1727855/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp