Beispiel #1
0
    def test_limits_for_cluster(self, p1, p2, p3):
        ng = [FakeNodeGroup(1, False, 0, 0, None, 'id1', [1, 2, 3])]
        quotas.check_cluster(FakeCluster(ng))

        with testtools.ExpectedException(exc.QuotaException):
            quotas.check_cluster(FakeCluster([FakeNodeGroup(
                1, False, 3, 3, None, 'id1', [1, 2, 3])]))

        ng = [FakeNodeGroup(1, False, 0, 0, None, 'id1', [1, 2, 3]),
              FakeNodeGroup(0, False, 0, 0, None, 'id1', [1, 2, 3])]
        quotas.check_scaling(FakeCluster(ng), {}, {ng[1].id: 1})

        with testtools.ExpectedException(exc.QuotaException):
            quotas.check_scaling(FakeCluster(ng), {}, {ng[1].id: 3})
Beispiel #2
0
    def test_limits_for_cluster(self, p1, p2, p3):
        ng = [FakeNodeGroup(1, False, 0, 0, None, 'id1', [1, 2, 3])]
        quotas.check_cluster(FakeCluster(ng))

        with testtools.ExpectedException(exc.QuotaException):
            quotas.check_cluster(FakeCluster([FakeNodeGroup(
                1, False, 3, 3, None, 'id1', [1, 2, 3])]))

        ng = [FakeNodeGroup(1, False, 0, 0, None, 'id1', [1, 2, 3]),
              FakeNodeGroup(0, False, 0, 0, None, 'id1', [1, 2, 3])]
        quotas.check_scaling(FakeCluster(ng), {}, {ng[1].id: 1})

        with testtools.ExpectedException(exc.QuotaException):
            quotas.check_scaling(FakeCluster(ng), {}, {ng[1].id: 3})
Beispiel #3
0
def create_cluster(values):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    sender.notify(ctx, cluster.id, cluster.name, "New", "create")
    plugin = plugin_base.PLUGINS.get_plugin(cluster.plugin_name)
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        cluster = g.change_cluster_status(cluster, "Validating")
        quotas.check_cluster(cluster)
        plugin.validate(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            g.change_cluster_status(cluster, "Error", six.text_type(e))

    OPS.provision_cluster(cluster.id)

    return cluster
Beispiel #4
0
def _cluster_create(values, plugin):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    context.set_current_cluster_id(cluster.id)
    sender.notify(ctx, cluster.id, cluster.name, "New", "create")
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        plugin.recommend_configs(cluster)
        cluster = g.change_cluster_status(cluster, "Validating")
        quotas.check_cluster(cluster)
        plugin.validate(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            g.change_cluster_status(cluster, "Error", six.text_type(e))

    OPS.provision_cluster(cluster.id)

    return cluster
Beispiel #5
0
def create_cluster(values):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    sender.notify(ctx, cluster.id, cluster.name, "New",
                  "create")
    plugin = plugin_base.PLUGINS.get_plugin(cluster.plugin_name)
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        cluster = g.change_cluster_status(cluster, "Validating")
        quotas.check_cluster(cluster)
        plugin.validate(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            g.change_cluster_status(cluster, "Error",
                                    six.text_type(e))

    OPS.provision_cluster(cluster.id)

    return cluster
Beispiel #6
0
def _cluster_create(values, plugin):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    context.set_current_cluster_id(cluster.id)
    sender.status_notify(cluster.id, cluster.name, "New", "create")
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        plugin.recommend_configs(cluster)
        cluster = c_u.change_cluster_status(cluster,
                                            c_u.CLUSTER_STATUS_VALIDATING)
        plugin.validate(cluster)
        quotas.check_cluster(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            c_u.change_cluster_status(cluster, c_u.CLUSTER_STATUS_ERROR,
                                      six.text_type(e))

    api.OPS.provision_cluster(cluster.id)

    return cluster
Beispiel #7
0
def _cluster_create(values, plugin):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    context.set_current_cluster_id(cluster.id)
    sender.notify(ctx, cluster.id, cluster.name, "New",
                  "create")
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        plugin.recommend_configs(cluster)
        cluster = g.change_cluster_status(cluster, "Validating")
        quotas.check_cluster(cluster)
        plugin.validate(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            g.change_cluster_status(cluster, "Error",
                                    six.text_type(e))

    OPS.provision_cluster(cluster.id)

    return cluster
Beispiel #8
0
def _cluster_create(values, plugin):
    ctx = context.ctx()
    cluster = conductor.cluster_create(ctx, values)
    context.set_current_cluster_id(cluster.id)
    sender.status_notify(cluster.id, cluster.name, "New",
                         "create")
    _add_ports_for_auto_sg(ctx, cluster, plugin)

    # validating cluster
    try:
        plugin.recommend_configs(cluster)
        cluster = c_u.change_cluster_status(
            cluster, c_u.CLUSTER_STATUS_VALIDATING)
        plugin.validate(cluster)
        quotas.check_cluster(cluster)
    except Exception as e:
        with excutils.save_and_reraise_exception():
            c_u.change_cluster_status(
                cluster, c_u.CLUSTER_STATUS_ERROR, six.text_type(e))

    api.OPS.provision_cluster(cluster.id)

    return cluster