Merge "Remove unnecessary passing of task_state to check_instance_state"

This commit is contained in:
Jenkins 2014-05-06 13:07:00 +00:00 committed by Gerrit Code Review
commit e990d9f0e1
1 changed files with 10 additions and 18 deletions

View File

@ -1752,8 +1752,7 @@ class API(base.Base):
@check_instance_host @check_instance_host
@check_instance_cell @check_instance_cell
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.RESCUED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.RESCUED,
vm_states.ERROR], vm_states.ERROR])
task_state=[None])
def stop(self, context, instance, do_cast=True): def stop(self, context, instance, do_cast=True):
"""Stop an instance.""" """Stop an instance."""
self.force_stop(context, instance, do_cast) self.force_stop(context, instance, do_cast)
@ -2111,8 +2110,7 @@ class API(base.Base):
@check_instance_lock @check_instance_lock
@check_instance_cell @check_instance_cell
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
vm_states.ERROR], vm_states.ERROR])
task_state=[None])
def rebuild(self, context, instance, image_href, admin_password, def rebuild(self, context, instance, image_href, admin_password,
files_to_inject=None, **kwargs): files_to_inject=None, **kwargs):
"""Rebuild the given instance with the provided attributes.""" """Rebuild the given instance with the provided attributes."""
@ -2350,8 +2348,7 @@ class API(base.Base):
@wrap_check_policy @wrap_check_policy
@check_instance_lock @check_instance_lock
@check_instance_cell @check_instance_cell
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED], @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
task_state=[None])
def resize(self, context, instance, flavor_id=None, def resize(self, context, instance, flavor_id=None,
**extra_instance_updates): **extra_instance_updates):
"""Resize (ie, migrate) a running instance. """Resize (ie, migrate) a running instance.
@ -2448,8 +2445,7 @@ class API(base.Base):
@wrap_check_policy @wrap_check_policy
@check_instance_lock @check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
vm_states.PAUSED, vm_states.SUSPENDED], vm_states.PAUSED, vm_states.SUSPENDED])
task_state=[None])
def shelve(self, context, instance): def shelve(self, context, instance):
"""Shelve an instance. """Shelve an instance.
@ -2475,7 +2471,7 @@ class API(base.Base):
@wrap_check_policy @wrap_check_policy
@check_instance_lock @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): def shelve_offload(self, context, instance):
"""Remove a shelved instance from the hypervisor.""" """Remove a shelved instance from the hypervisor."""
instance.task_state = task_states.SHELVING_OFFLOADING instance.task_state = task_states.SHELVING_OFFLOADING
@ -2486,7 +2482,7 @@ class API(base.Base):
@wrap_check_policy @wrap_check_policy
@check_instance_lock @check_instance_lock
@check_instance_state(vm_state=[vm_states.SHELVED, @check_instance_state(vm_state=[vm_states.SHELVED,
vm_states.SHELVED_OFFLOADED], task_state=[None]) vm_states.SHELVED_OFFLOADED])
def unshelve(self, context, instance): def unshelve(self, context, instance):
"""Restore a shelved instance.""" """Restore a shelved instance."""
instance.task_state = task_states.UNSHELVING instance.task_state = task_states.UNSHELVING
@ -2770,8 +2766,7 @@ class API(base.Base):
@check_instance_lock @check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
vm_states.STOPPED, vm_states.RESIZED, vm_states.STOPPED, vm_states.RESIZED,
vm_states.SOFT_DELETED], vm_states.SOFT_DELETED])
task_state=[None])
def attach_volume(self, context, instance, volume_id, device=None, def attach_volume(self, context, instance, volume_id, device=None,
disk_bus=None, device_type=None): disk_bus=None, device_type=None):
"""Attach an existing volume to an existing instance.""" """Attach an existing volume to an existing instance."""
@ -2799,8 +2794,7 @@ class API(base.Base):
@check_instance_lock @check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
vm_states.STOPPED, vm_states.RESIZED, vm_states.STOPPED, vm_states.RESIZED,
vm_states.SOFT_DELETED], vm_states.SOFT_DELETED])
task_state=[None])
def detach_volume(self, context, instance, volume): def detach_volume(self, context, instance, volume):
"""Detach a volume from an instance.""" """Detach a volume from an instance."""
if volume['attach_status'] == 'detached': if volume['attach_status'] == 'detached':
@ -2816,8 +2810,7 @@ class API(base.Base):
@check_instance_lock @check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED, @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.PAUSED,
vm_states.SUSPENDED, vm_states.STOPPED, vm_states.SUSPENDED, vm_states.STOPPED,
vm_states.RESIZED, vm_states.SOFT_DELETED], vm_states.RESIZED, vm_states.SOFT_DELETED])
task_state=[None])
def swap_volume(self, context, instance, old_volume, new_volume): def swap_volume(self, context, instance, old_volume, new_volume):
"""Swap volume attached to an instance.""" """Swap volume attached to an instance."""
if old_volume['attach_status'] == 'detached': if old_volume['attach_status'] == 'detached':
@ -3012,8 +3005,7 @@ class API(base.Base):
host_name, block_migration=block_migration, host_name, block_migration=block_migration,
disk_over_commit=disk_over_commit) disk_over_commit=disk_over_commit)
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED], @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
task_state=[None])
def evacuate(self, context, instance, host, on_shared_storage, def evacuate(self, context, instance, host, on_shared_storage,
admin_password=None): admin_password=None):
"""Running evacuate to target host. """Running evacuate to target host.