Esempio n. 1
0
def _shutdown_cluster(cluster):
    """Shutdown specified cluster and all related resources."""
    try:
        volumes.detach(cluster)
    finally:
        _shutdown_instances(cluster)
        _clean_job_executions(cluster)
Esempio n. 2
0
def shutdown_cluster(cluster):
    """Shutdown specified cluster and all related resources."""
    try:
        volumes.detach(cluster)
    finally:
        _shutdown_instances(cluster)
        _clean_job_executions(cluster)
Esempio n. 3
0
def _rollback_cluster_creation(cluster, ex):
    """Shutdown all instances and update cluster status."""
    LOG.info("Cluster '%s' creation rollback (reason: %s)", cluster.name, ex)

    session = context.ctx().session
    _shutdown_instances(cluster, True)
    volumes.detach(cluster)
    alive_instances = set([srv.id for srv in nova.client().servers.list()])

    for node_group in cluster.node_groups:
        for instance in node_group.instances:
            if instance.instance_id in alive_instances:
                nova.client().servers.delete(instance.instance_id)
            with session.begin():
                session.delete(instance)
Esempio n. 4
0
def shutdown_cluster(cluster):
    """Shutdown specified cluster and all related resources."""
    volumes.detach(cluster)
    _shutdown_instances(cluster)