Write Ceph status data to ZK

This commit is contained in:
Joshua Boniface 2018-10-27 18:04:55 -04:00
parent b65472aa83
commit 4422eb8941
1 changed files with 15 additions and 2 deletions

View File

@ -408,8 +408,9 @@ current_primary = zkhandler.readdata(zk_conn, '/primary_node')
if current_primary and current_primary != 'none': if current_primary and current_primary != 'none':
logger.out('Current primary node is {}{}{}.'.format(logger.fmt_blue, current_primary, logger.fmt_end), state='i') logger.out('Current primary node is {}{}{}.'.format(logger.fmt_blue, current_primary, logger.fmt_end), state='i')
else: else:
logger.out('No primary node found; creating with us as primary.', state='i') if config['daemon_mode'] == 'coordinator':
zkhandler.writedata(zk_conn, { '/primary_node': myhostname }) logger.out('No primary node found; creating with us as primary.', state='i')
zkhandler.writedata(zk_conn, { '/primary_node': myhostname })
############################################################################### ###############################################################################
# PHASE 6 - Create local IP addresses for static networks # PHASE 6 - Create local IP addresses for static networks
@ -698,6 +699,18 @@ def update_zookeeper():
if domain_uuid not in this_node.domain_list: if domain_uuid not in this_node.domain_list:
this_node.domain_list.append(domain_uuid) this_node.domain_list.append(domain_uuid)
# Set ceph health information in zookeeper (primary only)
if this_node.router_state == 'primary':
retcode, stdout, stderr = common.run_os_command('ceph status')
ceph_status = stdout
try:
zkhandler.writedata(zk_conn, {
'/ceph': str(ceph_status)
})
except:
logger.out('Failed to set Ceph status data', state='e')
return
# Set our information in zookeeper # Set our information in zookeeper
#this_node.name = lv_conn.getHostname() #this_node.name = lv_conn.getHostname()
this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024) this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024)