Allow deleting instances while uuid lock is held

Avoid issues where locked up operations on the instance prevent it
from being deleted by the user. Reasons for the lock up are a separate
issue and will be handled elsewhere, but terminating the instance
should not affect any tasks anyway. Any modification should already
gracefully handle the instance going away.

For more discussion about the issue see:
http://lists.openstack.org/pipermail/openstack-dev/2013-October/017454.html

This patch was merged once before and had to be reverted in
6b7304d8d3.  It was causing an extremely
large number of errors in gate jobs.  I believe that the case being hit
should be expected with this patch in place, and that it's actually OK.
We expect that the rest of the code will handle this case gracefully.
Simply remove this error message from the code.

Change-Id: I83deae464518fef5abe8fc00bfd0a186de01527b
Partial-Bug: #1248563
Co-authored-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Stanislaw Pitucha
2013-11-06 14:15:51 +00:00
committed by Russell Bryant
parent 65d1071a09
commit 08beabc5e0
2 changed files with 6 additions and 8 deletions

View File

@@ -2025,7 +2025,7 @@ class ComputeManager(manager.Manager):
def terminate_instance(self, context, instance, bdms, reservations):
"""Terminate an instance on this host."""
@utils.synchronized(instance['uuid'])
@utils.synchronized(instance['uuid'] + ".delete")
def do_terminate_instance(instance, bdms):
try:
self._delete_instance(context, instance, bdms,

View File

@@ -916,19 +916,17 @@ class NetworkManager(manager.Manager):
if CONF.force_dhcp_release:
dev = self.driver.get_dev(network)
# NOTE(vish): The below errors should never happen, but there
# may be a race condition that is causing them per
# https://code.launchpad.net/bugs/968457, so we log
# an error to help track down the possible race.
msg = _("Unable to release %s because vif doesn't exist.")
if not vif_id:
LOG.error(msg % address)
# NOTE(russellb) This will get hit if we're tearing down an
# instance before it finished getting created. In that
# case a vif may never have been associated with the
# fixed_ip.
return
vif = vif_obj.VirtualInterface.get_by_id(context, vif_id)
if not vif:
LOG.error(msg % address)
return
# NOTE(cfb): Call teardown before release_dhcp to ensure