[Sahara] Added ability to specify security groups for node group
Known issues: 1. Security groups added to the same page as general parameters. Page is a little overloaded now. Will improve this later. Change-Id: Ieb224ea4db2adc46073b86e7181981ea598c9a8f Blueprint: cluster-secgroups Closes-Bug: #1364659
This commit is contained in:
parent
11a59735f5
commit
8001eb74a4
@ -92,7 +92,8 @@ def nodegroup_template_create(request, name, plugin_name, hadoop_version,
|
||||
flavor_id, description=None,
|
||||
volumes_per_node=None, volumes_size=None,
|
||||
node_processes=None, node_configs=None,
|
||||
floating_ip_pool=None):
|
||||
floating_ip_pool=None, security_groups=None,
|
||||
auto_security_group=False):
|
||||
return client(request).node_group_templates.create(name, plugin_name,
|
||||
hadoop_version,
|
||||
flavor_id, description,
|
||||
@ -100,7 +101,9 @@ def nodegroup_template_create(request, name, plugin_name, hadoop_version,
|
||||
volumes_size,
|
||||
node_processes,
|
||||
node_configs,
|
||||
floating_ip_pool)
|
||||
floating_ip_pool,
|
||||
security_groups,
|
||||
auto_security_group)
|
||||
|
||||
|
||||
def nodegroup_template_list(request):
|
||||
|
@ -18,6 +18,18 @@
|
||||
<dd>{% trans "Template not specified" %}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{% trans "Auto Security Group" %}</dt>
|
||||
<dd>{{ node_group.auto_security_group|yesno }}</dd>
|
||||
|
||||
<dt>{% trans "Security Groups" %}</dt>
|
||||
<dd>
|
||||
<ul class="list-bullet">
|
||||
{% for group in node_group.security_groups %}
|
||||
<li>{{ group }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt>{% trans "Node Processes" %}</dt>
|
||||
{% if node_group.node_processes %}
|
||||
<dd>
|
||||
|
@ -26,6 +26,18 @@
|
||||
<dd>{% trans "Template not specified" %}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{% trans "Auto Security Group" %}</dt>
|
||||
<dd>{{ node_group.auto_security_group|yesno }}</dd>
|
||||
|
||||
<dt>{% trans "Security Groups" %}</dt>
|
||||
<dd>
|
||||
<ul class="list-bullet">
|
||||
{% for group in node_group.security_groups %}
|
||||
<li>{{ group }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt>{% trans "Node Processes" %}</dt>
|
||||
{% if node_group.node_processes %}
|
||||
<dd>
|
||||
|
@ -20,6 +20,23 @@
|
||||
<dt>{% trans "Hadoop Version" %}</dt>
|
||||
<dd>{{ template.hadoop_version }}</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dt>{% trans "Auto Security Group" %}</dt>
|
||||
<dd>{{ template.auto_security_group }}</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dt>{% trans "Security Groups" %}</dt>
|
||||
<dd>
|
||||
<ul class="list-bullet">
|
||||
{% for group in template.security_groups %}
|
||||
<li>{{ group }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dt>{% trans "Node Processes" %}</dt>
|
||||
<dd>
|
||||
|
@ -98,6 +98,21 @@ class GeneralConfigAction(workflows.Action):
|
||||
choices=pool_choices,
|
||||
required=False)
|
||||
|
||||
self.fields["autogroup"] = forms.BooleanField(
|
||||
label=_("Auto Security Group"),
|
||||
widget=forms.CheckboxInput(),
|
||||
help_text=_("Create security group for this Node Group."),
|
||||
required=False)
|
||||
|
||||
groups = network.security_group_list(request)
|
||||
security_group_list = [(sg.id, sg.name) for sg in groups]
|
||||
self.fields["groups"] = forms.MultipleChoiceField(
|
||||
label=_("Security Groups"),
|
||||
widget=forms.CheckboxSelectMultiple(),
|
||||
help_text=_("Launch instances in these security groups."),
|
||||
choices=security_group_list,
|
||||
required=False)
|
||||
|
||||
self.fields["processes"] = forms.MultipleChoiceField(
|
||||
label=_("Processes"),
|
||||
widget=forms.CheckboxSelectMultiple(),
|
||||
@ -243,7 +258,9 @@ class ConfigureNodegroupTemplate(workflow_helpers.ServiceParametersWorkflow,
|
||||
volumes_size=volumes_size,
|
||||
node_processes=processes,
|
||||
node_configs=configs_dict,
|
||||
floating_ip_pool=context.get("general_floating_ip_pool", None))
|
||||
floating_ip_pool=context.get("general_floating_ip_pool"),
|
||||
security_groups=context["general_groups"],
|
||||
auto_security_group=context["general_autogroup"])
|
||||
return True
|
||||
except api_base.APIException as e:
|
||||
self.error_description = str(e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user