Comment 2 for bug 1664931

Revision history for this message
Matt Riedemann (mriedem) wrote : Re: nova rebuild ignores all image properties and scheduler filters

I believe the issue is that we bypass the scheduler filters because in the compute API for rebuild we pass the existing host for the instance to conductor here:

https://github.com/openstack/nova/blob/93bf6ba5186a3663606aa843a2f247709173f073/nova/compute/api.py#L3015

And then in the conductor manager rebuild_instance method, this "if not host" line is False because the compute API provided the host (the current host the instance is running on):

https://github.com/openstack/nova/blob/93bf6ba5186a3663606aa843a2f247709173f073/nova/conductor/manager.py#L698

And then we happily cast to nova-compute to rebuild the instance with the new image, bypassing the filter checks:

https://github.com/openstack/nova/blob/93bf6ba5186a3663606aa843a2f247709173f073/nova/conductor/manager.py#L757

If the compute API didn't provide the host (like in the case of evacuate), then we'd go through the scheduler to pick a host based on the filters:

https://github.com/openstack/nova/blob/93bf6ba5186a3663606aa843a2f247709173f073/nova/conductor/manager.py#L722

In the case of evacuate, this is where we make sure to pass host=None to conductor's rebuild_instance method so that we go through the scheduler:

https://github.com/openstack/nova/blob/93bf6ba5186a3663606aa843a2f247709173f073/nova/compute/api.py#L3978

I'm not sure if this is a security vulnerability per se, but it's definitely a bug. Sylvain Bauza is probably someone that should look at this.