But if we're trying to reconstruct a request_spec for the instance, we should be using the orig_image_ref parameter since that's coming off the instance:
So maybe conductor's rebuild_instance method should be passing None to scheduler_utils.build_request_spec and if image is not provided, build_request_spec can get the image from the instance using instance.image_meta.
Anyway, as noted, rebuild doesn't even care about the RequestSpec.image field so I might be overthinking this.
The other thing is, this code in the conductor is wrong anyway since it's using the "new" image_ref requested for the rebuild:
https:/ /github. com/openstack/ nova/blob/ d36dcd52c24c324 18fd358d245688c 86664025d5/ nova/conductor/ manager. py#L830
But if we're trying to reconstruct a request_spec for the instance, we should be using the orig_image_ref parameter since that's coming off the instance:
https:/ /github. com/openstack/ nova/blob/ d36dcd52c24c324 18fd358d245688c 86664025d5/ nova/compute/ api.py# L2866
Before the instance.image_ref is updated from the API request:
https:/ /github. com/openstack/ nova/blob/ d36dcd52c24c324 18fd358d245688c 86664025d5/ nova/compute/ api.py# L2918
Note that if we're getting here because of evacuate, the image_ref parameter isn't even passed:
https:/ /github. com/openstack/ nova/blob/ d36dcd52c24c324 18fd358d245688c 86664025d5/ nova/compute/ api.py# L3978
So maybe conductor's rebuild_instance method should be passing None to scheduler_ utils.build_ request_ spec and if image is not provided, build_request_spec can get the image from the instance using instance. image_meta.
Anyway, as noted, rebuild doesn't even care about the RequestSpec.image field so I might be overthinking this.