[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown |
Date: |
Thu, 30 May 2019 11:15:55 +0100 |
From: Gerd Hoffmann <address@hidden>
When not running in snapshot mode ask the guest to poweroff and wait for
this to finish instead of simply quitting qemu, so the guest can flush
pending updates to disk.
Signed-off-by: Gerd Hoffmann <address@hidden>
Tested-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
---
tests/vm/basevm.py | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 395eefaec94..f27178f3c7c 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -51,6 +51,8 @@ class BaseVM(object):
name = "#base"
# The guest architecture, to be overridden by subclasses
arch = "#arch"
+ # command to halt the guest, can be overridden by subclasses
+ poweroff = "poweroff"
def __init__(self, debug=False, vcpus=None):
self._guest = None
self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
@@ -202,6 +204,10 @@ class BaseVM(object):
def wait(self):
self._guest.wait()
+ def graceful_shutdown(self):
+ self.ssh_root(self.poweroff)
+ self._guest.wait()
+
def qmp(self, *args, **kwargs):
return self._guest.qmp(*args, **kwargs)
@@ -278,11 +284,13 @@ def main(vmcls):
traceback.print_exc()
return 2
- if args.interactive:
- if vm.ssh(*cmd) == 0:
- return 0
+ exitcode = 0
+ if vm.ssh(*cmd) != 0:
+ exitcode = 3
+ if exitcode != 0 and args.interactive:
vm.ssh()
- return 3
- else:
- if vm.ssh(*cmd) != 0:
- return 3
+
+ if not args.snapshot:
+ vm.graceful_shutdown()
+
+ return exitcode
--
2.20.1
- [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30, (continued)
- [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown,
Alex Bennée <=
- [Qemu-devel] [PATCH v1 25/26] tests/vm: fedora autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 24/26] tests/vm: netbsd autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 22/26] tests/vm: openbsd autoinstall, using serial console, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot, Alex Bennée, 2019/05/30
- [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text, Alex Bennée, 2019/05/30