From: Walter A. Boring IV Date: Tue, 29 Jan 2013 19:52:46 +0000 (-0800) Subject: Set source volume to "in use" during clone X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=54448d5bf8f7ce06f0fb8ffd8c53f8b4cef67f25;p=openstack-build%2Fcinder-build.git 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 --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 72e7cd396..5722ab112 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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 = \