コード例 #1
0
ファイル: v02.py プロジェクト: ddutta/savanna
def clusters_get(cluster_id):
    c = None
    try:
        c = api.get_cluster(id=cluster_id)
    except Exception, e:
        abort_and_log(500, 'Exception while getting Cluster with id '
                           '\'%s\'' % cluster_id, e)
コード例 #2
0
def check_cluster_scaling(data, cluster_id, **kwargs):
    cluster = api.get_cluster(id=cluster_id)
    if not (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'scale_cluster') and
            (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                      'decommission_nodes'))):
        raise ex.InvalidException(
            "Requested plugin '%s' doesn't support cluster scaling feature" %
            cluster.plugin_name)

    if cluster.status != 'Active':
        raise ex.InvalidException("Cluster cannot be scaled not in 'Active' "
                                  "status. Cluster status: " + cluster.status)

    if data.get("resize_node_groups"):
        b.check_resize(cluster, data['resize_node_groups'])

    if data.get("add_node_groups"):
        b.check_add_node_groups(cluster, data['add_node_groups'])
コード例 #3
0
ファイル: clusters_scaling.py プロジェクト: StokesB1/savanna
def check_cluster_scaling(data, cluster_id, **kwargs):
    cluster = api.get_cluster(id=cluster_id)
    if not (plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'scale_cluster') and (
            plugin_base.PLUGINS.is_plugin_implements(cluster.plugin_name,
                                                     'decommission_nodes'))):
        raise ex.InvalidException(
            "Requested plugin '%s' doesn't support cluster scaling feature"
            % cluster.plugin_name)

    if cluster.status != 'Active':
        raise ex.InvalidException("Cluster cannot be scaled not in 'Active' "
                                  "status. Cluster status: " + cluster.status)

    if data.get("resize_node_groups"):
        b.check_resize(cluster, data['resize_node_groups'])

    if data.get("add_node_groups"):
        b.check_add_node_groups(cluster, data['add_node_groups'])
コード例 #4
0
ファイル: v10.py プロジェクト: chiehwen/savanna
def clusters_get(cluster_id):
    return u.render(api.get_cluster(cluster_id).to_wrapped_dict())
コード例 #5
0
ファイル: v10.py プロジェクト: jfzhang1984/savanna
def clusters_get(cluster_id):
    return u.render(api.get_cluster(id=cluster_id).wrapped_dict)
コード例 #6
0
def clusters_get(cluster_id):
    return u.render(api.get_cluster(cluster_id).to_wrapped_dict())
コード例 #7
0
def check_cluster_exists(id):
    if not api.get_cluster(id):
        raise ex.InvalidException("Cluster with id '%s'" " doesn't exist" % id)
コード例 #8
0
ファイル: v02.py プロジェクト: Frostman/savanna
def clusters_get(cluster_id):
    tenant_id = request.headers['X-Tenant-Id']
    c = api.get_cluster(id=cluster_id, tenant_id=tenant_id)
    return api_u.render(c.wrapped_dict)
コード例 #9
0
ファイル: base.py プロジェクト: joelmathew/savanna
def check_cluster_exists(id):
    if not api.get_cluster(id):
        raise ex.InvalidException("Cluster with id '%s'"
                                  " doesn't exist" % id)