Example #1
0
    def terminate_unneeded_clusters(self, ctx):
        LOG.debug('Terminating unneeded clusters')
        ctx = context.get_admin_context()
        if CONF.use_identity_api_v3:
            LOG.debug('Terminating unneeded clusters')
        context.set_ctx(ctx)
        for cluster in conductor.cluster_get_all(ctx, status='Active'):
            if not cluster.is_transient:
                continue

            jc = conductor.job_execution_count(ctx,
                                               end_time=None,
                                               cluster_id=cluster.id)

            if jc > 0:
                continue
            if CONF.use_identity_api_v3:
                trusts.use_os_admin_auth_token(cluster)
                api.terminate_cluster(cluster.id)
                LOG.debug('Terminated cluster %s with id %s' %
                          (cluster.name, cluster.id))
            else:
                if cluster.status != 'AwaitingTermination':
                    conductor.cluster_update(
                        ctx,
                        cluster,
                        {'status': 'AwaitingTermination'})
        context.set_ctx(None)
Example #2
0
def clusters_delete(cluster_id):
    api.terminate_cluster(cluster_id)
    return u.render()
Example #3
0
def clusters_delete(cluster_id):
    api.terminate_cluster(cluster_id)
    return u.render()
Example #4
0
def clusters_delete(cluster_id):
    headers = request.headers
    tenant_id = headers['X-Tenant-Id']
    api.terminate_cluster(headers, id=cluster_id, tenant_id=tenant_id)

    return api_u.render()