Browse Source

Merge "Enable launching instance from zero-size image snapshot"

Jenkins 4 years ago
parent
commit
0e10079e99

+ 6
- 2
openstack_dashboard/dashboards/project/instances/workflows/create_instance.py View File

@@ -110,7 +110,7 @@ class SetInstanceDetailsAction(workflows.Action):
110 110
 
111 111
     volume_size = forms.IntegerField(label=_("Device size (GB)"),
112 112
                                   initial=1,
113
-                                  min_value=1,
113
+                                  min_value=0,
114 114
                                   required=False,
115 115
                                   help_text=_("Volume size in gigabytes "
116 116
                                               "(integer value)."))
@@ -221,9 +221,13 @@ class SetInstanceDetailsAction(workflows.Action):
221 221
 
222 222
         if source_type in ('image_id', 'volume_image_id'):
223 223
             if source_type == 'volume_image_id':
224
-                if not self.data.get('volume_size', None):
224
+                volume_size = self.data.get('volume_size', None)
225
+                if not volume_size:
225 226
                     msg = _("You must set volume size")
226 227
                     self._errors['volume_size'] = self.error_class([msg])
228
+                if float(volume_size) <= 0:
229
+                    msg = _("Volume size must be greater than 0")
230
+                    self._errors['volume_size'] = self.error_class([msg])
227 231
                 if not cleaned_data.get('device_name'):
228 232
                     msg = _("You must set device name")
229 233
                     self._errors['device_name'] = self.error_class([msg])

Loading…
Cancel
Save