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
This commit is contained in:
parent
ca4a772d5f
commit
63a5ad95f5
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue