diff --git a/openstack_dashboard/api/sahara.py b/openstack_dashboard/api/sahara.py index feb1c9e08d..faa80be6f7 100644 --- a/openstack_dashboard/api/sahara.py +++ b/openstack_dashboard/api/sahara.py @@ -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): diff --git a/openstack_dashboard/dashboards/project/data_processing/cluster_templates/templates/data_processing.cluster_templates/_nodegroups_details.html b/openstack_dashboard/dashboards/project/data_processing/cluster_templates/templates/data_processing.cluster_templates/_nodegroups_details.html index 7d85b6a5fb..139bcb4253 100644 --- a/openstack_dashboard/dashboards/project/data_processing/cluster_templates/templates/data_processing.cluster_templates/_nodegroups_details.html +++ b/openstack_dashboard/dashboards/project/data_processing/cluster_templates/templates/data_processing.cluster_templates/_nodegroups_details.html @@ -18,6 +18,18 @@
{% trans "Template not specified" %}
{% endif %} +
{% trans "Auto Security Group" %}
+
{{ node_group.auto_security_group|yesno }}
+ +
{% trans "Security Groups" %}
+
+ +
+
{% trans "Node Processes" %}
{% if node_group.node_processes %}
diff --git a/openstack_dashboard/dashboards/project/data_processing/clusters/templates/data_processing.clusters/_nodegroups_details.html b/openstack_dashboard/dashboards/project/data_processing/clusters/templates/data_processing.clusters/_nodegroups_details.html index 321a1d4677..d201ee24fd 100644 --- a/openstack_dashboard/dashboards/project/data_processing/clusters/templates/data_processing.clusters/_nodegroups_details.html +++ b/openstack_dashboard/dashboards/project/data_processing/clusters/templates/data_processing.clusters/_nodegroups_details.html @@ -26,6 +26,18 @@
{% trans "Template not specified" %}
{% endif %} +
{% trans "Auto Security Group" %}
+
{{ node_group.auto_security_group|yesno }}
+ +
{% trans "Security Groups" %}
+
+ +
+
{% trans "Node Processes" %}
{% if node_group.node_processes %}
diff --git a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/templates/data_processing.nodegroup_templates/_details.html b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/templates/data_processing.nodegroup_templates/_details.html index 0c5e5721fc..9d37319b91 100644 --- a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/templates/data_processing.nodegroup_templates/_details.html +++ b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/templates/data_processing.nodegroup_templates/_details.html @@ -20,6 +20,23 @@
{% trans "Hadoop Version" %}
{{ template.hadoop_version }}
+ +
+
{% trans "Auto Security Group" %}
+
{{ template.auto_security_group }}
+
+ +
+
{% trans "Security Groups" %}
+
+ +
+
+
{% trans "Node Processes" %}
diff --git a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py index 2a67686aac..171c57d976 100644 --- a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py +++ b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py @@ -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)