From: Alan Jiang Date: Tue, 20 Aug 2013 05:22:44 +0000 (-0500) Subject: Allow volume create from source unless in error status X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ab29496714296161ce60b3cd59b85289c3f8889e;p=openstack-build%2Fcinder-build.git Allow volume create from source unless in error status This patch restores the source volume status checking behavior to allow create_volume function to proceed unless it is in error status. In FibreChannel attached environment, it is typical to have a volume attached before the volume clone starts. The operating system owns the volume will ensure the consistency. Fixes: bug #1214235 Change-Id: Ie639f2f36e2939399303ca0658c169124801e86b --- diff --git a/cinder/volume/flows/create_volume.py b/cinder/volume/flows/create_volume.py index bc400c8ca..af6567d1a 100644 --- a/cinder/volume/flows/create_volume.py +++ b/cinder/volume/flows/create_volume.py @@ -52,7 +52,8 @@ QUOTAS = quota.QUOTAS # Only in these 'sources' status can we attempt to create a volume from a # source volume or a source snapshot, other status states we can not create # from, 'error' being the common example. -PROCEED_STATUS = ('available',) +SNAPSHOT_PROCEED_STATUS = ('available',) +SRC_VOL_PROCEED_STATUS = ('available', 'in-use',) # When a volume errors out we have the ability to save a piece of the exception # that caused said failure, but we don't want to save the whole message since @@ -236,10 +237,10 @@ class ExtractVolumeRequestTask(CinderTask): snapshot_id = None if snapshot is not None: - if snapshot['status'] not in PROCEED_STATUS: + if snapshot['status'] not in SNAPSHOT_PROCEED_STATUS: msg = _("Originating snapshot status must be one" " of %s values") - msg = msg % (", ".join(PROCEED_STATUS)) + msg = msg % (", ".join(SNAPSHOT_PROCEED_STATUS)) # TODO(harlowja): what happens if the status changes after this # initial snapshot status check occurs??? Seems like someone # could delete the snapshot after this check passes but before @@ -258,11 +259,11 @@ class ExtractVolumeRequestTask(CinderTask): source_volid = None if source_volume is not None: - if source_volume['status'] not in PROCEED_STATUS: + if source_volume['status'] not in SRC_VOL_PROCEED_STATUS: msg = _("Unable to create a volume from an originating source" " volume when its status is not one of %s" " values") - msg = msg % (", ".join(PROCEED_STATUS)) + msg = msg % (", ".join(SRC_VOL_PROCEED_STATUS)) # TODO(harlowja): what happens if the status changes after this # initial volume status check occurs??? Seems like someone # could delete the volume after this check passes but before