示例#1
0
# add hosts to the cluster.
status, resp = client.add_hosts(cluster_id=cluster_id,
                                machine_ids=machines.keys())
print 'add hosts to cluster %s status: %s, resp: %s' % (cluster_id, status,
                                                        resp)
host_ids = []
for host in resp['cluster_hosts']:
    host_ids.append(host['id'])

print 'added hosts: %s' % host_ids

# set cluster security
status, resp = client.set_security(cluster_id,
                                   server_username=SERVER_USERNAME,
                                   server_password=SERVER_PASSWORD,
                                   service_username=SERVICE_USERNAME,
                                   service_password=SERVICE_PASSWORD,
                                   console_username=CONSOLE_USERNAME,
                                   console_password=CONSOLE_PASSWORD)
print 'set security config to cluster %s status: %s, resp: %s' % (cluster_id,
                                                                  status, resp)

# set cluster networking
status, resp = client.set_networking(cluster_id,
                                     nameservers=NAMESERVERS,
                                     search_path=SEARCH_PATH,
                                     gateway=GATEWAY,
                                     proxy=PROXY,
                                     ntp_server=NTP_SERVER,
                                     management_ip_start=MANAGEMENT_IP_START,
                                     management_ip_end=MANAGEMENT_IP_END,
示例#2
0
    cluster_id=cluster_id,
    machine_ids=machines.keys())
print 'add hosts to cluster %s status: %s, resp: %s' % (
    cluster_id, status, resp)
host_ids = []
for host in resp['cluster_hosts']:
    host_ids.append(host['id'])

print 'added hosts: %s' % host_ids


# set cluster security
status, resp = client.set_security(
    cluster_id, server_username=SERVER_USERNAME,
    server_password=SERVER_PASSWORD,
    service_username=SERVICE_USERNAME,
    service_password=SERVICE_PASSWORD,
    console_username=CONSOLE_USERNAME,
    console_password=CONSOLE_PASSWORD)
print 'set security config to cluster %s status: %s, resp: %s' % (
    cluster_id, status, resp)


# set cluster networking
status, resp = client.set_networking(
    cluster_id,
    nameservers=PRESET_VALUES["NAMESERVERS"],
    search_path=SEARCH_PATH,
    gateway=PRESET_VALUES["GATEWAY"],
    proxy=PRESET_VALUES["PROXY"],
    ntp_server=PRESET_VALUES["NTP_SERVER"],