[{"id":1776335,"web_url":"http://patchwork.ozlabs.org/comment/1776335/","msgid":"<20170927132052.GJ12223@redhat.com>","list_archive_url":null,"date":"2017-09-27T13:20:52","subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","submitter":{"id":2694,"url":"http://patchwork.ozlabs.org/api/people/2694/","name":"Daniel P. Berrangé","email":"berrange@redhat.com"},"content":"On Wed, Sep 27, 2017 at 10:03:38AM -0300, Eduardo Habkost wrote:\n> Use logging module for the QMP debug messages.  The only scripts\n> that set debug=True are iotests.py and guestperf/engine.py, and\n> they already call logging.basicConfig() to set up logging.\n> \n> Scripts that don't configure logging are safe as long as they\n> don't need debugging output, because debug messages don't trigger\n> the \"No handlers could be found for logger\" message from the\n> Python logging module.\n> \n> Scripts that already configure logging but don't use debug=True\n> (e.g. scripts/vm/basevm.py) will get QMP debugging enabled for\n> free.\n> \n> Cc: \"Alex Bennée\" <alex.bennee@linaro.org>\n> Cc: Fam Zheng <famz@redhat.com>\n> Cc: \"Philippe Mathieu-Daudé\" <f4bug@amsat.org>\n> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>\n> ---\n>  scripts/qemu.py    |  3 +--\n>  scripts/qmp/qmp.py | 13 ++++++-------\n>  2 files changed, 7 insertions(+), 9 deletions(-)\n\nReviewed-by: Daniel P. Berrange <berrange@redhat.com>\n\nRegards,\nDaniel","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=berrange@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2JPf2GTvz9tXs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 23:21:42 +1000 (AEST)","from localhost ([::1]:54822 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxCHT-0008R5-KN\n\tfor incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 09:21:39 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57001)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <berrange@redhat.com>) id 1dxCGr-0008EU-EO\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:21:05 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <berrange@redhat.com>) id 1dxCGq-0007ol-Ab\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:21:01 -0400","from mx1.redhat.com ([209.132.183.28]:58664)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <berrange@redhat.com>) id 1dxCGq-0007oZ-4F\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:21:00 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 3F73BC04D2EF;\n\tWed, 27 Sep 2017 13:20:59 +0000 (UTC)","from redhat.com (unknown [10.42.22.189])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id CD4247F575;\n\tWed, 27 Sep 2017 13:20:54 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 3F73BC04D2EF","Date":"Wed, 27 Sep 2017 14:20:52 +0100","From":"\"Daniel P. Berrange\" <berrange@redhat.com>","To":"Eduardo Habkost <ehabkost@redhat.com>","Message-ID":"<20170927132052.GJ12223@redhat.com>","References":"<20170927130339.21444-1-ehabkost@redhat.com>\n\t<20170927130339.21444-5-ehabkost@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20170927130339.21444-5-ehabkost@redhat.com>","User-Agent":"Mutt/1.9.0 (2017-09-02)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tWed, 27 Sep 2017 13:20:59 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Reply-To":"\"Daniel P. Berrange\" <berrange@redhat.com>","Cc":"=?utf-8?b?THVrw6HFoQ==?= Doktor <ldoktor@redhat.com>,\n\tFam Zheng <famz@redhat.com>, qemu-devel@nongnu.org, Philippe\n\t=?utf-8?q?Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tCleber Rosa <crosa@redhat.com>, Alex =?utf-8?q?Benn=C3=A9e?=\n\t<alex.bennee@linaro.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1776344,"web_url":"http://patchwork.ozlabs.org/comment/1776344/","msgid":"<20170927133321.GB8521@lemon.lan>","list_archive_url":null,"date":"2017-09-27T13:33:21","subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/people/24872/","name":"Fam Zheng","email":"famz@redhat.com"},"content":"On Wed, 09/27 10:03, Eduardo Habkost wrote:\n> @@ -51,7 +54,6 @@ class QEMUMonitorProtocol(object):\n>          \"\"\"\n>          self.__events = []\n>          self.__address = address\n> -        self._debug = debug\n\nShould you also drop the debug parameter from the method?\n\n>          self.__sock = self.__get_sock()\n>          self.__sockfile = None\n>          if server:\n> @@ -83,8 +85,7 @@ class QEMUMonitorProtocol(object):\n>                  return\n>              resp = json.loads(data)\n>              if 'event' in resp:\n> -                if self._debug:\n> -                    print >>sys.stderr, \"QMP:<<< %s\" % resp\n> +                self.logger.debug(\"<<< %s\", resp)\n>                  self.__events.append(resp)\n>                  if not only_event:\n>                      continue\n> @@ -164,8 +165,7 @@ class QEMUMonitorProtocol(object):\n>          @return QMP response as a Python dict or None if the connection has\n>                  been closed\n>          \"\"\"\n> -        if self._debug:\n> -            print >>sys.stderr, \"QMP:>>> %s\" % qmp_cmd\n> +        self.logger.debug(\"<<< %s\", qmp_cmd)\n\nThis should be \">>> %s\".","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2Jh24gWWz9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 23:34:08 +1000 (AEST)","from localhost ([::1]:54849 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxCTV-0004YB-Jd\n\tfor incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 09:34:05 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:60237)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dxCSx-0004Xa-JH\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:33:40 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dxCSr-00061g-Ga\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:33:31 -0400","from mx1.redhat.com ([209.132.183.28]:49988)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>) id 1dxCSr-00061I-9g\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:33:25 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2AF97CCB60;\n\tWed, 27 Sep 2017 13:33:24 +0000 (UTC)","from localhost (ovpn-12-49.pek2.redhat.com [10.72.12.49])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 6762F7F7ED;\n\tWed, 27 Sep 2017 13:33:22 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2AF97CCB60","Date":"Wed, 27 Sep 2017 21:33:21 +0800","From":"Fam Zheng <famz@redhat.com>","To":"Eduardo Habkost <ehabkost@redhat.com>","Message-ID":"<20170927133321.GB8521@lemon.lan>","References":"<20170927130339.21444-1-ehabkost@redhat.com>\n\t<20170927130339.21444-5-ehabkost@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170927130339.21444-5-ehabkost@redhat.com>","User-Agent":"Mutt/1.9.0 (2017-09-02)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 27 Sep 2017 13:33:24 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"=?utf-8?b?THVrw6HFoQ==?= Doktor <ldoktor@redhat.com>, Philippe\n\t=?iso-8859-1?q?Mathieu-Daud=E9?= <f4bug@amsat.org>, Alex\n\t=?iso-8859-1?q?Benn=E9e?= <alex.bennee@linaro.org>,\n\tqemu-devel@nongnu.org, Cleber Rosa <crosa@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1776356,"web_url":"http://patchwork.ozlabs.org/comment/1776356/","msgid":"<20170927134124.GG4115@localhost.localdomain>","list_archive_url":null,"date":"2017-09-27T13:41:24","subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","submitter":{"id":195,"url":"http://patchwork.ozlabs.org/api/people/195/","name":"Eduardo Habkost","email":"ehabkost@redhat.com"},"content":"On Wed, Sep 27, 2017 at 09:33:21PM +0800, Fam Zheng wrote:\n> On Wed, 09/27 10:03, Eduardo Habkost wrote:\n> > @@ -51,7 +54,6 @@ class QEMUMonitorProtocol(object):\n> >          \"\"\"\n> >          self.__events = []\n> >          self.__address = address\n> > -        self._debug = debug\n> \n> Should you also drop the debug parameter from the method?\n\nI will do.  Thanks for noticing!\n\n> \n> >          self.__sock = self.__get_sock()\n> >          self.__sockfile = None\n> >          if server:\n> > @@ -83,8 +85,7 @@ class QEMUMonitorProtocol(object):\n> >                  return\n> >              resp = json.loads(data)\n> >              if 'event' in resp:\n> > -                if self._debug:\n> > -                    print >>sys.stderr, \"QMP:<<< %s\" % resp\n> > +                self.logger.debug(\"<<< %s\", resp)\n> >                  self.__events.append(resp)\n> >                  if not only_event:\n> >                      continue\n> > @@ -164,8 +165,7 @@ class QEMUMonitorProtocol(object):\n> >          @return QMP response as a Python dict or None if the connection has\n> >                  been closed\n> >          \"\"\"\n> > -        if self._debug:\n> > -            print >>sys.stderr, \"QMP:>>> %s\" % qmp_cmd\n> > +        self.logger.debug(\"<<< %s\", qmp_cmd)\n> \n> This should be \">>> %s\".\n\nGood catch.  Thanks!\n\nI will send a fixup in a moment.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ehabkost@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2JsS5gpyz9tXw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 23:42:20 +1000 (AEST)","from localhost ([::1]:54879 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxCbS-0007uc-RD\n\tfor incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 09:42:18 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:34301)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dxCap-0007os-2S\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:41:46 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dxCaj-0001de-9b\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:41:39 -0400","from mx1.redhat.com ([209.132.183.28]:57886)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <ehabkost@redhat.com>) id 1dxCaj-0001dF-33\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:41:33 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1FDAB7DD0A;\n\tWed, 27 Sep 2017 13:41:32 +0000 (UTC)","from localhost (ovpn-116-18.gru2.redhat.com [10.97.116.18])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 09DE17F6C1;\n\tWed, 27 Sep 2017 13:41:25 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 1FDAB7DD0A","Date":"Wed, 27 Sep 2017 10:41:24 -0300","From":"Eduardo Habkost <ehabkost@redhat.com>","To":"Fam Zheng <famz@redhat.com>","Message-ID":"<20170927134124.GG4115@localhost.localdomain>","References":"<20170927130339.21444-1-ehabkost@redhat.com>\n\t<20170927130339.21444-5-ehabkost@redhat.com>\n\t<20170927133321.GB8521@lemon.lan>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170927133321.GB8521@lemon.lan>","X-Fnord":"you can see the fnord","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tWed, 27 Sep 2017 13:41:32 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from\n\tQEMUMonitorProtocol","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"=?utf-8?b?THVrw6HFoQ==?= Doktor <ldoktor@redhat.com>, Philippe\n\t=?iso-8859-1?q?Mathieu-Daud=E9?= <f4bug@amsat.org>, Alex\n\t=?iso-8859-1?q?Benn=E9e?= <alex.bennee@linaro.org>,\n\tqemu-devel@nongnu.org, Cleber Rosa <crosa@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]