Simplify VM delete with recursive operation

This commit is contained in:
Joshua Boniface 2018-09-21 01:52:51 -04:00
parent 831fbe8f22
commit 8f59995af4
1 changed files with 1 additions and 8 deletions

View File

@ -256,14 +256,7 @@ def undefine_vm(zk_conn, domain):
# Delete the configurations # Delete the configurations
try: try:
click.echo('Undefining VM "{}".'.format(dom_uuid)) click.echo('Undefining VM "{}".'.format(dom_uuid))
transaction = zk_conn.transaction() zk_conn.delete('/domains/{}'.format(dom_uuid), recursive=True)
transaction.delete('/domains/{}/state'.format(dom_uuid))
transaction.delete('/domains/{}/hypervisor'.format(dom_uuid))
transaction.delete('/domains/{}/lasthypervisor'.format(dom_uuid))
transaction.delete('/domains/{}/failedreason'.format(dom_uuid))
transaction.delete('/domains/{}/xml'.format(dom_uuid))
transaction.delete('/domains/{}'.format(dom_uuid))
transaction.commit()
except: except:
pass pass