Commit 4687133b authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf
Browse files

iotests: Add @has_quit to vm.shutdown()



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: default avatarMax Reitz <mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 61ad631c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -329,12 +329,13 @@ 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:
                if not has_quit:
                    self._qmp.cmd('quit')
                self._qmp.close()
            except:
+1 −1
Original line number Diff line number Diff line
@@ -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)