Received: from eggs.gnu.org ([2001:4830:134:3::10]:58438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkIQz-0001v1-M5 for qemu-devel@nongnu.org; Wed, 14 Sep 2016 18:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkIQy-0002wS-8E for qemu-devel@nongnu.org; Wed, 14 Sep 2016 18:13:37 -0400 References: <1471625435-6190-1-git-send-email-kwolf@redhat.com> <1471625435-6190-11-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <32842c09-6dce-b68b-d95e-de3813099faa@redhat.com> Date: Wed, 14 Sep 2016 17:13:26 -0500 MIME-Version: 1.0 In-Reply-To: <1471625435-6190-11-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="13euLrffp749pmBpSS53kWr0w8mjaAnSq" 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: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --13euLrffp749pmBpSS53kWr0w8mjaAnSq From: Eric Blake To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, qemu-devel@nongnu.org Message-ID: <32842c09-6dce-b68b-d95e-de3813099faa@redhat.com> Subject: Re: [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> In-Reply-To: <1471625435-6190-11-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/19/2016 11:50 AM, Kevin Wolf wrote: > We just added the option to use qdev device names in all device related= > block QMP commands. This patch converts some of the test cases in 118 t= o > use qdev device names instead of BlockBackend names to cover the new > way. It converts cases for each of the media change commands, but only > for CD-ROM and not everywhere, so that the old way is still tested, too= =2E >=20 > Signed-off-by: Kevin Wolf > --- > tests/qemu-iotests/118 | 85 ++++++++++++++++++++++++++++++++++-= -------- > tests/qemu-iotests/iotests.py | 5 +++ > 2 files changed, 73 insertions(+), 17 deletions(-) >=20 > @@ -76,9 +79,15 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): > self.assert_qmp(result, 'return[0]/inserted/image/filename', n= ew_img) > =20 > def test_blockdev_change_medium(self): > - result =3D self.vm.qmp('blockdev-change-medium', device=3D'dri= ve0', > - filename=3Dnew_= img, > - format=3Diotest= s.imgfmt) > + if self.device_name is not None: > + result =3D self.vm.qmp('blockdev-change-medium', > + id=3Dself.device_name, filename=3Dnew= _img, > + format=3Diotests.imgfmt) > + else: > + result =3D self.vm.qmp('blockdev-change-medium', > + device=3D'drive0', filename=3Dnew_img= , > + format=3Diotests.imgfmt) I'm not enough of a python guru to know if there is any way to compress this to a shorter format (I do know, however, that the lack of an obvious ?: operator in python can indeed result in verbose if/else clauses compared to other languages). At any rate, the ultimate test is whether the change still passes; and looks like you have good coverage of using exactly one or the other argument. Do you also want to add tests (either here, or in 11/10) that validate that providing neither 'device' nor 'id' gives a sane error, likewise that providing both has sane behavior? (For now, our behavior is that we fail, although it could also be argued that sane behavior would validate that 'id' happens to be currently in use by 'device' and only fail if they are not pointing to the same backend). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --13euLrffp749pmBpSS53kWr0w8mjaAnSq 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/ iQEcBAEBCAAGBQJX2cuGAAoJEKeha0olJ0NqA04H+gOuAJ3HfxE9WCTeEyBI/RGg EChFukNRxTZaSZW5oghnSbY8oc/TBoOeTJ6sSXkX9F7JBQils2zY4pPpGX2gASrN Q/wpMCKi7LtOjIj/aKoGADHjLAqoXxIJoAXviS+X8ghZhi1ckvfWi0bOKqf7VnIF jGHS3IZsV8qko2/7vDjdCENZsOfYwqLbRBbCCKJAmBDo07RUJHkE340EgbyIwPbz Vn5jrY7E5NMZMKBbU9PGBGwVrOlePwf4X+G1MU0Ms9Is6xfFLxIMYzNIabKbPf24 HkMY2zBPnVk93fJPD7RJt7CsLbInDLzYQ/7bhUjjK5tlcgornhncX5qBlLbKmMw= =f4F3 -----END PGP SIGNATURE----- --13euLrffp749pmBpSS53kWr0w8mjaAnSq--