Merge "Perform old-style local delete for shelved offloaded instances"

This commit is contained in:
Jenkins 2017-04-07 01:56:30 +00:00 committed by Gerrit Code Review
commit e18e23e100
2 changed files with 9 additions and 5 deletions

View File

@ -1834,10 +1834,12 @@ class API(base.Base):
instance=instance)
return
# If there is an instance.host the instance has been scheduled and
# sent to a cell/compute which means it was pulled from the cell db.
# If there is an instance.host (or the instance is shelved-offloaded),
# the instance has been scheduled and sent to a cell/compute which
# means it was pulled from the cell db.
# Normal delete should be attempted.
if not instance.host:
if not (instance.host or
instance.vm_state == vm_states.SHELVED_OFFLOADED):
try:
if self._delete_while_booting(context, instance):
return

View File

@ -64,6 +64,8 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
self.flags(driver='chance_scheduler', group='scheduler')
self.start_service('scheduler')
self.start_service('compute')
# The consoleauth service is needed for deleting console tokens.
self.start_service('consoleauth')
self.useFixture(cast_as_call.CastAsCall(self.stubs))
@ -164,5 +166,5 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
LOG.info('Validating that volume %s was detached from server %s.',
volume_id, server_id)
# When bug 1675570 is fixed, this should be assertNotIn.
self.assertIn(volume_id, self.cinder.attachments[server_id])
# Now that the bug is fixed, assert the volume was detached.
self.assertNotIn(volume_id, self.cinder.attachments[server_id])