]> git.proxmox.com Git - mirror_qemu.git/commitdiff
iotests: Add @has_quit to vm.shutdown()
authorMax Reitz <mreitz@redhat.com>
Fri, 19 Jul 2019 09:26:17 +0000 (11:26 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 19 Jul 2019 11:19:17 +0000 (13:19 +0200)
If a test has issued a quit command already (which may be useful to do
explicitly because the test wants to show its effects),
QEMUMachine.shutdown() should not do so again.  Otherwise, the VM may
well return an ECONNRESET which will lead QEMUMachine.shutdown() to
killing it, which then turns into a "qemu received signal 9" line.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
python/qemu/machine.py
tests/qemu-iotests/255

index 49445e675b8a7b08729bd39bd7d7d5f6570fae84..128a3d1dc28082623bb52ee46718e90b998b193f 100644 (file)
@@ -329,13 +329,14 @@ class QEMUMachine(object):
         self._load_io_log()
         self._post_shutdown()
 
-    def shutdown(self):
+    def shutdown(self, has_quit=False):
         """
         Terminate the VM and clean up
         """
         if self.is_running():
             try:
-                self._qmp.cmd('quit')
+                if not has_quit:
+                    self._qmp.cmd('quit')
                 self._qmp.close()
             except:
                 self._popen.kill()
index 49433ec122842006cea074d657c43a5e343bd579..3632d507d0d5b3c08aa9ff60aaea1b6c82dbf223 100755 (executable)
@@ -132,4 +132,4 @@ with iotests.FilePath('src.qcow2') as src_path, \
     vm.qmp_log('block-job-cancel', device='job0')
     vm.qmp_log('quit')
 
-    vm.shutdown()
+    vm.shutdown(has_quit=True)