On 06/28/2017 05:50 AM, Kekane, Abhishek wrote:
In masakari, we are setting an instance to an error state if the vmstate is resized before evacuating it to a new host.
Arguably the instance should be set to an error state as soon as you notice that the compute node is down.
Once an instance (which was in resized state) is evacuated then it becomes active on the new host. The main problem with this implementation from user’s point of view is the instance goes into active state after evacuation, it should be in stopped state if the prior action on the instance before resizing was stop. In masakari, It’s possible to set the vm state to stopped state after evacuation but for a short period the instance will go into the active state which is unacceptable.
That's a valid point, I think.
*Proposing changes to Nova:* In the current nova code, if the instance is in stopped state before evacuation, then it remains in the stopped state after evacuation is complete. On the similar lines, we are proposing nova should allow instance to be evacuated in resized state and after evacuation the instance should remain in stopped state if the prior action on the instance is stopped before resizing.
The current nova code looks at the vm_state to decide whether or not it's allowable to evacuate, and while "stopped" is a valid state to evacuate from "resized" is not. In your scenario it's both "stopped" *and* "resized" simultaneously, but there's no way to represent that in the vmstate so I think we'd have to check the power state, which would mean extending the check_instance_state() routine since it doesn't currently handle the power state.
The trickier question is how to handle the "resized" state...after evacuating an instance in the "resized" state should you be able to revert the resize? If so, how would that work in the case where the instance was resized on the same host originally and that host is no longer available? If not, then you'll end up with resources permanently reserved on the host the instance was on before the resize. I suppose one option would be to auto-confirm the resize in the case of a resize-to-same-host, but that'll be tricky to process with the host not available.
Also, it should be noted that when rebuilding/evacuating a "stopped" instance the nova code just boots it up as normal and sets the vm_state to "active", then realizes that it's supposed to be stopped and sets the task_state to "powering_off" and goes down the normal path to stop the instance, eventually setting the vm_state to "stopped". So you're still going to end up with the same state transitions as what you have now, though the timing will probably be a bit tighter. If you really want a stopped instance to not actually start up on a rebuild/evacuate then that would be additional work.
Chris __________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: [email protected]?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
