e2c97f16 | 10-Jul-2020 |
John Snow <jsnow@redhat.com> |
python/machine.py: Add _early_cleanup hook
Some parts of cleanup need to occur prior to shutdown, otherwise shutdown might break. Move this into a suitably named method/callback.
Signed-off-by: Joh
python/machine.py: Add _early_cleanup hook
Some parts of cleanup need to occur prior to shutdown, otherwise shutdown might break. Move this into a suitably named method/callback.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20200710050649.32434-4-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
671940e6 | 10-Jul-2020 |
John Snow <jsnow@redhat.com> |
python/machine.py: Close QMP socket in cleanup
It's not important to do this before waiting for the process to exit, so it can be done during generic post-shutdown cleanup.
Signed-off-by: John Snow
python/machine.py: Close QMP socket in cleanup
It's not important to do this before waiting for the process to exit, so it can be done during generic post-shutdown cleanup.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20200710050649.32434-3-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
c95dddce | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu/qtest: Check before accessing _qtest
It can be None; so add assertions or exceptions where appropriate to guard the access accordingly.
Signed-off-by: John Snow <jsnow@redhat.com> Revie
python/qemu/qtest: Check before accessing _qtest
It can be None; so add assertions or exceptions where appropriate to guard the access accordingly.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-30-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
de210ec5 | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu/qmp: assert sockfile is not None
In truth, if you don't do this, you'll just get a TypeError exception. Now, you'll get an AssertionError.
Is this tangibly better? No. Does mypy complai
python/qemu/qmp: assert sockfile is not None
In truth, if you don't do this, you'll just get a TypeError exception. Now, you'll get an AssertionError.
Is this tangibly better? No. Does mypy complain less? Yes.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-21-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
7af67d69 | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu/qmp: use True/False for non/blocking modes
The type system doesn't want integers.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Mes
python/qemu/qmp: use True/False for non/blocking modes
The type system doesn't want integers.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-15-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
1dda0404 | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu: Adjust traceback typing
mypy considers it incorrect to use `bool` to statically return false, because it will assume that it could conceivably return True, and gives different analysis
python/qemu: Adjust traceback typing
mypy considers it incorrect to use `bool` to statically return false, because it will assume that it could conceivably return True, and gives different analysis in that case. Use a None return to achieve the same effect, but make mypy happy.
Note: Pylint considers function signatures as code that might trip the duplicate-code checker. I'd rather not disable this as it does not trigger often in practice, so I'm disabling it as a one-off and filed a change request; see https://github.com/PyCQA/pylint/issues/3619
Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-14-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
0add048f | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu: fix socket.makefile() typing
Note:
A bug in typeshed (https://github.com/python/typeshed/issues/3977) misinterprets the type of makefile(). Work around this by explicitly stating that
python/qemu: fix socket.makefile() typing
Note:
A bug in typeshed (https://github.com/python/typeshed/issues/3977) misinterprets the type of makefile(). Work around this by explicitly stating that we are opening a text-mode file.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-13-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
3797dbcb | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu: remove Python2 style super() calls
Use the Python3 style instead.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200
python/qemu: remove Python2 style super() calls
Use the Python3 style instead.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-12-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
8dfac2ed | 28-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu: delint; add flake8 config
Mostly, ignore the "no bare except" rule, because flake8 is not contextual and cannot determine if we re-raise. Pylint can, though, so always prefer pylint for
python/qemu: delint; add flake8 config
Mostly, ignore the "no bare except" rule, because flake8 is not contextual and cannot determine if we re-raise. Pylint can, though, so always prefer pylint for that.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200528222129.23826-5-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
9b8ccd6d | 28-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu: delint and add pylintrc
Bring our these files up to speed with pylint 2.5.0. Add a pylintrc file to formalize which pylint subset we are targeting.
The similarity ignore is there to su
python/qemu: delint and add pylintrc
Bring our these files up to speed with pylint 2.5.0. Add a pylintrc file to formalize which pylint subset we are targeting.
The similarity ignore is there to suppress similarity reports across imports, which for typing constants, are going to trigger this report erroneously.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200528222129.23826-4-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
053774bd | 14-May-2020 |
John Snow <jsnow@redhat.com> |
python/qemu/machine: remove logging configuration
Python 3.5 and above do not print a warning when logging is not configured. As a library, it's best practice to leave logging configuration to the c
python/qemu/machine: remove logging configuration
Python 3.5 and above do not print a warning when logging is not configured. As a library, it's best practice to leave logging configuration to the client executable.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200514055403.18902-22-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
746f244d | 20-Jan-2020 |
Philippe Mathieu-Daudé <f4bug@amsat.org> |
python/qemu/machine: Allow to use other serial consoles than default
Currently the QEMU Python module limits the QEMUMachine class to use the first serial console.
Some machines/guest might use ano
python/qemu/machine: Allow to use other serial consoles than default
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>
show more ...
|
52c68b8a | 20-Jan-2020 |
Lukáš Doktor <ldoktor@redhat.com> |
python: Treat None-return of greeting cmd
In case qemu process dies the "monitor.cmd" returns None which gets passed to the "__negotiate_capabilities" and leads to unhandled exception. Let's only ch
python: Treat None-return of greeting cmd
In case qemu process dies the "monitor.cmd" returns None which gets passed to the "__negotiate_capabilities" and leads to unhandled exception. Let's only check the resp in case it has a value.
Signed-off-by: Lukáš Doktor <ldoktor@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20200120071202.30646-1-ldoktor@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
51aa9d12 | 05-Feb-2020 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: accel: Fix kvm_available() on ppc64le
On ppc64le, the accel.kvm_available() check may wrongly return False because the host arch (as returned by os.uname[4]) and the target arch (ppc64)
python/qemu: accel: Fix kvm_available() on ppc64le
On ppc64le, the accel.kvm_available() check may wrongly return False because the host arch (as returned by os.uname[4]) and the target arch (ppc64) mismatch. In order to solve this it is added an ppc64le -> ppc64 mapping which is used as an fallback verification.
Fixes: 53a049d7d78e5ccf6d4c0d7 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200205203250.30526-5-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
50d189c9 | 27-Dec-2019 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: qmp: Remove unnused attributes
The `error` and `timeout` attributes in QEMUMonitorProtocol are not used, so this delete them.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redha
python/qemu: qmp: Remove unnused attributes
The `error` and `timeout` attributes in QEMUMonitorProtocol are not used, so this delete them.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191227134101.244496-6-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
07608e80 | 04-Feb-2020 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: qmp: Make QEMUMonitorProtocol a context manager
This implement the __enter__ and __exit__ functions on QEMUMonitorProtocol class so that it can be used on 'with' statement and the resou
python/qemu: qmp: Make QEMUMonitorProtocol a context manager
This implement the __enter__ and __exit__ functions on QEMUMonitorProtocol class so that it can be used on 'with' statement and the resources will be free up on block end:
with QEMUMonitorProtocol(socket_path) as qmp: qmp.connect() qmp.command('query-status')
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-Id: <20200204141111.3207-5-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
54aafc2f | 04-Feb-2020 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: qmp: Make accept()'s timeout configurable
Currently the timeout of QEMUMonitorProtocol.accept() is hard-coded to 15.0 seconds. This added the parameter `timeout` so the value can be con
python/qemu: qmp: Make accept()'s timeout configurable
Currently the timeout of QEMUMonitorProtocol.accept() is hard-coded to 15.0 seconds. This added the parameter `timeout` so the value can be configured by the user.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-Id: <20200204141111.3207-4-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
a0a261e4 | 27-Dec-2019 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: Delint the qmp module
This clean up the pylint-3 report on qmp:
************* Module qemu.qmp python/qemu/qmp.py:1:0: C0111: Missing module docstring (missing-docstring) python/qemu/qm
python/qemu: Delint the qmp module
This clean up the pylint-3 report on qmp:
************* Module qemu.qmp python/qemu/qmp.py:1:0: C0111: Missing module docstring (missing-docstring) python/qemu/qmp.py:17:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:21:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:25:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:29:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:33:0: C0111: Missing class docstring (missing-docstring) python/qemu/qmp.py:33:0: R0205: Class 'QEMUMonitorProtocol' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance) python/qemu/qmp.py:80:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:131:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:159:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) python/qemu/qmp.py:245:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:249:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:252:4: C0111: Missing method docstring (missing-docstring) python/qemu/qmp.py:255:4: C0111: Missing method docstring (missing-docstring)
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191227134101.244496-3-wainersm@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
e42cb967 | 16-Dec-2019 |
Wainer dos Santos Moschetta <wainersm@redhat.com> |
python/qemu: Remove unneeded imports in __init__
__init_.py import some sub-modules unnecessarily. So let's clean it up.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Suggested-b
python/qemu: Remove unneeded imports in __init__
__init_.py import some sub-modules unnecessarily. So let's clean it up.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Suggested-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20191216191438.93418-6-wainersm@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
show more ...
|