Exemple #1
0
def check_node_group_template_unique_name(name):
    if name in [
            t.name for t in api.get_node_group_templates(
                tenant_id=context.ctx().tenant_id)
    ]:
        raise ex.NameAlreadyExistsException(
            _("NodeGroup template with name '%s' already exists") % name)
Exemple #2
0
def check_heat_stack_name(cluster_name):
    if CONF.infrastructure_engine == 'heat':
        for stack in heat.client().stacks.list():
            if stack.stack_name == cluster_name:
                raise ex.NameAlreadyExistsException(
                    "Cluster name '%s' is already used as Heat stack name" %
                    cluster_name)
Exemple #3
0
def check_data_source_unique_name(name):
    if name in [
            ds.name for ds in conductor.data_source_get_all(context.ctx())
    ]:
        raise ex.NameAlreadyExistsException(
            _("Data source with name '%s' "
              "already exists") % name)
Exemple #4
0
def check_cluster_unique_name(name):
    if name in [
            cluster.name
            for cluster in api.get_clusters(tenant_id=context.ctx().tenant_id)
    ]:
        raise ex.NameAlreadyExistsException(
            _("Cluster with name '%s' already exists") % name)
Exemple #5
0
def check_node_group_template_unique_name(ng_tmpl_name):
    if ng_tmpl_name in [
            ng_tmpl.name
            for ng_tmpl in api.get_node_group_templates(name=ng_tmpl_name)
    ]:
        raise ex.NameAlreadyExistsException(
            _("NodeGroup template with name '%s' already exists") %
            ng_tmpl_name)
Exemple #6
0
def check_cluster_template_unique_name(cluster_tmpl_name):
    if cluster_tmpl_name in [
            cluster_tmpl.name for cluster_tmpl in api.get_cluster_templates(
                name=cluster_tmpl_name)
    ]:
        raise ex.NameAlreadyExistsException(
            _("Cluster template with name '%s' already exists") %
            cluster_tmpl_name)
Exemple #7
0
def check_job_unique_name(job_name):
    if job_name in [
            job.name
            for job in conductor.job_get_all(context.ctx(), name=job_name)
    ]:
        raise ex.NameAlreadyExistsException(
            _("Job with name '%s' "
              "already exists") % job_name)
Exemple #8
0
def check_auto_security_group(cluster_name, nodegroup):
    if nodegroup.get('auto_security_group'):
        name = g.generate_auto_security_group_name(cluster_name,
                                                   nodegroup['name'])
        if name in [
                security_group.name
                for security_group in nova.client().security_groups.list()
        ]:
            raise ex.NameAlreadyExistsException(
                _("Security group with name '%s' already exists") % name)
Exemple #9
0
def check_job_unique_name(name):
    if name in [j.name for j in api.get_jobs()]:
        raise ex.NameAlreadyExistsException("Job with name '%s' "
                                            "already exists" % name)
Exemple #10
0
def check_data_source_unique_name(name):
    if name in [ds.name for ds in api.get_data_sources()]:
        raise ex.NameAlreadyExistsException("Data source with name '%s' "
                                            "already exists" % name)
Exemple #11
0
def check_node_group_template_unique_name(name):
    if name in [t.name for t in api.get_node_group_templates()]:
        raise ex.NameAlreadyExistsException("NodeGroup template with name '%s'"
                                            " already exists" % name)
Exemple #12
0
def check_cluster_template_unique_name(name):
    if name in [t.name for t in api.get_cluster_templates()]:
        raise ex.NameAlreadyExistsException("Cluster template with name '%s'"
                                            " already exists" % name)
Exemple #13
0
def check_cluster_unique_name(name):
    if name in [cluster.name for cluster in api.get_clusters()]:
        raise ex.NameAlreadyExistsException("Cluster with name '%s' already"
                                            " exists" % name)
    check_heat_stack_name(name)
Exemple #14
0
def check_cluster_unique_name(cluster_name):
    if cluster_name in [
            cluster.name for cluster in api.get_clusters(name=cluster_name)
    ]:
        raise ex.NameAlreadyExistsException(
            _("Cluster with name '%s' already exists") % cluster_name)
Exemple #15
0
def check_heat_stack_name(cluster_name):
    if CONF.infrastructure_engine == 'heat':
        if heat.get_stack(cluster_name, raise_on_missing=False):
            raise ex.NameAlreadyExistsException(
                _("Cluster name '%s' is already used as Heat stack name") %
                cluster_name)