Remove unnecessary passing of task_state to check_instance_state
Remove cases where task_state=[None] was passed to check_instance_state when that is essentially the default value anyway Change-Id: I49b6449b9ae43a5cfcf5a1ccac5ee9a64d2b3f3c
This commit is contained in:
+10
-18
@@ -1760,8 +1760,7 @@ class API(base.Base):
|
||||
@check_instance_host
|
||||
@check_instance_cell
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.RESCUED,
|
||||
vm_states.ERROR],
|
||||
task_state=[None])
|
||||
vm_states.ERROR])
|
||||
def stop(self, context, instance, do_cast=True):
|
||||
"""Stop an instance."""
|
||||
self.force_stop(context, instance, do_cast)
|
||||
@@ -2119,8 +2118,7 @@ class API(base.Base):
|
||||
@check_instance_lock
|
||||
@check_instance_cell
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
|
||||
vm_states.ERROR],
|
||||
task_state=[None])
|
||||
vm_states.ERROR])
|
||||
def rebuild(self, context, instance, image_href, admin_password,
|
||||
files_to_inject=None, **kwargs):
|
||||
"""Rebuild the given instance with the provided attributes."""
|
||||
@@ -2356,8 +2354,7 @@ class API(base.Base):
|
||||
@wrap_check_policy
|
||||
@check_instance_lock
|
||||
@check_instance_cell
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED],
|
||||
task_state=[None])
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
|
||||
def resize(self, context, instance, flavor_id=None,
|
||||
**extra_instance_updates):
|
||||
"""Resize (ie, migrate) a running instance.
|
||||
@@ -2457,8 +2454,7 @@ class API(base.Base):
|
||||
@wrap_check_policy
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
|
||||
vm_states.PAUSED, vm_states.SUSPENDED],
|
||||
task_state=[None])
|
||||
vm_states.PAUSED, vm_states.SUSPENDED])
|
||||
def shelve(self, context, instance):
|
||||
"""Shelve an instance.
|
||||
|
||||
@@ -2484,7 +2480,7 @@ class API(base.Base):
|
||||
|
||||
@wrap_check_policy
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.SHELVED], task_state=[None])
|
||||
@check_instance_state(vm_state=[vm_states.SHELVED])
|
||||
def shelve_offload(self, context, instance):
|
||||
"""Remove a shelved instance from the hypervisor."""
|
||||
instance.task_state = task_states.SHELVING_OFFLOADING
|
||||
@@ -2495,7 +2491,7 @@ class API(base.Base):
|
||||
@wrap_check_policy
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.SHELVED,
|
||||
vm_states.SHELVED_OFFLOADED], task_state=[None])
|
||||
vm_states.SHELVED_OFFLOADED])
|
||||
def unshelve(self, context, instance):
|
||||
"""Restore a shelved instance."""
|
||||
instance.task_state = task_states.UNSHELVING
|
||||
@@ -2778,8 +2774,7 @@ class API(base.Base):
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
|
||||
vm_states.STOPPED, vm_states.RESIZED,
|
||||
vm_states.SOFT_DELETED],
|
||||
task_state=[None])
|
||||
vm_states.SOFT_DELETED])
|
||||
def attach_volume(self, context, instance, volume_id, device=None,
|
||||
disk_bus=None, device_type=None):
|
||||
"""Attach an existing volume to an existing instance."""
|
||||
@@ -2807,8 +2802,7 @@ class API(base.Base):
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
|
||||
vm_states.STOPPED, vm_states.RESIZED,
|
||||
vm_states.SOFT_DELETED],
|
||||
task_state=[None])
|
||||
vm_states.SOFT_DELETED])
|
||||
def detach_volume(self, context, instance, volume):
|
||||
"""Detach a volume from an instance."""
|
||||
if volume['attach_status'] == 'detached':
|
||||
@@ -2824,8 +2818,7 @@ class API(base.Base):
|
||||
@check_instance_lock
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
|
||||
vm_states.SUSPENDED, vm_states.STOPPED,
|
||||
vm_states.RESIZED, vm_states.SOFT_DELETED],
|
||||
task_state=[None])
|
||||
vm_states.RESIZED, vm_states.SOFT_DELETED])
|
||||
def swap_volume(self, context, instance, old_volume, new_volume):
|
||||
"""Swap volume attached to an instance."""
|
||||
if old_volume['attach_status'] == 'detached':
|
||||
@@ -3018,8 +3011,7 @@ class API(base.Base):
|
||||
host_name, block_migration=block_migration,
|
||||
disk_over_commit=disk_over_commit)
|
||||
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED],
|
||||
task_state=[None])
|
||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
|
||||
def evacuate(self, context, instance, host, on_shared_storage,
|
||||
admin_password=None):
|
||||
"""Running evacuate to target host.
|
||||
|
||||
Reference in New Issue
Block a user