Add cleanup of local domain list during VM check
This commit is contained in:
parent
bf5aa71381
commit
d39f41980b
|
@ -203,14 +203,20 @@ class NodeInstance():
|
||||||
# Toggle state management of dead VMs to restart them
|
# Toggle state management of dead VMs to restart them
|
||||||
for domain, instance in self.s_domain.items():
|
for domain, instance in self.s_domain.items():
|
||||||
if instance.inshutdown == False and domain in self.domain_list:
|
if instance.inshutdown == False and domain in self.domain_list:
|
||||||
if instance.getstate() == 'start' and instance.gethypervisor() == self.name:
|
if instance.gethypervisor() == self.name:
|
||||||
if instance.getdom() != None:
|
if instance.getstate() == 'start':
|
||||||
try:
|
if instance.getdom() != None:
|
||||||
if instance.getdom().state()[0] != libvirt.VIR_DOMAIN_RUNNING:
|
try:
|
||||||
raise
|
if instance.getdom().state()[0] != libvirt.VIR_DOMAIN_RUNNING:
|
||||||
except Exception as e:
|
raise
|
||||||
# Toggle a state "change"
|
except Exception as e:
|
||||||
self.zk_conn.set('/domains/{}/state'.format(domain), instance.getstate().encode('ascii'))
|
# Toggle a state "change"
|
||||||
|
self.zk_conn.set('/domains/{}/state'.format(domain), instance.getstate().encode('ascii'))
|
||||||
|
else:
|
||||||
|
self.domain_list.remove(domain)
|
||||||
|
else:
|
||||||
|
self.domain_list.remove(domain)
|
||||||
|
|
||||||
|
|
||||||
# Set our information in zookeeper
|
# Set our information in zookeeper
|
||||||
self.name = lv_conn.getHostname()
|
self.name = lv_conn.getHostname()
|
||||||
|
|
Loading…
Reference in New Issue