Set source volume to "in use" during clone

When we are cloning a volume, we now set the source volume's status
to 'in use'. This prevents a user from deleting the source volume while the
backend copies/clones the contents to the new volume.
When the cloning is complete, we reset the status to it's original
state.

Change-Id: Ie43345aba77df4671ed2b429645cf8d1af9b975b
This commit is contained in:
Walter A. Boring IV 2013-01-29 11:52:46 -08:00
parent d66ea53e82
commit 54448d5bf8

View File

@ -176,8 +176,12 @@ class VolumeManager(manager.SchedulerDependentManager):
snapshot_ref)
elif source_volid is not None:
src_vref = self.db.volume_get(context, source_volid)
self.db.volume_update(context, src_vref['id'],
{'status': 'in use'})
model_update = self.driver.create_cloned_volume(volume_ref,
src_vref)
self.db.volume_update(context, src_vref['id'],
{'status': src_vref['status']})
else:
# create the volume from an image
image_service, image_id = \