corrected the create volume from snapshot

While creating the volume from snapshot via horizon UI, the volume
is not created from snapshot. It is just creating a volume with
same size of the snapshot.

Fixed the condition used if snapshot_id should be passed when
creating volume. The volume_source_type field is empty string if
launched from Volume Snapshot panel.

Co-Authored-By: Lin Hua Cheng <os.lcheng@gmail.com>

Change-Id: I19ddd572d1a7a028e3ae4dae412ffc54e730e50c
Closes-Bug: #1447288
This commit is contained in:
Masco Kaliyamoorthy 2015-04-27 14:58:00 +05:30 committed by lin-hua-cheng
parent f9935e916d
commit 690e56e5cf
1 changed files with 3 additions and 3 deletions

View File

@ -319,7 +319,7 @@ class CreateForm(forms.SelfHandlingForm):
source_type = data.get('volume_source_type', None)
az = data.get('availability_zone', None) or None
if (data.get("snapshot_source", None) and
source_type in [None, 'snapshot_source']):
source_type in ['', None, 'snapshot_source']):
# Create from Snapshot
snapshot = self.get_snapshot(request,
data["snapshot_source"])
@ -331,7 +331,7 @@ class CreateForm(forms.SelfHandlingForm):
raise ValidationError(error_message)
az = None
elif (data.get("image_source", None) and
source_type in [None, 'image_source']):
source_type in ['', None, 'image_source']):
# Create from Snapshot
image = self.get_image(request,
data["image_source"])
@ -351,7 +351,7 @@ class CreateForm(forms.SelfHandlingForm):
% min_disk_size)
raise ValidationError(error_message)
elif (data.get("volume_source", None) and
source_type in [None, 'volume_source']):
source_type in ['', None, 'volume_source']):
# Create from volume
volume = self.get_volume(request, data["volume_source"])
volume_id = volume.id