diff options
| author | mkislinska <mkislinska@griddynamics.com> | 2013-04-25 11:16:24 +0300 |
|---|---|---|
| committer | mkislinska <mkislinska@griddynamics.com> | 2013-05-17 12:58:53 +0300 |
| commit | d4e762bd9ecffb6a945fbe938fff78fc2b0681e6 (patch) | |
| tree | 8637dfe9204383c83cedb5dce7d353f90c2077aa | |
| parent | da1d7390fea6ba8ac9eefd1a25e5c1412e624ee3 (diff) | |
| download | nova-d4e762bd9ecffb6a945fbe938fff78fc2b0681e6.tar.gz nova-d4e762bd9ecffb6a945fbe938fff78fc2b0681e6.tar.xz nova-d4e762bd9ecffb6a945fbe938fff78fc2b0681e6.zip | |
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
| -rw-r--r-- | nova/compute/api.py | 8 |
1 files changed, 1 insertions, 7 deletions
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) |
