Add vm.shutdown(wait)

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-08-01 15:09:28 +02:00
parent ecb626d64b
commit 0dd1875fb6
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE

View File

@ -35,6 +35,7 @@ import re
import shutil
import subprocess
import sys
import time
import uuid
import warnings
@ -742,7 +743,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
return self
def shutdown(self, force=False):
def shutdown(self, force=False, wait=False):
'''Shutdown domain.
:raises qubes.exc.QubesVMNotStartedError: \
@ -770,6 +771,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
self.libvirt_domain.shutdown()
self.storage.stop()
while wait and not self.is_halted():
time.sleep(0.25)
return self
def kill(self):