Merge "Add snapshot clean worker decorator"
This commit is contained in:
commit
ab236e32d6
@ -1929,6 +1929,16 @@ class VolumeTestCase(base.BaseVolumeTestCase):
|
||||
self.assertEqual(fields.SnapshotStatus.DELETING, snapshot.status)
|
||||
self.volume.delete_volume(self.context, volume)
|
||||
|
||||
def test_create_snapshot_set_worker(self):
|
||||
volume = tests_utils.create_volume(self.context)
|
||||
snapshot = create_snapshot(volume.id, size=volume['size'],
|
||||
ctxt=self.context,
|
||||
status=fields.SnapshotStatus.CREATING)
|
||||
|
||||
self.volume.create_snapshot(self.context, snapshot)
|
||||
|
||||
volume.set_worker.assert_called_once_with()
|
||||
|
||||
def test_cannot_delete_snapshot_with_bad_status(self):
|
||||
volume = tests_utils.create_volume(self.context, CONF.host)
|
||||
snapshot = create_snapshot(volume.id, size=volume['size'],
|
||||
|
@ -1020,6 +1020,7 @@ class VolumeManager(manager.CleanableManager,
|
||||
msg_args = {'v_id': volume.id, 'snap_id': snapshot.id}
|
||||
LOG.info(msg, msg_args)
|
||||
|
||||
@objects.Snapshot.set_workers
|
||||
def create_snapshot(self, context, snapshot):
|
||||
"""Creates and exports the snapshot."""
|
||||
context = context.elevated()
|
||||
|
Loading…
Reference in New Issue
Block a user