summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary W. Smith <gary.w.smith@hp.com>2014-10-01 16:48:49 -0700
committerGary W. Smith <gary.w.smith@hp.com>2014-10-02 07:16:00 -0700
commit63a5ad95f581354abf60c67a9f865041f5d5e05f (patch)
treee681c32e0f4f01d6d6b96fc54a64821d62d5597b
parentca4a772d5f577791155b7009e03eeede873ef43c (diff)
downloadhorizon-63a5ad95f581354abf60c67a9f865041f5d5e05f.tar.gz
Enable launching instance from zero-size image snapshot
Remove the general hardcoded minimum of 1GB volume size on the create instance workflow, and selectively enforce it when the volume size field is used and editable: namely, when launching an instance from an image and creating a new volume. This general minimum was preventing the launch of instances from image snapshots (whose size is reported as 0) by causing browser errors as the browser tried to highlight the error of the invisible size field. Closes-Bug: 1374931 Change-Id: Ied0eb41f5198d935bbb0896e5004ea78176bc2b8
-rw-r--r--openstack_dashboard/dashboards/project/instances/workflows/create_instance.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
index 893109171..e19ef4bbc 100644
--- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
+++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
@@ -110,7 +110,7 @@ class SetInstanceDetailsAction(workflows.Action):
volume_size = forms.IntegerField(label=_("Device size (GB)"),
initial=1,
- min_value=1,
+ min_value=0,
required=False,
help_text=_("Volume size in gigabytes "
"(integer value)."))
@@ -221,9 +221,13 @@ class SetInstanceDetailsAction(workflows.Action):
if source_type in ('image_id', 'volume_image_id'):
if source_type == 'volume_image_id':
- if not self.data.get('volume_size', None):
+ volume_size = self.data.get('volume_size', None)
+ if not volume_size:
msg = _("You must set volume size")
self._errors['volume_size'] = self.error_class([msg])
+ if float(volume_size) <= 0:
+ msg = _("Volume size must be greater than 0")
+ self._errors['volume_size'] = self.error_class([msg])
if not cleaned_data.get('device_name'):
msg = _("You must set device name")
self._errors['device_name'] = self.error_class([msg])