Move libvirt closure into previous section

This commit is contained in:
Joshua Boniface 2020-06-06 13:18:37 -04:00
parent c1956072f0
commit 1db73bb892
1 changed files with 5 additions and 5 deletions

View File

@ -1302,6 +1302,9 @@ def node_keepalive():
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)
# Close the Libvirt connection
lv_conn.close()
# Set our information in zookeeper # Set our information in zookeeper
if debug: if debug:
print("Set our information in zookeeper") print("Set our information in zookeeper")
@ -1313,9 +1316,10 @@ def node_keepalive():
this_node.vcpualloc = vcpualloc this_node.vcpualloc = vcpualloc
this_node.cpuload = os.getloadavg()[0] this_node.cpuload = os.getloadavg()[0]
if enable_hypervisor: if enable_hypervisor:
this_node.domains_count = len(lv_conn.listDomainsID()) this_node.domains_count = len(running_domains)
else: else:
this_node.domains_count = 0 this_node.domains_count = 0
keepalive_time = int(time.time()) keepalive_time = int(time.time())
try: try:
zkhandler.writedata(zk_conn, { zkhandler.writedata(zk_conn, {
@ -1333,10 +1337,6 @@ def node_keepalive():
logger.out('Failed to set keepalive data', state='e') logger.out('Failed to set keepalive data', state='e')
return return
if enable_hypervisor:
# Close the Libvirt connection
lv_conn.close()
# Look for dead nodes and fence them # Look for dead nodes and fence them
if not maintenance: if not maintenance:
if debug: if debug: