From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F24EEC433EF for ; Fri, 17 Sep 2021 14:57:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B5A6610E9 for ; Fri, 17 Sep 2021 14:57:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B5A6610E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRFIq-00023o-MM for qemu-devel@archiver.kernel.org; Fri, 17 Sep 2021 10:57:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRFHI-0007l0-Cp for qemu-devel@nongnu.org; Fri, 17 Sep 2021 10:55:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRFHE-0001qd-U9 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 10:55:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631890544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ES6Tn8zcpZEi/LRU1UjNQzt7mn0bLNLRPyEUiMjWASI=; b=hayoNwsACvaY5SF9RVn3FnqFKCoUJP0JyhH7jw/QHQOOHxlFg5vC7dxQ9jwprSPEddCi+U ETwBgxmJYDO27/pLozxwe7IBAa1NXzYIWKL5GYmO65ZfpnMIjFvdIt/AWcAqHLNUr7rNiQ yH74IsnD89ImsaCOSEh10x1cLOuwoSE= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-ZfiE_TGcM4GSAPFayzHHiQ-1; Fri, 17 Sep 2021 10:55:40 -0400 X-MC-Unique: ZfiE_TGcM4GSAPFayzHHiQ-1 Received: by mail-oi1-f197.google.com with SMTP id 17-20020aca2111000000b0026d657f80d7so34036219oiz.16 for ; Fri, 17 Sep 2021 07:55:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ES6Tn8zcpZEi/LRU1UjNQzt7mn0bLNLRPyEUiMjWASI=; b=nxVLbciWHNy6iuEdAGpkq281GGME2NcF4cvHhGYLy1BrP/i5DlFVv2ZTLStrmqaWzn Y7iIZMzi9DiHTAqKHoPe3g/rLLhU9oENt2402DhBqjWYH9Jd0POovFdP+f42vMZookRF tJpeASGKluy+qrRQQs8sJ/WZFlKYDiHieFhPLt4bl48o4NWDhJ22VtWCAv0kzw5JkxLG ZDCqze4cj4ZKa2cO8ULtc1V+Ah/2BrF2wEIe1KbwLeBIlHAfz6hDr1x65fjP4wQvLVTP 8B4F6M+1km7RZNdKlvXJ4bo3oOYLeqED9YlY7lcSX9tpHgIuj+CnDEzvh9f9DK65zeen TfHg== X-Gm-Message-State: AOAM5307DV9INgeWvzo2nKKovhx5Z6SsUmCD8ieTDStWxsjPW5Ymo+s+ zqumcRNNHrPNK3RcCQqqxYY/3Z5lmbEcEZEf3tAPewOK+RQzUK43J320lzKrUiTQF9nCiFzpTYe 0u0PiKv02YxG5s9kS/ry2s94c7yxWdXc= X-Received: by 2002:a4a:45cc:: with SMTP id y195mr9335134ooa.52.1631890539862; Fri, 17 Sep 2021 07:55:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDe0zgZsNqCE4Rt4NIQNiwtEdwjvrTACjFSOKJoYjYyhpWHgXVZBn0ApEoeVV5DrxBgwJzVBTQ1THSKi/t1V8= X-Received: by 2002:a4a:45cc:: with SMTP id y195mr9335119ooa.52.1631890539647; Fri, 17 Sep 2021 07:55:39 -0700 (PDT) MIME-Version: 1.0 References: <20210917054047.2042843-1-jsnow@redhat.com> <20210917054047.2042843-16-jsnow@redhat.com> In-Reply-To: From: John Snow Date: Fri, 17 Sep 2021 10:55:29 -0400 Message-ID: Subject: Re: [PATCH 15/15] python, iotests: replace qmp with aqmp To: Hanna Reitz Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000eda41505cc321f59" Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Eduardo Habkost , qemu-block@nongnu.org, qemu-devel , Cleber Rosa Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000eda41505cc321f59 Content-Type: text/plain; charset="UTF-8" On Fri, Sep 17, 2021 at 10:40 AM Hanna Reitz wrote: > On 17.09.21 07:40, John Snow wrote: > > Swap out the synchronous QEMUMonitorProtocol from qemu.qmp with the sync > > wrapper from qemu.aqmp instead. > > > > Add an escape hatch in the form of the environment variable > > QEMU_PYTHON_LEGACY_QMP which allows you to cajole QEMUMachine into using > > the old interface, proving that both implementations work concurrently. > > > > Signed-off-by: John Snow > > --- > > python/qemu/machine/machine.py | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/python/qemu/machine/machine.py > b/python/qemu/machine/machine.py > > index 8f5a6649e5..6b005dd5d1 100644 > > --- a/python/qemu/machine/machine.py > > +++ b/python/qemu/machine/machine.py > > @@ -41,7 +41,6 @@ > > ) > > > > from qemu.qmp import ( # pylint: disable=import-error > > - QEMUMonitorProtocol, > > QMPMessage, > > QMPReturnValue, > > SocketAddrT, > > @@ -50,6 +49,12 @@ > > from . import console_socket > > > > > > +if os.environ.get('QEMU_PYTHON_LEGACY_QMP'): > > + from qemu.qmp import QEMUMonitorProtocol > > +else: > > + from qemu.aqmp.legacy import QEMUMonitorProtocol > > + > > + > > LOG = logging.getLogger(__name__) > > Black magic. > > Reviewed-by: Hanna Reitz > Tested-by: Hanna Reitz > > Thanks for taking a look! Sorry for making you look at python :) --000000000000eda41505cc321f59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Sep 17, 2021 at 10:40 AM Hann= a Reitz <hreitz@redhat.com> = wrote:
On 17.09.= 21 07:40, John Snow wrote:
> Swap out the synchronous QEMUMonitorProtocol from qemu.qmp with the sy= nc
> wrapper from qemu.aqmp instead.
>
> Add an escape hatch in the form of the environment variable
> QEMU_PYTHON_LEGACY_QMP which allows you to cajole QEMUMachine into usi= ng
> the old interface, proving that both implementations work concurrently= .
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>=C2=A0 =C2=A0python/qemu/machine/machine.py | 7 ++++++-
>=C2=A0 =C2=A01 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/mach= ine.py
> index 8f5a6649e5..6b005dd5d1 100644
> --- a/python/qemu/machine/machine.py
> +++ b/python/qemu/machine/machine.py
> @@ -41,7 +41,6 @@
>=C2=A0 =C2=A0)
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0from qemu.qmp import (=C2=A0 # pylint: disable=3Dimport-er= ror
> -=C2=A0 =C2=A0 QEMUMonitorProtocol,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0QMPMessage,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0QMPReturnValue,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0SocketAddrT,
> @@ -50,6 +49,12 @@
>=C2=A0 =C2=A0from . import console_socket
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0
> +if os.environ.get('QEMU_PYTHON_LEGACY_QMP'):
> +=C2=A0 =C2=A0 from qemu.qmp import QEMUMonitorProtocol
> +else:
> +=C2=A0 =C2=A0 from qemu.aqmp.legacy import QEMUMonitorProtocol
> +
> +
>=C2=A0 =C2=A0LOG =3D logging.getLogger(__name__)

Black magic.

Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Tested-by: Hanna Reitz <hreitz@redhat.com>


Thanks for taking a look! Sorry for ma= king you look at python :)

--000000000000eda41505cc321f59--