diff --git a/pvc.py b/pvc.py index e0ba4343..b33e35ba 100755 --- a/pvc.py +++ b/pvc.py @@ -768,7 +768,7 @@ def undefine_vm(dom_name, dom_uuid): time.sleep(3) # Gracefully terminate the class instances - transaction.set_data('/domains/{}/state'.format(dom_uuid), 'delete'.encode('ascii')) + zk.set('/domains/{}/state'.format(dom_uuid), 'delete'.encode('ascii')) time.sleep(2) # Delete the configurations click.echo('Undefining VM "{}".'.format(dom_uuid)) diff --git a/pvc/VMInstance.py b/pvc/VMInstance.py index 52984931..4ed78114 100644 --- a/pvc/VMInstance.py +++ b/pvc/VMInstance.py @@ -48,8 +48,8 @@ class VMInstance: @zk.DataWatch('/domains/{}/state'.format(self.domuuid)) def watch_state(data, stat, event=""): # If we get a delete state, just terminate outselves - if state == 'delete': - del self + if data.decode('ascii') == 'delete': + self.__delete__ # Otherwise perform a management command else: self.manage_vm_state()