Only try to stop a VM if it's not already stopped. (fixes #23364)

This commit is contained in:
Pablo Ruiz 2015-05-25 01:46:06 +02:00 committed by rallytime
parent 5488c4aaa2
commit c53888415f

View file

@ -846,7 +846,8 @@ def destroy(name, call=None):
vmobj = _getVmByName(name)
if vmobj is not None:
# stop the vm
stop(name, vmobj['vmid'], 'action')
if get_vm_status(vmid=vmobj['vmid'])['status'] != 'stopped':
stop(name, vmobj['vmid'], 'action')
# wait until stopped
if not wait_for_state(vmobj['vmid'], 'stopped'):