Merge "Fix snapshot stuck in 'deleting' after reboot c-v"
This commit is contained in:
commit
f2419e2ec8
|
@ -4567,6 +4567,16 @@ class VolumeTestCase(BaseVolumeTestCase):
|
||||||
self.context,
|
self.context,
|
||||||
snap)
|
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
|
@ddt.ddt
|
||||||
class VolumeMigrationTestCase(BaseVolumeTestCase):
|
class VolumeMigrationTestCase(BaseVolumeTestCase):
|
||||||
|
|
|
@ -442,10 +442,12 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||||
# threadpool to prevent the main volume service thread
|
# threadpool to prevent the main volume service thread
|
||||||
# from being blocked.
|
# from being blocked.
|
||||||
self._add_to_threadpool(self.delete_volume, ctxt,
|
self._add_to_threadpool(self.delete_volume, ctxt,
|
||||||
volume['id'], volume=volume)
|
volume['id'], volume=volume,
|
||||||
|
cascade=True)
|
||||||
else:
|
else:
|
||||||
# By default, delete volumes sequentially
|
# 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."),
|
LOG.info(_LI("Resume volume delete completed successfully."),
|
||||||
resource=volume)
|
resource=volume)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue