Move configuration keys to /config tree

This commit is contained in:
2021-06-01 10:40:32 -04:00
parent d6a8cf9780
commit 33a54cf7f2
9 changed files with 67 additions and 32 deletions

View File

@ -144,7 +144,7 @@ def format_pct_tohuman(datapct):
# Status functions
#
def get_status(zkhandler):
primary_node = zkhandler.read('/primary_node')
primary_node = zkhandler.read('/config/primary_node')
ceph_status = zkhandler.read('/ceph').rstrip()
# Create a data structure for the information
@ -157,7 +157,7 @@ def get_status(zkhandler):
def get_util(zkhandler):
primary_node = zkhandler.read('/primary_node')
primary_node = zkhandler.read('/config/primary_node')
ceph_df = zkhandler.read('/ceph/util').rstrip()
# Create a data structure for the information

View File

@ -32,12 +32,12 @@ def set_maintenance(zkhandler, maint_state):
try:
if maint_state == 'true':
zkhandler.write([
('/maintenance', 'true')
('/config/maintenance', 'true')
])
return True, 'Successfully set cluster in maintenance mode'
else:
zkhandler.write([
('/maintenance', 'false')
('/config/maintenance', 'false')
])
return True, 'Successfully set cluster in normal mode'
except Exception:
@ -47,7 +47,7 @@ def set_maintenance(zkhandler, maint_state):
def getClusterInformation(zkhandler):
# Get cluster maintenance state
try:
maint_state = zkhandler.read('/maintenance')
maint_state = zkhandler.read('/config/maintenance')
except Exception:
maint_state = 'false'
@ -238,7 +238,7 @@ def getClusterInformation(zkhandler):
'storage_health': storage_health,
'storage_health_msg': storage_health_msg,
'primary_node': common.getPrimaryNode(zkhandler),
'upstream_ip': zkhandler.read('/upstream_ip'),
'upstream_ip': zkhandler.read('/config/upstream_ip'),
'nodes': formatted_node_states,
'vms': formatted_vm_states,
'networks': network_count,

View File

@ -396,7 +396,7 @@ def getPrimaryNode(zkhandler):
failcount = 0
while True:
try:
primary_node = zkhandler.read('/primary_node')
primary_node = zkhandler.read('/config/primary_node')
except Exception:
primary_node == 'none'

View File

@ -98,7 +98,7 @@ def secondary_node(zkhandler, node):
if current_state == 'primary':
retmsg = 'Setting node {} in secondary router mode.'.format(node)
zkhandler.write([
('/primary_node', 'none')
('/config/primary_node', 'none')
])
else:
return False, 'Node "{}" is already in secondary router mode.'.format(node)
@ -126,7 +126,7 @@ def primary_node(zkhandler, node):
if current_state == 'secondary':
retmsg = 'Setting node {} in primary router mode.'.format(node)
zkhandler.write([
('/primary_node', node)
('/config/primary_node', node)
])
else:
return False, 'Node "{}" is already in primary router mode.'.format(node)