[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/6] python/qemu/qmp.py: QMP debug with VM label
From: |
Cleber Rosa |
Subject: |
[PULL 1/6] python/qemu/qmp.py: QMP debug with VM label |
Date: |
Tue, 17 Mar 2020 20:19:27 -0400 |
From: Oksana Vohchana <address@hidden>
QEMUMachine writes some messages to the default logger.
But it sometimes hard to read the output if we have requests to
more than one VM.
This patch adds a label to the logger in the debug mode.
Signed-off-by: Oksana Vohchana <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Wainer dos Santos Moschetta <address@hidden>
Reviewed-by: Cleber Rosa <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cleber Rosa <address@hidden>
---
python/qemu/machine.py | 3 ++-
python/qemu/qmp.py | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 183d8f3d38..f53abfa492 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -270,7 +270,8 @@ class QEMUMachine(object):
self._vm_monitor = os.path.join(self._sock_dir,
self._name + "-monitor.sock")
self._remove_files.append(self._vm_monitor)
- self._qmp = qmp.QEMUMonitorProtocol(self._vm_monitor, server=True)
+ self._qmp = qmp.QEMUMonitorProtocol(self._vm_monitor, server=True,
+ nickname=self._name)
def _post_launch(self):
if self._qmp:
diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
index f40586eedd..d6c9b2f4b1 100644
--- a/python/qemu/qmp.py
+++ b/python/qemu/qmp.py
@@ -46,7 +46,7 @@ class QEMUMonitorProtocol:
#: Logger object for debugging messages
logger = logging.getLogger('QMP')
- def __init__(self, address, server=False):
+ def __init__(self, address, server=False, nickname=None):
"""
Create a QEMUMonitorProtocol class.
@@ -62,6 +62,9 @@ class QEMUMonitorProtocol:
self.__address = address
self.__sock = self.__get_sock()
self.__sockfile = None
+ self._nickname = nickname
+ if self._nickname:
+ self.logger = logging.getLogger('QMP').getChild(self._nickname)
if server:
self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.__sock.bind(self.__address)
--
2.25.1
- [PULL 0/6] Python and tests (mostly acceptance) patches 2020-03-17, Cleber Rosa, 2020/03/17
- [PULL 1/6] python/qemu/qmp.py: QMP debug with VM label,
Cleber Rosa <=
- [PULL 2/6] Acceptance tests: introduce BUILD_DIR and SOURCE_DIR, Cleber Rosa, 2020/03/17
- [PULL 3/6] Acceptance test: add "boot_linux" tests, Cleber Rosa, 2020/03/17
- [PULL 5/6] tests/docker: add CentOS 8 Dockerfile, Cleber Rosa, 2020/03/17
- [PULL 4/6] Acceptance tests: add make targets to download images, Cleber Rosa, 2020/03/17
- [PULL 6/6] tests/docker: make "buildah bud" output similar to "docker build", Cleber Rosa, 2020/03/17
- Re: [PULL 0/6] Python and tests (mostly acceptance) patches 2020-03-17, Peter Maydell, 2020/03/19