Beispiel #1
0
def check_cluster_template_create(data, **kwargs):
    plugin_version = 'hadoop_version'
    if data.get('plugin_version'):
        plugin_version = 'plugin_version'

    b.check_cluster_template_unique_name(data['name'])
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'],
                                    data[plugin_version])

    if data.get('default_image_id'):
        b.check_image_registered(data['default_image_id'])
        b.check_required_image_tags(data['plugin_name'],
                                    data[plugin_version],
                                    data['default_image_id'])

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data[plugin_version],
                               data['anti_affinity'])

    if data.get('neutron_management_network'):
        b.check_network_exists(data['neutron_management_network'])

    if data.get('shares'):
        shares.check_shares(data['shares'])
def check_cluster_template_update(cluster_template_id, data, **kwargs):
    if data.get('plugin_name') and not data.get('hadoop_version'):
        raise ex.InvalidReferenceException(
            _("You must specify a hadoop_version value "
              "for your plugin_name"))

    if data.get('plugin_name'):
        plugin = data['plugin_name']
        version = data['hadoop_version']
        b.check_plugin_name_exists(plugin)
        b.check_plugin_supports_version(plugin, version)
        b.check_all_configurations(data)
    else:
        cluster_template = api.get_cluster_template(cluster_template_id)
        plugin = cluster_template.plugin_name
        if data.get('hadoop_version'):
            version = data.get('hadoop_version')
            b.check_plugin_supports_version(plugin, version)
        else:
            version = cluster_template.hadoop_version

    if data.get('default_image_id'):
        b.check_image_registered(data['default_image_id'])
        b.check_required_image_tags(plugin, version, data['default_image_id'])

    if data.get('anti_affinity'):
        b.check_node_processes(plugin, version, data['anti_affinity'])

    if data.get('neutron_management_network'):
        b.check_network_exists(data['neutron_management_network'])

    if data.get('shares'):
        shares.check_shares(data['shares'])
Beispiel #3
0
def check_cluster_template_update(cluster_template_id, data, **kwargs):
    if data.get('plugin_name') and not data.get('hadoop_version'):
        raise ex.InvalidReferenceException(
            _("You must specify a hadoop_version value "
              "for your plugin_name"))

    if data.get('plugin_name'):
        plugin = data['plugin_name']
        version = data['hadoop_version']
        b.check_plugin_name_exists(plugin)
        b.check_plugin_supports_version(plugin, version)
        b.check_all_configurations(data)
    else:
        cluster_template = api.get_cluster_template(cluster_template_id)
        plugin = cluster_template.plugin_name
        if data.get('hadoop_version'):
            version = data.get('hadoop_version')
            b.check_plugin_supports_version(plugin, version)
        else:
            version = cluster_template.hadoop_version

    if data.get('default_image_id'):
        b.check_image_registered(data['default_image_id'])
        b.check_required_image_tags(plugin, version, data['default_image_id'])

    if data.get('anti_affinity'):
        b.check_node_processes(plugin, version, data['anti_affinity'])

    if data.get('neutron_management_network'):
        b.check_network_exists(data['neutron_management_network'])

    if data.get('shares'):
        shares.check_shares(data['shares'])
Beispiel #4
0
def check_cluster_template_create(data, **kwargs):
    plugin_version = 'hadoop_version'
    if data.get('plugin_version'):
        plugin_version = 'plugin_version'

    b.check_cluster_template_unique_name(data['name'])
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'], data[plugin_version])

    if data.get('default_image_id'):
        b.check_image_registered(data['default_image_id'])
        b.check_required_image_tags(data['plugin_name'], data[plugin_version],
                                    data['default_image_id'])

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data[plugin_version],
                               data['anti_affinity'])

    if data.get('neutron_management_network'):
        b.check_network_exists(data['neutron_management_network'])

    if data.get('shares'):
        shares.check_shares(data['shares'])
Beispiel #5
0
def check_cluster_create(data, **kwargs):
    b.check_cluster_unique_name(data['name'])
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'],
                                    data['hadoop_version'])
    if data.get('cluster_template_id'):
        ct_id = data['cluster_template_id']
        b.check_cluster_template_exists(ct_id)
        if not data.get('node_groups'):
            b.check_node_groups_in_cluster_templates(data['name'],
                                                     data['plugin_name'],
                                                     data['hadoop_version'],
                                                     ct_id)

    if data.get('user_keypair_id'):
        b.check_keypair_exists(data['user_keypair_id'])

    default_image_id = _get_cluster_field(data, 'default_image_id')
    if default_image_id:
        b.check_image_registered(default_image_id)
        b.check_required_image_tags(data['plugin_name'],
                                    data['hadoop_version'], default_image_id)
    else:
        raise ex.NotFoundException('default_image_id',
                                   _("'%s' field is not found"))

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data['hadoop_version'],
                               data['anti_affinity'])

    if data.get('node_groups'):
        proxy_gateway_used = len([
            ng
            for ng in data['node_groups'] if ng.get('is_proxy_gateway', False)
        ]) > 0
        b.check_network_config(data['node_groups'], proxy_gateway_used)
        b.check_cluster_hostnames_lengths(data['name'], data['node_groups'])

    neutron_net_id = _get_cluster_field(data, 'neutron_management_network')
    if neutron_net_id:
        if not CONF.use_neutron:
            raise ex.InvalidReferenceException(
                _("'neutron_management_network' field can't be used "
                  "with 'use_neutron=False'"))
        b.check_network_exists(neutron_net_id)
    else:
        if CONF.use_neutron:
            raise ex.NotFoundException('neutron_management_network',
                                       message=_("'%s' field is not found"))
Beispiel #6
0
def check_cluster_create(data, **kwargs):
    b.check_cluster_unique_name(data['name'])
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'],
                                    data['hadoop_version'])
    if data.get('cluster_template_id'):
        ct_id = data['cluster_template_id']
        b.check_cluster_template_exists(ct_id)
        if not data.get('node_groups'):
            b.check_node_groups_in_cluster_templates(data['name'],
                                                     data['plugin_name'],
                                                     data['hadoop_version'],
                                                     ct_id)

    if data.get('user_keypair_id'):
        b.check_keypair_exists(data['user_keypair_id'])

    default_image_id = _get_cluster_field(data, 'default_image_id')
    if default_image_id:
        b.check_image_registered(default_image_id)
        b.check_required_image_tags(data['plugin_name'],
                                    data['hadoop_version'],
                                    default_image_id)
    else:
        raise ex.NotFoundException('default_image_id',
                                   _("'%s' field is not found"))

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data['hadoop_version'],
                               data['anti_affinity'])

    if data.get('node_groups'):
        proxy_gateway_used = len([ng for ng in data['node_groups'] if
                                  ng.get('is_proxy_gateway', False)]) > 0
        b.check_network_config(data['node_groups'], proxy_gateway_used)
        b.check_cluster_hostnames_lengths(data['name'], data['node_groups'])

    neutron_net_id = _get_cluster_field(data, 'neutron_management_network')
    if neutron_net_id:
        if not CONF.use_neutron:
            raise ex.InvalidReferenceException(
                _("'neutron_management_network' field can't be used "
                  "with 'use_neutron=False'"))
        b.check_network_exists(neutron_net_id)
    else:
        if CONF.use_neutron:
            raise ex.NotFoundException('neutron_management_network',
                                       _("'%s' field is not found"))
Beispiel #7
0
def _check_cluster_create(data):
    plugin_version = 'hadoop_version'
    if data.get('plugin_version'):
        plugin_version = 'plugin_version'
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'],
                                    data[plugin_version])
    b.check_plugin_labels(
        data['plugin_name'], data[plugin_version])

    if data.get('cluster_template_id'):
        ct_id = data['cluster_template_id']
        b.check_cluster_template_exists(ct_id)
        if not data.get('node_groups'):
            b.check_node_groups_in_cluster_templates(data['name'],
                                                     data['plugin_name'],
                                                     data[plugin_version],
                                                     ct_id)

    if data.get('user_keypair_id'):
        b.check_keypair_exists(data['user_keypair_id'])

    default_image_id = _get_cluster_field(data, 'default_image_id')
    if default_image_id:
        b.check_image_registered(default_image_id)
        b.check_required_image_tags(data['plugin_name'],
                                    data[plugin_version],
                                    default_image_id)
    else:
        raise ex.NotFoundException('default_image_id',
                                   _("'%s' field is not found"))

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data[plugin_version],
                               data['anti_affinity'])

    if data.get('node_groups'):
        b.check_cluster_hostnames_lengths(data['name'], data['node_groups'])

    neutron_net_id = _get_cluster_field(data, 'neutron_management_network')
    if neutron_net_id:
        b.check_network_exists(neutron_net_id)
    else:
        raise ex.NotFoundException('neutron_management_network',
                                   _("'%s' field is not found"))
Beispiel #8
0
def check_cluster_template_create(data, **kwargs):
    b.check_cluster_template_unique_name(data["name"])
    b.check_plugin_name_exists(data["plugin_name"])
    b.check_plugin_supports_version(data["plugin_name"], data["hadoop_version"])

    if data.get("default_image_id"):
        b.check_image_registered(data["default_image_id"])
        b.check_required_image_tags(data["plugin_name"], data["hadoop_version"], data["default_image_id"])

    b.check_all_configurations(data)

    if data.get("anti_affinity"):
        b.check_node_processes(data["plugin_name"], data["hadoop_version"], data["anti_affinity"])

    if data.get("neutron_management_network"):
        b.check_network_exists(data["neutron_management_network"])

    if data.get("shares"):
        shares.check_shares(data["shares"])
Beispiel #9
0
def _check_cluster_create(data):
    b.check_plugin_name_exists(data["plugin_name"])
    b.check_plugin_supports_version(data["plugin_name"], data["hadoop_version"])
    b.check_plugin_labels(data["plugin_name"], data["hadoop_version"])

    if data.get("cluster_template_id"):
        ct_id = data["cluster_template_id"]
        b.check_cluster_template_exists(ct_id)
        if not data.get("node_groups"):
            b.check_node_groups_in_cluster_templates(data["name"], data["plugin_name"], data["hadoop_version"], ct_id)

    if data.get("user_keypair_id"):
        b.check_keypair_exists(data["user_keypair_id"])

    default_image_id = _get_cluster_field(data, "default_image_id")
    if default_image_id:
        b.check_image_registered(default_image_id)
        b.check_required_image_tags(data["plugin_name"], data["hadoop_version"], default_image_id)
    else:
        raise ex.NotFoundException("default_image_id", _("'%s' field is not found"))

    b.check_all_configurations(data)

    if data.get("anti_affinity"):
        b.check_node_processes(data["plugin_name"], data["hadoop_version"], data["anti_affinity"])

    if data.get("node_groups"):
        proxy_gateway_used = len([ng for ng in data["node_groups"] if ng.get("is_proxy_gateway", False)]) > 0
        b.check_network_config(data["node_groups"], proxy_gateway_used)
        b.check_cluster_hostnames_lengths(data["name"], data["node_groups"])

    neutron_net_id = _get_cluster_field(data, "neutron_management_network")
    if neutron_net_id:
        if not CONF.use_neutron:
            raise ex.InvalidReferenceException(
                _("'neutron_management_network' field can't be used " "with 'use_neutron=False'")
            )
        b.check_network_exists(neutron_net_id)
    else:
        if CONF.use_neutron:
            raise ex.NotFoundException("neutron_management_network", _("'%s' field is not found"))
Beispiel #10
0
def check_cluster_create(data, **kwargs):
    b.check_cluster_unique_name(data['name'])
    b.check_plugin_name_exists(data['plugin_name'])
    b.check_plugin_supports_version(data['plugin_name'],
                                    data['hadoop_version'])
    if data.get('cluster_template_id'):
        ct_id = data['cluster_template_id']
        b.check_cluster_template_exists(ct_id)
        if not data.get('node_groups'):
            b.check_node_groups_in_cluster_templates(data['plugin_name'],
                                                     data['hadoop_version'],
                                                     ct_id)

    if data.get('user_keypair_id'):
        b.check_keypair_exists(data['user_keypair_id'])

    default_image_id = _get_cluster_field(data, 'default_image_id')
    if default_image_id:
        b.check_image_registered(default_image_id)
        b.check_required_image_tags(data['plugin_name'],
                                    data['hadoop_version'],
                                    default_image_id)
    else:
        raise ex.NotFoundException('default_image_id',
                                   "'%s' field is not found")

    b.check_all_configurations(data)

    if data.get('anti_affinity'):
        b.check_node_processes(data['plugin_name'], data['hadoop_version'],
                               data['anti_affinity'])

    if data.get('node_groups'):
        b.check_network_config(data['node_groups'])

    neutron_net_id = _get_cluster_field(data, 'neutron_management_network')
    if neutron_net_id:
        b.check_network_exists(neutron_net_id)