Merge "Fix snapshot stuck in 'deleting' after reboot c-v"

This commit is contained in:
Jenkins 2016-06-22 23:42:57 +00:00 committed by Gerrit Code Review
commit f2419e2ec8
2 changed files with 14 additions and 2 deletions

View File

@ -4567,6 +4567,16 @@ class VolumeTestCase(BaseVolumeTestCase):
self.context,
snap)
def test_init_host_clears_deleting_snapshots(self):
"""Test that init_host will delete a snapshot stuck in deleting."""
volume = tests_utils.create_volume(self.context, status='deleting',
size=1, host=CONF.host)
snapshot = tests_utils.create_snapshot(self.context,
volume.id, status='deleting')
self.volume.init_host()
self.assertRaises(exception.VolumeNotFound, volume.refresh)
self.assertRaises(exception.SnapshotNotFound, snapshot.refresh)
@ddt.ddt
class VolumeMigrationTestCase(BaseVolumeTestCase):

View File

@ -442,10 +442,12 @@ class VolumeManager(manager.SchedulerDependentManager):
# threadpool to prevent the main volume service thread
# from being blocked.
self._add_to_threadpool(self.delete_volume, ctxt,
volume['id'], volume=volume)
volume['id'], volume=volume,
cascade=True)
else:
# By default, delete volumes sequentially
self.delete_volume(ctxt, volume['id'], volume=volume)
self.delete_volume(ctxt, volume['id'], volume=volume,
cascade=True)
LOG.info(_LI("Resume volume delete completed successfully."),
resource=volume)