Example #1
0
# set partiton of each host in cluster
status, resp = client.set_partition(cluster_id,
                                    home_percentage=HOME_PERCENTAGE,
                                    tmp_partition_percentage=TMP_PERCENTAGE,
                                    var_partition_percentage=VAR_PERCENTAGE)
print 'set partition config to cluster %s status: %s, resp: %s' % (
    cluster_id, status, resp)

# set each host config in cluster.
for host_id in host_ids:
    if ROLES_LIST:
        roles = ROLES_LIST.pop(0)
    else:
        roles = []
    status, resp = client.update_host_config(host_id,
                                             hostname='%s%s' %
                                             (HOST_NAME_PREFIX, host_id),
                                             roles=roles)
    print 'set roles to host %s status: %s, resp: %s' % (host_id, status, resp)

# deploy cluster.
status, resp = client.deploy_hosts(cluster_id)
print 'deploy cluster %s status: %s, resp: %s' % (cluster_id, status, resp)

# get intalling progress.
while True:
    status, resp = client.get_cluster_installing_progress(cluster_id)
    print 'get cluster %s installing progress status: %s, resp: %s' % (
        cluster_id, status, resp)
    progress = resp['progress']
    if (progress['state'] not in ['UNINITIALIZED', 'INSTALLING']
            or progress['percentage'] >= 1.0):
Example #2
0
    home_percentage=HOME_PERCENTAGE,
    tmp_percentage=TMP_PERCENTAGE,
    var_percentage=VAR_PERCENTAGE)
print 'set partition config to cluster %s status: %s, resp: %s' % (
    cluster_id, status, resp)


# set each host config in cluster.
ROLES_LIST = [PRESET_VALUES['ROLES_LIST'].split()]
for host_id in host_ids:
    if ROLES_LIST:
        roles = ROLES_LIST.pop(0)
    else:
        roles = []
    status, resp = client.update_host_config(
        host_id, hostname='%s%s' % (HOST_NAME_PREFIX, host_id),
        roles=roles)
    print 'set roles to host %s status: %s, resp: %s' % (
        host_id, status, resp)


# deploy cluster.
status, resp = client.deploy_hosts(cluster_id)
print 'deploy cluster %s status: %s, resp: %s' % (cluster_id, status, resp)


# get intalling progress.
BUILD_TIMEOUT = float(PRESET_VALUES['BUILD_TIMEOUT'])
timeout = time.time() + BUILD_TIMEOUT * 60
while True:
    status, resp = client.get_cluster_installing_progress(cluster_id)