Add delete of class object on delete call
This commit is contained in:
parent
dd8b7d69cc
commit
6798d4c078
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue