From 3b805cdc34986466380364c8d47743b52fad4d99 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 26 Sep 2021 20:42:01 -0400 Subject: [PATCH] Fix failure to connect to libvirt in keepalive This should be caught and abort the thread rather than failing and holding up keepalives. --- node-daemon/pvcnoded/util/keepalive.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/node-daemon/pvcnoded/util/keepalive.py b/node-daemon/pvcnoded/util/keepalive.py index 5f233340..930b8480 100644 --- a/node-daemon/pvcnoded/util/keepalive.py +++ b/node-daemon/pvcnoded/util/keepalive.py @@ -361,9 +361,13 @@ def collect_vm_stats(logger, config, zkhandler, this_node, queue): libvirt_name = "qemu:///system" if debug: logger.out("Connecting to libvirt", state='d', prefix='vm-thread') - lv_conn = libvirt.open(libvirt_name) - if lv_conn is None: + try: + lv_conn = libvirt.open(libvirt_name) + if lv_conn is None: + raise Exception + except Exception: logger.out('Failed to open connection to "{}"'.format(libvirt_name), state='e') + return memalloc = 0 memprov = 0