From 0dd1875fb6bf8524cac041a2a84d0f0e2d356a8c Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Mon, 1 Aug 2016 15:09:28 +0200 Subject: [PATCH] Add vm.shutdown(wait) --- qubes/vm/qubesvm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 240bae78..d8bdc232 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -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):