Exemplo n.º 1
0
    def handle(self, request, context):
        try:
            sahara = saharaclient.client(request)
            node_groups = []
            configs_dict = whelpers.parse_configs_from_context(
                context, self.defaults)

            ids = json.loads(context['ng_forms_ids'])
            for id in ids:
                name = context['ng_group_name_' + str(id)]
                template_id = context['ng_template_id_' + str(id)]
                count = context['ng_count_' + str(id)]

                ng = {
                    "name": name,
                    "node_group_template_id": template_id,
                    "count": count
                }
                node_groups.append(ng)

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            #TODO(nkonovalov): Fix client to support default_image_id
            sahara.cluster_templates.create(
                context["general_cluster_template_name"], plugin,
                hadoop_version, context["general_description"], configs_dict,
                node_groups, context["anti_affinity_info"])
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request)
Exemplo n.º 2
0
    def handle(self, request, context):
        try:
            sahara = saharaclient.client(request)

            processes = []
            for service_process in context["general_processes"]:
                processes.append(str(service_process).split(":")[1])

            configs_dict = whelpers.parse_configs_from_context(
                context, self.defaults)

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            volumes_per_node = None
            volumes_size = None

            if context["general_storage"] == "cinder_volume":
                volumes_per_node = context["general_volumes_per_node"]
                volumes_size = context["general_volumes_size"]

            sahara.node_group_templates.create(
                name=context["general_nodegroup_name"],
                plugin_name=plugin,
                hadoop_version=hadoop_version,
                description=context["general_description"],
                flavor_id=context["general_flavor"],
                volumes_per_node=volumes_per_node,
                volumes_size=volumes_size,
                node_processes=processes,
                node_configs=configs_dict,
                floating_ip_pool=context.get("general_floating_ip_pool", None))
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request)
Exemplo n.º 3
0
    def handle(self, request, context):
        try:
            sahara = saharaclient.client(request)

            processes = []
            for service_process in context["general_processes"]:
                processes.append(str(service_process).split(":")[1])

            configs_dict = whelpers.parse_configs_from_context(context,
                                                               self.defaults)

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            volumes_per_node = None
            volumes_size = None

            if context["general_storage"] == "cinder_volume":
                volumes_per_node = context["general_volumes_per_node"]
                volumes_size = context["general_volumes_size"]

            sahara.node_group_templates.create(
                name=context["general_nodegroup_name"],
                plugin_name=plugin,
                hadoop_version=hadoop_version,
                description=context["general_description"],
                flavor_id=context["general_flavor"],
                volumes_per_node=volumes_per_node,
                volumes_size=volumes_size,
                node_processes=processes,
                node_configs=configs_dict,
                floating_ip_pool=context.get("general_floating_ip_pool", None))
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request)
Exemplo n.º 4
0
    def handle(self, request, context):
        try:
            sahara = saharaclient.client(request)
            node_groups = []
            configs_dict = whelpers.parse_configs_from_context(context,
                                                               self.defaults)

            ids = json.loads(context['ng_forms_ids'])
            for id in ids:
                name = context['ng_group_name_' + str(id)]
                template_id = context['ng_template_id_' + str(id)]
                count = context['ng_count_' + str(id)]

                ng = {"name": name,
                      "node_group_template_id": template_id,
                      "count": count}
                node_groups.append(ng)

            plugin, hadoop_version = whelpers.\
                get_plugin_and_hadoop_version(request)

            # TODO(nkonovalov): Fix client to support default_image_id
            sahara.cluster_templates.create(
                context["general_cluster_template_name"],
                plugin,
                hadoop_version,
                context["general_description"],
                configs_dict,
                node_groups,
                context["anti_affinity_info"])
            return True
        except api_base.APIException as e:
            self.error_description = str(e)
            return False
        except Exception:
            exceptions.handle(request)