From 54448d5bf8f7ce06f0fb8ffd8c53f8b4cef67f25 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Tue, 29 Jan 2013 11:52:46 -0800 Subject: [PATCH] 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 --- cinder/volume/manager.py | 4 ++++ 1 file changed, 4 insertions(+) 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 = \ -- 2.45.2