From 6798d4c0787789e0632e7be40af013591b76c711 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Fri, 15 Jun 2018 01:40:06 -0400 Subject: [PATCH] Add delete of class object on delete call --- pvc/VMInstance.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pvc/VMInstance.py b/pvc/VMInstance.py index b1ea7aad..52984931 100644 --- a/pvc/VMInstance.py +++ b/pvc/VMInstance.py @@ -47,7 +47,12 @@ class VMInstance: # Watch for changes to the state field in Zookeeper @zk.DataWatch('/domains/{}/state'.format(self.domuuid)) def watch_state(data, stat, event=""): - self.manage_vm_state() + # If we get a delete state, just terminate outselves + if state == 'delete': + del self + # Otherwise perform a management command + else: + self.manage_vm_state() # Get data functions def getstate(self):