Add snapshot clean worker decorator
Snapshot's clean worker decorator is deleted by accident among patch [1]. [1]: Ib20d749c2118c350b5fa0361ed1811296d518a17 Change-Id: Iadfe3d3dd55379f17fef1dbcc2cef31c81a81b2b
This commit is contained in:
parent
30431abf2a
commit
b9d235a8a7
@ -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…
x
Reference in New Issue
Block a user