From 690e56e5cfc96540d01d5632fe9264dd6dec7ead Mon Sep 17 00:00:00 2001 From: Masco Kaliyamoorthy Date: Mon, 27 Apr 2015 14:58:00 +0530 Subject: [PATCH] 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 Change-Id: I19ddd572d1a7a028e3ae4dae412ffc54e730e50c Closes-Bug: #1447288 --- .../dashboards/project/volumes/volumes/forms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py index 17db2d059c..b5feeccf5e 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/forms.py @@ -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