Use FQDN domain name for etcd connection
Plus fix PEP8 issues. Change-Id: Ifb0d0acc441317fe8521654f436fd923e195f2e1
This commit is contained in:
parent
a2be6ede7e
commit
9a3ee32d48
|
@ -287,7 +287,7 @@ def get_config():
|
|||
variables = {}
|
||||
with open(GLOBALS_PATH) as f:
|
||||
global_conf = json.load(f)
|
||||
for key in ['percona', 'etcd', 'namespace']:
|
||||
for key in ['percona', 'etcd', 'namespace', 'cluster_domain']:
|
||||
variables[key] = global_conf[key]
|
||||
LOG.debug(variables)
|
||||
return variables
|
||||
|
@ -302,7 +302,8 @@ def set_globals():
|
|||
CLUSTER_NAME = config['percona']['cluster_name']
|
||||
MONITOR_PASSWORD = config['percona']['monitor_password']
|
||||
ETCD_PATH = "/galera/%s" % config['percona']['cluster_name']
|
||||
ETCD_HOST = "etcd.%s" % config['namespace']
|
||||
ETCD_HOST = "etcd.%s.svc.%s" % (config['namespace'],
|
||||
config['cluster_domain'])
|
||||
ETCD_PORT = int(config['etcd']['client_port']['cont'])
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ def get_config():
|
|||
variables = {}
|
||||
with open(GLOBALS_PATH) as f:
|
||||
global_conf = json.load(f)
|
||||
for key in ['percona', 'etcd', 'namespace']:
|
||||
for key in ['percona', 'etcd', 'namespace', 'cluster_domain']:
|
||||
variables[key] = global_conf[key]
|
||||
LOG.debug(variables)
|
||||
return variables
|
||||
|
@ -73,7 +73,8 @@ def set_globals():
|
|||
CONNECTION_ATTEMPTS = config['etcd']['connection_attempts']
|
||||
CONNECTION_DELAY = config['etcd']['connection_delay']
|
||||
ETCD_PATH = "/galera/%s" % config['percona']['cluster_name']
|
||||
ETCD_HOST = "etcd.%s" % config['namespace']
|
||||
ETCD_HOST = "etcd.%s.svc.%s" % (config['namespace'],
|
||||
config['cluster_domain'])
|
||||
ETCD_PORT = int(config['etcd']['client_port']['cont'])
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ def get_config():
|
|||
variables = {}
|
||||
with open(GLOBALS_PATH) as f:
|
||||
global_conf = json.load(f)
|
||||
for key in ['percona', 'db', 'etcd', 'namespace']:
|
||||
for key in ['percona', 'db', 'etcd', 'namespace', 'cluster_domain']:
|
||||
variables[key] = global_conf[key]
|
||||
LOG.debug(variables)
|
||||
return variables
|
||||
|
@ -99,7 +99,8 @@ def set_globals():
|
|||
CONNECTION_DELAY = config['etcd']['connection_delay']
|
||||
EXPECTED_NODES = int(config['percona']['cluster_size'])
|
||||
ETCD_PATH = "/galera/%s" % config['percona']['cluster_name']
|
||||
ETCD_HOST = "etcd.%s" % config['namespace']
|
||||
ETCD_HOST = "etcd.%s.svc.%s" % (config['namespace'],
|
||||
config['cluster_domain'])
|
||||
ETCD_PORT = int(config['etcd']['client_port']['cont'])
|
||||
|
||||
|
||||
|
@ -233,7 +234,7 @@ def get_oldest_node_by_seqno(etcd_client, path):
|
|||
# the IP addr of the node.
|
||||
prefix = key + "/"
|
||||
result = sorted([(str(child.key).replace(prefix, ''), int(child.value))
|
||||
for child in root.children])
|
||||
for child in root.children])
|
||||
result.sort(key=lambda x: x[1])
|
||||
LOG.debug("ALL seqno is %s", result)
|
||||
LOG.info("Oldest node is %s, am %s", result[-1][0], IPADDR)
|
||||
|
@ -333,6 +334,7 @@ def wait_for_expected_state(etcd_client, ttl):
|
|||
wait_for_my_turn(etcd_client)
|
||||
break
|
||||
|
||||
|
||||
def wait_for_my_seqno(etcd_client):
|
||||
|
||||
oldest_node = get_oldest_node_by_seqno(etcd_client, 'seqno')
|
||||
|
@ -342,6 +344,7 @@ def wait_for_my_seqno(etcd_client):
|
|||
else:
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def wait_for_my_turn(etcd_client):
|
||||
|
||||
check_for_stale_seqno(etcd_client)
|
||||
|
|
Loading…
Reference in New Issue