Boot from volume
Adding the boot from volume check on node group templates creation. Change-Id: I7bcfca72615758a5534901cdf6a0960ae9bd9a6a Story: #2001820 Task: #12560
This commit is contained in:
parent
bc2d21d1d0
commit
0dc65e9588
|
@ -170,7 +170,9 @@ def nodegroup_template_create(request, name, plugin_name, hadoop_version,
|
|||
shares=None,
|
||||
is_public=None,
|
||||
is_protected=None,
|
||||
volume_mount_prefix=None):
|
||||
volume_mount_prefix=None,
|
||||
boot_from_volume=None):
|
||||
|
||||
payload = dict(
|
||||
name=name,
|
||||
plugin_name=plugin_name,
|
||||
|
@ -194,10 +196,13 @@ def nodegroup_template_create(request, name, plugin_name, hadoop_version,
|
|||
is_public=is_public,
|
||||
is_protected=is_protected,
|
||||
volume_mount_prefix=volume_mount_prefix)
|
||||
|
||||
if VERSIONS.active == '2':
|
||||
payload['plugin_version'] = hadoop_version
|
||||
payload['boot_from_volume'] = boot_from_volume
|
||||
else:
|
||||
payload['hadoop_version'] = hadoop_version
|
||||
|
||||
return client(request).node_group_templates.create(**payload)
|
||||
|
||||
|
||||
|
@ -237,7 +242,9 @@ def nodegroup_template_update(request, ngt_id, name, plugin_name,
|
|||
shares=None,
|
||||
is_protected=None,
|
||||
is_public=None,
|
||||
image_id=None):
|
||||
image_id=None,
|
||||
boot_from_volume=None):
|
||||
|
||||
payload = dict(
|
||||
ng_template_id=ngt_id,
|
||||
name=name,
|
||||
|
@ -261,10 +268,13 @@ def nodegroup_template_update(request, ngt_id, name, plugin_name,
|
|||
is_public=is_public,
|
||||
is_protected=is_protected,
|
||||
image_id=image_id)
|
||||
|
||||
if VERSIONS.active == '2':
|
||||
payload['plugin_version'] = hadoop_version
|
||||
payload['boot_from_volume'] = boot_from_volume
|
||||
else:
|
||||
payload['hadoop_version'] = hadoop_version
|
||||
|
||||
return client(request).node_group_templates.update(**payload)
|
||||
|
||||
|
||||
|
|
|
@ -337,7 +337,8 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
shares=[],
|
||||
is_protected=False,
|
||||
is_public=False,
|
||||
image_id=ngt.image_id)
|
||||
image_id=ngt.image_id,
|
||||
)
|
||||
|
||||
@test.create_mocks({api.sahara: ('nodegroup_template_get',
|
||||
'plugin_get_version_details',
|
||||
|
|
|
@ -190,6 +190,15 @@ class GeneralConfigAction(workflows.Action):
|
|||
self.fields['is_protected'] = acl_utils.get_is_protected_form(
|
||||
_("node group template"))
|
||||
|
||||
if saharaclient.VERSIONS.active == '2':
|
||||
self.fields['boot_from_volume'] = forms.BooleanField(
|
||||
label=_("Boot From Volume"),
|
||||
help_text=_("If selected, the node group instance will be "
|
||||
"booted from volume"),
|
||||
required=False,
|
||||
widget=forms.CheckboxInput(),
|
||||
initial=False)
|
||||
|
||||
self.fields["plugin_name"] = forms.CharField(
|
||||
widget=forms.HiddenInput(),
|
||||
initial=plugin
|
||||
|
@ -547,6 +556,11 @@ class ConfigureNodegroupTemplate(workflow_helpers.ServiceParametersWorkflow,
|
|||
|
||||
image_id = context["general_image"] or None
|
||||
|
||||
if saharaclient.VERSIONS.active == '2':
|
||||
boot_from_volume = context["general_boot_from_volume"]
|
||||
else:
|
||||
boot_from_volume = None
|
||||
|
||||
ngt = saharaclient.nodegroup_template_create(
|
||||
request,
|
||||
name=context["general_nodegroup_name"],
|
||||
|
@ -570,6 +584,7 @@ class ConfigureNodegroupTemplate(workflow_helpers.ServiceParametersWorkflow,
|
|||
shares=ngt_shares,
|
||||
is_public=context['general_is_public'],
|
||||
is_protected=context['general_is_protected'],
|
||||
boot_from_volume=boot_from_volume,
|
||||
image_id=image_id)
|
||||
|
||||
hlps = helpers.Helpers(request)
|
||||
|
|
|
@ -79,7 +79,7 @@ class EditNodegroupTemplate(copy_flow.CopyNodegroupTemplate):
|
|||
|
||||
image_id = context["general_image"] or None
|
||||
|
||||
saharaclient.nodegroup_template_update(
|
||||
args_dict = dict(
|
||||
request=request,
|
||||
ngt_id=self.template_id,
|
||||
name=context["general_nodegroup_name"],
|
||||
|
@ -104,6 +104,13 @@ class EditNodegroupTemplate(copy_flow.CopyNodegroupTemplate):
|
|||
is_public=context['general_is_public'],
|
||||
is_protected=context['general_is_protected'],
|
||||
image_id=image_id)
|
||||
|
||||
if saharaclient.VERSIONS.active == '2':
|
||||
args_dict['boot_from_volume'] = (
|
||||
context['general_boot_from_volume'])
|
||||
|
||||
saharaclient.nodegroup_template_update(**args_dict)
|
||||
|
||||
return True
|
||||
except api_base.APIException as e:
|
||||
self.error_description = str(e.message)
|
||||
|
|
|
@ -59,6 +59,11 @@
|
|||
<dd>{{ template.auto_security_group }}</dd>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{% trans "Boot from Volume" %}</dt>
|
||||
<dd>{{ template.boot_from_volume }}</dd>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{% trans "Security Groups" %}</dt>
|
||||
<dd>
|
||||
|
|
Loading…
Reference in New Issue