From 78e61a759e3ebc23f410b489fb78c171162454b5 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 11 Jun 2018 21:35:37 -0400 Subject: [PATCH] Don't listen twice in parallel, this seems doomed to failure; we only ever switch HVs by changing the state too --- VMInstance.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index 1d9ecebd..33b3b866 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -39,25 +39,23 @@ class VMInstance: self.inshutdown = False self.inmigrate = False self.inreceive = False - self.ininit = True self.dom = self.lookupByUUID(self.domuuid) # Watch for changes to the state field in Zookeeper @zk.DataWatch('/domains/{}/state'.format(self.domuuid)) def watch_state(data, stat, event=""): - if self.ininit == False: - self.manage_vm_state() + self.manage_vm_state() # Watch for changes to the hypervisor field in Zookeeper - @zk.DataWatch('/domains/{}/hypervisor'.format(self.domuuid)) - def watch_hypervisor(data, stat, event=""): - if self.ininit == False: - self.manage_vm_state() - else: - # This case handles the very first init at startup to avoid it happening twice - self.ininit = False - self.manage_vm_state() +# @zk.DataWatch('/domains/{}/hypervisor'.format(self.domuuid)) +# def watch_hypervisor(data, stat, event=""): +# if self.ininit == False: +# self.manage_vm_state() +# else: +# # This case handles the very first init at startup to avoid it happening twice +# self.ininit = False +# self.manage_vm_state() # Get data functions def getstate(self):