From nobody Sun Apr 28 03:25:51 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.zoho.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 1490912036234678.1309925243484; Thu, 30 Mar 2017 15:13:56 -0700 (PDT) Received: from localhost ([::1]:37894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctiKH-0002Ld-SS for importer@patchew.org; Thu, 30 Mar 2017 18:13:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctiJK-0001v1-Mf for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:12:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctiJJ-0000fR-Gd for qemu-devel@nongnu.org; Thu, 30 Mar 2017 18:12:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49444) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctiJF-0000dE-0w; Thu, 30 Mar 2017 18:12:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31D287E9FF; Thu, 30 Mar 2017 22:12:47 +0000 (UTC) Received: from localhost (ovpn-204-28.brq.redhat.com [10.40.204.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B930878DC8; Thu, 30 Mar 2017 22:12:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31D287E9FF Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 31D287E9FF From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 31 Mar 2017 00:12:43 +0200 Message-Id: <20170330221243.17333-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Mar 2017 22:12:47 +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 for-2.9] iotests: Fix test 147 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: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz 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" This test has been broken by changing NBD's blockdev-add interface (from taking a SocketAddress to taking a SocketAddressFlat). This patch makes it work again. Unfortunately, we cannot just flatten all of the addresses because nbd-server-start still takes a plain SocketAddress. Therefore, we need both and this is most easily achieved by writing the SocketAddress into the code and flattening it where necessary. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- I can be convinced to squash this into Markus' patch "nbd: Tidy up blockdev-add interface" which is the reason this test broke. I personally don't have a strong opinion on the matter other than "We won't get Markus to send a v4". --- tests/qemu-iotests/147 | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index cca75c562c..32afea63d4 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -30,6 +30,13 @@ NBD_PORT =3D 10811 test_img =3D os.path.join(iotests.test_dir, 'test.img') unix_socket =3D os.path.join(iotests.test_dir, 'nbd.socket') =20 + +def flatten_sock_addr(crumpled_address): + result =3D { 'type': crumpled_address['type'] } + result.update(crumpled_address['data']) + return result + + class NBDBlockdevAddBase(iotests.QMPTestCase): def blockdev_add_options(self, address, export=3DNone): options =3D { 'node-name': 'nbd-blockdev', @@ -85,13 +92,15 @@ class QemuNBD(NBDBlockdevAddBase): 'host': 'localhost', 'port': str(NBD_PORT) } } - self.client_test('nbd://localhost:%i' % NBD_PORT, address) + self.client_test('nbd://localhost:%i' % NBD_PORT, + flatten_sock_addr(address)) =20 def test_unix(self): self._server_up('-k', unix_socket) address =3D { 'type': 'unix', 'data': { 'path': unix_socket } } - self.client_test('nbd+unix://?socket=3D' + unix_socket, address) + self.client_test('nbd+unix://?socket=3D' + unix_socket, + flatten_sock_addr(address)) =20 =20 class BuiltinNBD(NBDBlockdevAddBase): @@ -134,7 +143,7 @@ class BuiltinNBD(NBDBlockdevAddBase): } } self._server_up(address) self.client_test('nbd://localhost:%i/nbd-export' % NBD_PORT, - address, 'nbd-export') + flatten_sock_addr(address), 'nbd-export') self._server_down() =20 def test_inet6(self): @@ -149,10 +158,10 @@ class BuiltinNBD(NBDBlockdevAddBase): 'file': { 'driver': 'nbd', 'export': 'nbd-export', - 'server': address + 'server': flatten_sock_addr(address) } } self._server_up(address) - self.client_test(filename, address, 'nbd-export') + self.client_test(filename, flatten_sock_addr(address), 'nbd-export= ') self._server_down() =20 def test_unix(self): @@ -160,7 +169,7 @@ class BuiltinNBD(NBDBlockdevAddBase): 'data': { 'path': unix_socket } } self._server_up(address) self.client_test('nbd+unix:///nbd-export?socket=3D' + unix_socket, - address, 'nbd-export') + flatten_sock_addr(address), 'nbd-export') self._server_down() =20 def test_fd(self): @@ -182,9 +191,9 @@ class BuiltinNBD(NBDBlockdevAddBase): 'file': { 'driver': 'nbd', 'export': 'nbd-export', - 'server': address + 'server': flatten_sock_addr(address) } } - self.client_test(filename, address, 'nbd-export') + self.client_test(filename, flatten_sock_addr(address), 'nbd-export= ') =20 self._server_down() =20 --=20 2.12.1