diff mbox series

[v6,02/12] qemu.py: Add "wait()" method

Message ID 20170905021201.25684-3-famz@redhat.com
State New
Headers show
Series tests: Add VM based build tests (for non-x86_64 and/or non-Linux) | expand

Commit Message

Fam Zheng Sept. 5, 2017, 2:11 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/qemu.py | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alex Bennée Sept. 8, 2017, 2:13 p.m. UTC | #1
Fam Zheng <famz@redhat.com> writes:

> Signed-off-by: Fam Zheng <famz@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  scripts/qemu.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/scripts/qemu.py b/scripts/qemu.py
> index 880e3e8219..153f2d1564 100644
> --- a/scripts/qemu.py
> +++ b/scripts/qemu.py
> @@ -143,6 +143,13 @@ class QEMUMachine(object):
>              self._post_shutdown()
>              raise
>
> +    def wait(self):
> +        '''Wait for the VM to power off'''
> +        self._popen.wait()
> +        self._qmp.close()
> +        self._load_io_log()
> +        self._post_shutdown()
> +
>      def shutdown(self):
>          '''Terminate the VM and clean up'''
>          if self.is_running():


--
Alex Bennée
diff mbox series

Patch

diff --git a/scripts/qemu.py b/scripts/qemu.py
index 880e3e8219..153f2d1564 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -143,6 +143,13 @@  class QEMUMachine(object):
             self._post_shutdown()
             raise
 
+    def wait(self):
+        '''Wait for the VM to power off'''
+        self._popen.wait()
+        self._qmp.close()
+        self._load_io_log()
+        self._post_shutdown()
+
     def shutdown(self):
         '''Terminate the VM and clean up'''
         if self.is_running():