From nobody Mon Apr 29 02:33:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506517568661437.1394195364992; Wed, 27 Sep 2017 06:06:08 -0700 (PDT) Received: from localhost ([::1]:54768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC2I-0001wO-RK for importer@patchew.org; Wed, 27 Sep 2017 09:05:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC0b-0000vZ-6Y for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxC0R-0006fa-Nj for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxC0R-0006fK-Hd for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76B1381229 for ; Wed, 27 Sep 2017 13:04:02 +0000 (UTC) Received: from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78F77825FC; Wed, 27 Sep 2017 13:03:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 76B1381229 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 10:03:35 -0300 Message-Id: <20170927130339.21444-2-ehabkost@redhat.com> In-Reply-To: <20170927130339.21444-1-ehabkost@redhat.com> References: <20170927130339.21444-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 27 Sep 2017 13:04:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/5] guestperf: Configure logging on all shell frontends X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The logging module will eventually replace the 'debug' parameter in QEMUMachine and QEMUMonitorProtocol. Cc: Daniel P. Berrange Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrange --- tests/migration/guestperf/shell.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf= /shell.py index 7992459a97..e378cf0cfa 100644 --- a/tests/migration/guestperf/shell.py +++ b/tests/migration/guestperf/shell.py @@ -26,6 +26,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), import argparse import fnmatch import platform +import logging =20 from guestperf.hardware import Hardware from guestperf.engine import Engine @@ -64,6 +65,11 @@ class BaseShell(object): =20 self._parser =3D parser =20 + def init_logging(self, args): + logging.basicConfig(level=3D(logging.DEBUG if args.debug else + logging.INFO if args.verbose else + logging.WARN)) + def get_engine(self, args): return Engine(binary=3Dargs.binary, dst_host=3Dargs.dst_host, @@ -147,6 +153,7 @@ class Shell(BaseShell): =20 def run(self, argv): args =3D self._parser.parse_args(argv) + self.init_logging(args) =20 engine =3D self.get_engine(args) hardware =3D self.get_hardware(args) @@ -179,6 +186,7 @@ class BatchShell(BaseShell): =20 def run(self, argv): args =3D self._parser.parse_args(argv) + self.init_logging(args) =20 engine =3D self.get_engine(args) hardware =3D self.get_hardware(args) @@ -231,6 +239,7 @@ class PlotShell(object): =20 def run(self, argv): args =3D self._parser.parse_args(argv) + self.init_logging(args) =20 if len(args.reports) =3D=3D 0: print >>sys.stderr, "At least one report required" --=20 2.13.5 From nobody Mon Apr 29 02:33:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15065176770211023.0913596043956; Wed, 27 Sep 2017 06:07:57 -0700 (PDT) Received: from localhost ([::1]:54774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC46-0003Rj-QW for importer@patchew.org; Wed, 27 Sep 2017 09:07:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC0e-0000x5-0C for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxC0a-0006iK-P1 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37702) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxC0T-0006fs-D7; Wed, 27 Sep 2017 09:04:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 659F3FF4C; Wed, 27 Sep 2017 13:04:04 +0000 (UTC) Received: from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D86057FA56; Wed, 27 Sep 2017 13:04:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 659F3FF4C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 10:03:36 -0300 Message-Id: <20170927130339.21444-3-ehabkost@redhat.com> In-Reply-To: <20170927130339.21444-1-ehabkost@redhat.com> References: <20170927130339.21444-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 27 Sep 2017 13:04:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/5] iotests: Set up Python logging X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Kevin Wolf , Max Reitz , qemu-block@nongnu.org, Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Set up Python logging module instead of relying on QEMUMachine._debug to enable debugging messages. Cc: Kevin Wolf Cc: Max Reitz Cc: qemu-block@nongnu.org Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrange Reviewed-by: Luk=C3=A1=C5=A1 Doktor =20 --- tests/qemu-iotests/iotests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1af117e37d..36a7757aaf 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -28,6 +28,7 @@ import qtest import struct import json import signal +import logging =20 =20 # This will not work if arguments contain spaces but is necessary if we @@ -467,6 +468,8 @@ def main(supported_fmts=3D[], supported_oses=3D['linux'= ]): else: output =3D StringIO.StringIO() =20 + logging.basicConfig(level=3D(logging.DEBUG if debug else logging.WARN)) + class MyTestRunner(unittest.TextTestRunner): def __init__(self, stream=3Doutput, descriptions=3DTrue, verbosity= =3Dverbosity): unittest.TextTestRunner.__init__(self, stream, descriptions, v= erbosity) --=20 2.13.5 From nobody Mon Apr 29 02:33:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506517687671798.7457583166959; Wed, 27 Sep 2017 06:08:07 -0700 (PDT) Received: from localhost ([::1]:54775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC4J-0003ZM-Qe for importer@patchew.org; Wed, 27 Sep 2017 09:08:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC0h-0000yS-Bv for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxC0d-0006kc-8b for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41508) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxC0d-0006kK-2L for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 098E33DBDC; Wed, 27 Sep 2017 13:04:14 +0000 (UTC) Received: from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD1C589201; Wed, 27 Sep 2017 13:04:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 098E33DBDC Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 10:03:37 -0300 Message-Id: <20170927130339.21444-4-ehabkost@redhat.com> In-Reply-To: <20170927130339.21444-1-ehabkost@redhat.com> References: <20170927130339.21444-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 27 Sep 2017 13:04:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/5] basevm: Call logging.basicConfig() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Fam Zheng , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Just setting level=3DDEBUG when debug is enabled is not enough: we need to set up a log handler if we want debug messages generated using logging.getLogger(...).debug() to be printed. This was not a problem before because logging.debug() calls logging.basicConfig() implicitly, but it's safer to not rely on that. Cc: "Alex Benn=C3=A9e" Cc: Fam Zheng Cc: "Philippe Mathieu-Daud=C3=A9" Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrange Reviewed-by: Fam Zheng Reviewed-by: Luk=C3=A1=C5=A1 Doktor --- tests/vm/basevm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 3c863bc237..686d88decf 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -227,8 +227,8 @@ def main(vmcls): if not argv and not args.build_qemu and not args.build_image: print "Nothing to do?" return 1 - if args.debug: - logging.getLogger().setLevel(logging.DEBUG) + logging.basicConfig(level=3D(logging.DEBUG if args.debug + else logging.WARN)) vm =3D vmcls(debug=3Dargs.debug, vcpus=3Dargs.jobs) if args.build_image: if os.path.exists(args.image) and not args.force: --=20 2.13.5 From nobody Mon Apr 29 02:33:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506517577514367.92920895754196; Wed, 27 Sep 2017 06:06:17 -0700 (PDT) Received: from localhost ([::1]:54770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC2S-00023a-Ex for importer@patchew.org; Wed, 27 Sep 2017 09:06:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC0l-00010E-Gy for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxC0f-0006lb-Je for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxC0f-0006l8-Be for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6377EC0860CB; Wed, 27 Sep 2017 13:04:16 +0000 (UTC) Received: from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DC6485A2C; Wed, 27 Sep 2017 13:04:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6377EC0860CB Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 10:03:38 -0300 Message-Id: <20170927130339.21444-5-ehabkost@redhat.com> In-Reply-To: <20170927130339.21444-1-ehabkost@redhat.com> References: <20170927130339.21444-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 27 Sep 2017 13:04:16 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from QEMUMonitorProtocol X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Fam Zheng , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use logging module for the QMP debug messages. The only scripts that set debug=3DTrue are iotests.py and guestperf/engine.py, and they already call logging.basicConfig() to set up logging. Scripts that don't configure logging are safe as long as they don't need debugging output, because debug messages don't trigger the "No handlers could be found for logger" message from the Python logging module. Scripts that already configure logging but don't use debug=3DTrue (e.g. scripts/vm/basevm.py) will get QMP debugging enabled for free. Cc: "Alex Benn=C3=A9e" Cc: Fam Zheng Cc: "Philippe Mathieu-Daud=C3=A9" Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrange --- scripts/qemu.py | 3 +-- scripts/qmp/qmp.py | 13 ++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index c9a106fbce..f6d2e68627 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -177,8 +177,7 @@ class QEMUMachine(object): =20 def _pre_launch(self): self._qmp =3D qmp.qmp.QEMUMonitorProtocol(self._monitor_address, - server=3DTrue, - debug=3Dself._debug) + server=3DTrue) =20 def _post_launch(self): self._qmp.accept() diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py index ef12e8a1a0..be79d7aa80 100644 --- a/scripts/qmp/qmp.py +++ b/scripts/qmp/qmp.py @@ -12,6 +12,7 @@ import json import errno import socket import sys +import logging =20 =20 class QMPError(Exception): @@ -32,6 +33,8 @@ class QMPTimeoutError(QMPError): =20 class QEMUMonitorProtocol(object): =20 + #: Logger object for debugging messages + logger =3D logging.getLogger('QMP') #: Socket's error class error =3D socket.error #: Socket's timeout @@ -51,7 +54,6 @@ class QEMUMonitorProtocol(object): """ self.__events =3D [] self.__address =3D address - self._debug =3D debug self.__sock =3D self.__get_sock() self.__sockfile =3D None if server: @@ -83,8 +85,7 @@ class QEMUMonitorProtocol(object): return resp =3D json.loads(data) if 'event' in resp: - if self._debug: - print >>sys.stderr, "QMP:<<< %s" % resp + self.logger.debug("<<< %s", resp) self.__events.append(resp) if not only_event: continue @@ -164,8 +165,7 @@ class QEMUMonitorProtocol(object): @return QMP response as a Python dict or None if the connection has been closed """ - if self._debug: - print >>sys.stderr, "QMP:>>> %s" % qmp_cmd + self.logger.debug("<<< %s", qmp_cmd) try: self.__sock.sendall(json.dumps(qmp_cmd)) except socket.error as err: @@ -173,8 +173,7 @@ class QEMUMonitorProtocol(object): return raise socket.error(err) resp =3D self.__json_read() - if self._debug: - print >>sys.stderr, "QMP:<<< %s" % resp + self.logger.debug("<<< %s", resp) return resp =20 def cmd(self, name, args=3DNone, cmd_id=3DNone): --=20 2.13.5 From nobody Mon Apr 29 02:33:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506517761525963.4428173182997; Wed, 27 Sep 2017 06:09:21 -0700 (PDT) Received: from localhost ([::1]:54785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC5W-0004Vj-Ma for importer@patchew.org; Wed, 27 Sep 2017 09:09:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxC0n-00011r-BS for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxC0h-0006m3-Bm for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42388) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxC0h-0006lu-3Z for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:04:19 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BCF47E454 for ; Wed, 27 Sep 2017 13:04:18 +0000 (UTC) Received: from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA6647E137; Wed, 27 Sep 2017 13:04:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2BCF47E454 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 10:03:39 -0300 Message-Id: <20170927130339.21444-6-ehabkost@redhat.com> In-Reply-To: <20170927130339.21444-1-ehabkost@redhat.com> References: <20170927130339.21444-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Sep 2017 13:04:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/5] scripts: Remove debug parameter from QEMUMachine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All scripts that use the QEMUMachine and QEMUQtestMachine classes (device-crash-test, tests/migration/*, iotests.py, basevm.py) already configure logging. The basicConfig() call inside QEMUMachine.__init__() is being kept just to make sure a script would still work if it didn't configure logging. Signed-off-by: Eduardo Habkost --- scripts/qemu.py | 6 ++---- tests/migration/guestperf/engine.py | 6 ++---- tests/qemu-iotests/iotests.py | 2 -- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index f6d2e68627..9bfdf6d37d 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -54,7 +54,7 @@ class QEMUMachine(object): =20 def __init__(self, binary, args=3DNone, wrapper=3DNone, name=3DNone, test_dir=3D"/var/tmp", monitor_address=3DNone, - socket_scm_helper=3DNone, debug=3DFalse): + socket_scm_helper=3DNone): ''' Initialize a QEMUMachine =20 @@ -65,7 +65,6 @@ class QEMUMachine(object): @param test_dir: where to create socket and log file @param monitor_address: address for QMP monitor @param socket_scm_helper: helper program, required for send_fd_scm= ()" - @param debug: enable debug mode @note: Qemu process is not started until launch() is used. ''' if args is None: @@ -85,12 +84,11 @@ class QEMUMachine(object): self._events =3D [] self._iolog =3D None self._socket_scm_helper =3D socket_scm_helper - self._debug =3D debug self._qmp =3D None self._qemu_full_args =3D None =20 # just in case logging wasn't configured by the main script: - logging.basicConfig(level=3D(logging.DEBUG if debug else logging.W= ARN)) + logging.basicConfig() =20 def __enter__(self): return self diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestper= f/engine.py index 0a13050bc6..e14d4320b2 100644 --- a/tests/migration/guestperf/engine.py +++ b/tests/migration/guestperf/engine.py @@ -388,15 +388,13 @@ class Engine(object): args=3Dself._get_src_args(hardware), wrapper=3Dself._get_src_wrapper(hardware), name=3D"qemu-src-%d" % os.getpid(), - monitor_address=3Dsrcmonaddr, - debug=3Dself._debug) + monitor_address=3Dsrcmonaddr) =20 dst =3D qemu.QEMUMachine(self._binary, args=3Dself._get_dst_args(hardware, uri), wrapper=3Dself._get_dst_wrapper(hardware), name=3D"qemu-dst-%d" % os.getpid(), - monitor_address=3Ddstmonaddr, - debug=3Dself._debug) + monitor_address=3Ddstmonaddr) =20 try: src.launch() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 36a7757aaf..6f057904a9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -195,8 +195,6 @@ class VM(qtest.QEMUQtestMachine): super(VM, self).__init__(qemu_prog, qemu_opts, name=3Dname, test_dir=3Dtest_dir, socket_scm_helper=3Dsocket_scm_helper) - if debug: - self._debug =3D True self._num_drives =3D 0 =20 def add_device(self, opts): --=20 2.13.5