OK really fix the bugs

This commit is contained in:
Joshua Boniface 2018-06-15 01:50:39 -04:00
parent 60fba72976
commit 04918b8a4f
2 changed files with 4 additions and 4 deletions

4
pvc.py
View File

@ -765,11 +765,11 @@ def undefine_vm(dom_name, dom_uuid):
# Wait for 3 seconds to allow state to flow to all hypervisors # Wait for 3 seconds to allow state to flow to all hypervisors
click.echo('Waiting for cluster to update.') click.echo('Waiting for cluster to update.')
time.sleep(3) time.sleep(1)
# Gracefully terminate the class instances # Gracefully terminate the class instances
zk.set('/domains/{}/state'.format(dom_uuid), 'delete'.encode('ascii')) zk.set('/domains/{}/state'.format(dom_uuid), 'delete'.encode('ascii'))
time.sleep(2) time.sleep(5)
# Delete the configurations # Delete the configurations
click.echo('Undefining VM "{}".'.format(dom_uuid)) click.echo('Undefining VM "{}".'.format(dom_uuid))
transaction = zk.transaction() transaction = zk.transaction()

View File

@ -48,8 +48,8 @@ class VMInstance:
@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 we get a delete state, just terminate outselves
if data.decode('ascii') == 'delete': if data == None:
self.__delete__ return
# Otherwise perform a management command # Otherwise perform a management command
else: else:
self.manage_vm_state() self.manage_vm_state()