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,6 +47,11 @@ class VMInstance:
# Watch for changes to the state field in Zookeeper # Watch for changes to the state field in Zookeeper
@zk.DataWatch('/domains/{}/state'.format(self.domuuid)) @zk.DataWatch('/domains/{}/state'.format(self.domuuid))
def watch_state(data, stat, event=""): def watch_state(data, stat, event=""):
# If we get a delete state, just terminate outselves
if state == 'delete':
del self
# Otherwise perform a management command
else:
self.manage_vm_state() self.manage_vm_state()
# Get data functions # Get data functions