From cf6cc9ff8a83ba355886fdc08cc9afaf9c9f5053 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Wed, 13 Jun 2018 12:52:40 -0400 Subject: [PATCH] Add condition to avoid setting ZK status during restart shutdown/stop --- VMInstance.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/VMInstance.py b/VMInstance.py index 56ab7eaf..685dd9e3 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -143,7 +143,9 @@ class VMInstance: except ValueError: pass - self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii')) + if self.inrestart == False: + self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii')) + ansiiprint.echo('Successfully stopped VM', '{}:'.format(self.domuuid), 'o') self.dom = None self.instop = False @@ -173,7 +175,9 @@ class VMInstance: except ValueError: pass - self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii')) + if self.inrestart == False: + self.zk.set('/domains/{}/state'.format(self.domuuid), 'stop'.encode('ascii')) + ansiiprint.echo('Successfully shutdown VM', '{}:'.format(self.domuuid), 'o') self.dom = None self.inshutdown = False