clean up log messages in get_all_by_host_and_network

This commit is contained in:
forest 2021-12-09 12:54:27 -06:00
parent 089cb4d696
commit 4c5cddc08b

View File

@ -140,10 +140,10 @@ class ShellScriptSpoke(VirtualizationInterface):
vm_list_process = run([join(current_app.root_path, 'shell_scripts/virsh-list.sh')], capture_output=True) vm_list_process = run([join(current_app.root_path, 'shell_scripts/virsh-list.sh')], capture_output=True)
self.validate_completed_process(vm_list_process) self.validate_completed_process(vm_list_process)
vms_json_string = vm_list_process.stdout.decode("utf-8") vms_json_string = vm_list_process.stdout.decode("utf-8")
current_app.logger.info(f"vms_json_string: {vms_json_string}") #current_app.logger.info(f"vms_json_string: {vms_json_string}")
list_of_vms = json.loads(vms_json_string) list_of_vms = json.loads(vms_json_string)
current_app.logger.info(f"list_of_vms: {json.dumps(list_of_vms)}") #current_app.logger.info(f"list_of_vms: {json.dumps(list_of_vms)}")
vm_state_by_id = dict() vm_state_by_id = dict()
for vm in list_of_vms: for vm in list_of_vms:
@ -152,10 +152,10 @@ class ShellScriptSpoke(VirtualizationInterface):
net_list_process = run([join(current_app.root_path, 'shell_scripts/virsh-net-list.sh')], capture_output=True) net_list_process = run([join(current_app.root_path, 'shell_scripts/virsh-net-list.sh')], capture_output=True)
self.validate_completed_process(net_list_process) self.validate_completed_process(net_list_process)
net_list_json_string = net_list_process.stdout.decode("utf-8") net_list_json_string = net_list_process.stdout.decode("utf-8")
current_app.logger.info(f"net_list_json_string: {net_list_json_string}") #current_app.logger.info(f"net_list_json_string: {net_list_json_string}")
list_of_networks = json.loads(net_list_json_string) list_of_networks = json.loads(net_list_json_string)
current_app.logger.info(f"list_of_networks: {json.dumps(list_of_networks)}") #current_app.logger.info(f"list_of_networks: {json.dumps(list_of_networks)}")
networks = dict() networks = dict()
vms_by_id = dict() vms_by_id = dict()
@ -182,7 +182,7 @@ class ShellScriptSpoke(VirtualizationInterface):
if vm['domain'] in vm_state_by_id: if vm['domain'] in vm_state_by_id:
vm_state = vm_state_by_id[vm['domain']] vm_state = vm_state_by_id[vm['domain']]
else: else:
current_app.logger.info(f"get_all_by_host_and_network: '{vm['domain']}' not in vm_state_by_id, defaulting to 'shut off'") current_app.logger.warn(f"get_all_by_host_and_network: '{vm['domain']}' not in vm_state_by_id, defaulting to 'shut off'")
vms_by_id[vm['domain']] = dict(macs=dict(), state=vm_state, network=network['name']) vms_by_id[vm['domain']] = dict(macs=dict(), state=vm_state, network=network['name'])
@ -201,7 +201,7 @@ class ShellScriptSpoke(VirtualizationInterface):
vm_id = vm_id_by_mac[status['mac-address']] vm_id = vm_id_by_mac[status['mac-address']]
vms_by_id[vm_id]['ipv4'] = status['ip-address'] vms_by_id[vm_id]['ipv4'] = status['ip-address']
else: else:
current_app.logger.info(f"get_all_by_host_and_network: {status['mac-address']} not in vm_id_by_mac") current_app.logger.warn(f"get_all_by_host_and_network: {status['mac-address']} not in vm_id_by_mac")
networks = dict() networks = dict()
for vm in vms_by_id: for vm in vms_by_id: