summaryrefslogtreecommitdiffstats
path: root/python/qemu/machine.py
Commit message (Collapse)AuthorAgeFilesLines
* python/qemu/machine: Allow to use other serial consoles than defaultPhilippe Mathieu-Daudé2020-02-071-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Currently the QEMU Python module limits the QEMUMachine class to use the first serial console. Some machines/guest might use another console than the first one as the 'boot console'. For example the Raspberry Pi uses the second (AUX) console. To be able to use the Nth console as default, we simply need to connect all the N - 1 consoles to the null chardev. Add an index argument, so we can use a specific serial console as default. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Tested-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20200120235159.18510-5-f4bug@amsat.org> [PMD: zero-initialize _console_index in __init__()] Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* python/qemu: Add set_qmp_monitor() to QEMUMachineWainer dos Santos Moschetta2019-12-161-25/+45
| | | | | | | | | | | | | | | | | | | | | The QEMUMachine VM has a monitor setup on which an QMP connection is always attempted on _post_launch() (executed by launch()). In case the QEMU process immediatly exits then the qmp.accept() (used to establish the connection) stalls until it reaches timeout and consequently an exception raises. That behavior is undesirable when, for instance, it needs to gather information from the QEMU binary ($ qemu -cpu list) or a test which launches the VM expecting its failure. This patch adds the set_qmp_monitor() method to QEMUMachine that allows turn off the creation of the monitor machinery on VM launch. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20191211185536.16962-2-wainersm@redhat.com> [Cleber: trivial indentation fix] Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Python libs: close console sockets before shutting down the VMsCleber Rosa2019-10-291-4/+7
| | | | | | | | | | | | | Currently, the console socket on QEMUMachine is closed after the QMP command to gracefully exit QEMU is executed. Because of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket earlier. Reference: <20190607034214.GB22416@habkost.net> Reference: https://bugs.launchpad.net/qemu/+bug/1829779 From: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20190911023558.4880-2-crosa@redhat.com>
* iotests.py: Store socket files in $SOCK_DIRMax Reitz2019-10-281-3/+12
| | | | | | | | | | | | iotests.py itself does not store socket files, but machine.py and qtest.py do. iotests.py needs to pass the respective path to them, and they need to adhere to it. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 20191017133155.5327-3-mreitz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
* iotests: Add @has_quit to vm.shutdown()Max Reitz2019-07-191-2/+3
| | | | | | | | | | | 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>
* machine.py: minor delintingJohn Snow2019-07-021-11/+22
| | | | | | | | | Since we're out in a new module, do a quick cursory pass of some of the more obvious style issues. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20190627212816.27298-3-jsnow@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* python/qemu: split QEMUMachine out from underneath __init__.pyJohn Snow2019-07-021-0/+520
It's not obvious that something named __init__.py actually houses important code that isn't relevant to python packaging glue. Move the QEMUMachine and related error classes out into their own module. Adjust users to the new import location. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20190627212816.27298-2-jsnow@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>