Skip to content

Commit

Permalink
Allow soft deletes from any state
Browse files Browse the repository at this point in the history
At some point in the past, the compute manager's delete() method had
its @check_instance_state() decorator updated to allow deletes to be
performed from any combination of vm_state and task_state.  This same
change was not made to the soft_delete() method, and so soft_delete()
is only available if the task_state is clear, meaning that instances
that are put into ERROR state with task_state set to something are
effectively undeletable, if FLAGS.reclaim_instance_interval is set to
some non-zero value (which is what causes the API DELETE call to use
soft_delete() as opposed to delete()).  This patch updates the
@check_instance_state() on soft_delete() to match that on delete(),
and fixes bug 1029130 and bug 1029133.  This patch also partially
fixes bug 1029132, but more needs to be done to completely fix that
bug.

Change-Id: I78878110c696280f2bc28434433814884a526264
  • Loading branch information
Kevin L. Mitchell committed Jul 25, 2012
1 parent 6908fbf commit 6f0fecb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nova/compute/api.py
Expand Up @@ -824,8 +824,7 @@ def update(self, context, instance, **kwargs):
return dict(instance_ref.iteritems())

@wrap_check_policy
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
vm_states.ERROR])
@check_instance_state(vm_state=None, task_state=None)
def soft_delete(self, context, instance):
"""Terminate an instance."""
LOG.debug(_('Going to try to soft delete instance'),
Expand Down

0 comments on commit 6f0fecb

Please sign in to comment.