From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkZbj-00026e-1Q for qemu-devel@nongnu.org; Thu, 15 Sep 2016 12:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkZbg-0003dJ-0A for qemu-devel@nongnu.org; Thu, 15 Sep 2016 12:33:49 -0400 References: <1471625435-6190-1-git-send-email-kwolf@redhat.com> <1471625435-6190-11-git-send-email-kwolf@redhat.com> <32842c09-6dce-b68b-d95e-de3813099faa@redhat.com> <87mvj9cf4q.fsf@oc4731375738.ibm.com> <87k2edcekp.fsf@oc4731375738.ibm.com> From: Eric Blake Message-ID: <28a951bf-d082-a7c8-41af-38cccb0a9185@redhat.com> Date: Thu, 15 Sep 2016 11:33:32 -0500 MIME-Version: 1.0 In-Reply-To: <87k2edcekp.fsf@oc4731375738.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J8bs4KLgmbN0pvnAIf3Hx99i6x5X7rJ88" Subject: Re: [Qemu-devel] [PATCH 10/10] qemu-iotests/118: Test media change with qdev name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sascha Silbe , Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --J8bs4KLgmbN0pvnAIf3Hx99i6x5X7rJ88 From: Eric Blake To: Sascha Silbe , Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, mreitz@redhat.com Message-ID: <28a951bf-d082-a7c8-41af-38cccb0a9185@redhat.com> Subject: Re: [Qemu-devel] [PATCH 10/10] qemu-iotests/118: Test media change with qdev name References: <1471625435-6190-1-git-send-email-kwolf@redhat.com> <1471625435-6190-11-git-send-email-kwolf@redhat.com> <32842c09-6dce-b68b-d95e-de3813099faa@redhat.com> <87mvj9cf4q.fsf@oc4731375738.ibm.com> <87k2edcekp.fsf@oc4731375738.ibm.com> In-Reply-To: <87k2edcekp.fsf@oc4731375738.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/15/2016 11:28 AM, Sascha Silbe wrote: > Dear Eric, >=20 > Sascha Silbe writes: >=20 >> result =3D self.vm.qmp('blockdev-change-medium', >> id=3Dself.device_name or 'drive0', filena= me=3Dnew_img, >> format=3Diotests.imgfmt) >=20 > Sorry, my eyes deceived me. I thought the original code was setting the= > "id" parameter in both cases. QEMUMachine.qmp() and > QEMUMonitorProtocol.cmd() together translate the keyword arguments > directly into QMP arguments, so passing None is different from not > passing anything at all. The if/else is probably the best approach in > that case; everything else I can think of would just be more > complicated. If there were some way to do: arglist =3D (all other parameters) if self.device_name: arglist.append(id=3Dself.device_name) else: arglist.append(device=3D'drive0') invoke(self.vm.qmp, arglist) that might be a little cleaner (no repetition on all the other parameters); but I don't know enough python to know if there is some sort of invoke() mechanism for pairing a method object and an arbitrary list as though it were a normal method call (I suspect there is, and I just don't know it). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --J8bs4KLgmbN0pvnAIf3Hx99i6x5X7rJ88 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX2s1cAAoJEKeha0olJ0NqdrsIAJy9UtZHIjomRCYBDmbj7Mqh W2rtyvo8vOqfmiqNSElfY9zaP5uUoO8vNc0wpA8WUohweUgJnxha37g3MEWbfutZ J7CUNMvqxpZIsrsVOjwUbkIMrZl3dOEg1ohTguTq0W+7auHippPqAwHrpCVh10WG dZifa+m6lB2uiaNlgiYc33miEPeFu6nl6B/UHuL82ecCl2f3XpBuCwarBhXVMx+o 5bJAemVeRht1F4hFBHkcpxpedx0bp9aAmPIIHzTloP/EY/Clr9w7Kqr0dgnJqbjO 7dj7cX8NRvp27B06Xf2peFV5wEln/nYjnQ+EkrknQSLBZUXmggopk2TozlWrY/I= =+Wpu -----END PGP SIGNATURE----- --J8bs4KLgmbN0pvnAIf3Hx99i6x5X7rJ88--