From d4e762bd9ecffb6a945fbe938fff78fc2b0681e6 Mon Sep 17 00:00:00 2001 From: mkislinska Date: Thu, 25 Apr 2013 11:16:24 +0300 Subject: The vm_state should not be modified until the task is complete. Several methods in nova.compute.api alter the vm_state value before proceeding with the actual work. The initial vm_state may be changed to something other than the initial vm_state (which is a problem: since we do not know what the initial state actually was, we cannot reasonably recover and set the corresponding ERROR if a problem with the operation occurs). Actually done: Removed vm_state update before executing task Changed methods: - reboot - pause - unpause - suspend - resume - rescue - unrescue Fixes: bug #1158509 Change-Id: I5ee7aebf3c4831dd577ed5ab9aa155095152f8a8 --- nova/compute/api.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'nova') diff --git a/nova/compute/api.py b/nova/compute/api.py index c56270cc3..79a177c86 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1730,7 +1730,7 @@ class API(base.Base): method='reboot') state = {'SOFT': task_states.REBOOTING, 'HARD': task_states.REBOOTING_HARD}[reboot_type] - instance = self.update(context, instance, vm_state=vm_states.ACTIVE, + instance = self.update(context, instance, task_state=state, expected_task_state=[None, task_states.REBOOTING]) @@ -2099,7 +2099,6 @@ class API(base.Base): """Pause the given instance.""" self.update(context, instance, - vm_state=vm_states.ACTIVE, task_state=task_states.PAUSING, expected_task_state=None) @@ -2114,7 +2113,6 @@ class API(base.Base): """Unpause the given instance.""" self.update(context, instance, - vm_state=vm_states.PAUSED, task_state=task_states.UNPAUSING, expected_task_state=None) @@ -2134,7 +2132,6 @@ class API(base.Base): """Suspend the given instance.""" self.update(context, instance, - vm_state=vm_states.ACTIVE, task_state=task_states.SUSPENDING, expected_task_state=None) @@ -2149,7 +2146,6 @@ class API(base.Base): """Resume the given instance.""" self.update(context, instance, - vm_state=vm_states.SUSPENDED, task_state=task_states.RESUMING, expected_task_state=None) @@ -2178,7 +2174,6 @@ class API(base.Base): self.update(context, instance, - vm_state=vm_states.ACTIVE, task_state=task_states.RESCUING, expected_task_state=None) @@ -2194,7 +2189,6 @@ class API(base.Base): """Unrescue the given instance.""" self.update(context, instance, - vm_state=vm_states.RESCUED, task_state=task_states.UNRESCUING, expected_task_state=None) -- cgit