Improve message output for logging

Improve some formatting of the messages being printed to make it nicer
for long-term logging.
This commit is contained in:
Joshua Boniface 2019-07-10 22:24:03 -04:00
parent ac36870a86
commit f30be555c1
2 changed files with 13 additions and 11 deletions

View File

@ -838,7 +838,7 @@ if enable_hypervisor:
# Update and print new list
domain_list = new_domain_list
logger.out('{}Domain list:{} {}'.format(fmt_blue, fmt_end, ' '.join(domain_list)), state='i')
logger.out('{}VM list:{} {}'.format(fmt_blue, fmt_end, ' '.join(domain_list)), state='i')
# Update node objects' list
for node in d_node:
@ -1252,21 +1252,22 @@ def update_zookeeper():
)
if config['log_keepalive_cluster_details']:
logger.out(
'{bold}Domains:{nofmt} {domcount} '
'{bold}Active VMs:{nofmt} {domcount} '
'{bold}Networks:{nofmt} {netcount} '
'{bold}VM memory [MiB]:{nofmt} {allocmem} '
'{bold}Free memory [MiB]:{nofmt} {freemem} '
'{bold}Used memory [MiB]:{nofmt} {usedmem} '
'{bold}Load:{nofmt} {load}'.format(
'{bold}Load:{nofmt} {load} '
'{bold}Memory [MiB]: VMs:{nofmt} {allocmem} '
'{bold}Used:{nofmt} {usedmem} '
'{bold}Free:{nofmt} {freemem}'.format(
bold=fmt_bold,
nofmt=fmt_end,
domcount=this_node.domains_count,
netcount=len(network_list),
load=this_node.cpuload,
freemem=this_node.memfree,
usedmem=this_node.memused,
load=this_node.cpuload,
allocmem=this_node.memalloc,
netcount=len(network_list)
),
state='t'
)
if enable_storage and config['log_keepalive_storage_details']:
logger.out(
@ -1282,6 +1283,7 @@ def update_zookeeper():
node_osds=osds_this_node,
total_pools=len(pool_list)
),
state='t'
)

View File

@ -261,7 +261,7 @@ class NodeInstance(object):
def become_secondary(self):
if self.config['enable_networking']:
self.logger.out('Setting router {} to secondary state'.format(self.name), state='i')
self.logger.out('Network list: {}'.format(', '.join(self.network_list)))
self.logger.out('Network list: {}'.format(', '.join(self.network_list)), state='i')
time.sleep(2)
if self.config['enable_api']:
self.logger.out('Stopping PVC API client service', state='i')
@ -275,7 +275,7 @@ class NodeInstance(object):
def become_primary(self):
if self.config['enable_networking']:
self.logger.out('Setting router {} to primary state'.format(self.name), state='i')
self.logger.out('Network list: {}'.format(', '.join(self.network_list)))
self.logger.out('Network list: {}'.format(', '.join(self.network_list)), state='i')
self.createFloatingAddresses()
# Start up the gateways and DHCP servers
for network in self.d_network:
@ -354,7 +354,7 @@ class NodeInstance(object):
def flush(self):
# Begin flush
self.logger.out('Flushing node "{}" of running VMs'.format(self.name), state='i')
self.logger.out('Domain list: {}'.format(', '.join(self.domain_list)))
self.logger.out('VM list: {}'.format(', '.join(self.domain_list)), state='i')
fixed_domain_list = self.domain_list.copy()
for dom_uuid in fixed_domain_list:
# Allow us to cancel the operation