Add delete of class object on delete call

This commit is contained in:
Joshua Boniface 2018-06-15 01:40:06 -04:00
parent dd8b7d69cc
commit 6798d4c078
1 changed files with 6 additions and 1 deletions

View File

@ -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):