Message ID | 20170330221243.17333-1-mreitz@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 03/30/2017 05:12 PM, Max Reitz wrote: > 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 <mreitz@redhat.com> > --- > 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(-) Squashing is fine by me. Reviewed-by: Eric Blake <eblake@redhat.com>
On 31.03.2017 00:12, Max Reitz wrote: > 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 <mreitz@redhat.com> > --- > 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(-) Squashed into said patch: https://github.com/XanClic/qemu/commit/block^ (on my block branch: https://github.com/XanClic/qemu/commits/block) Max
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 = 10811 test_img = os.path.join(iotests.test_dir, 'test.img') unix_socket = os.path.join(iotests.test_dir, 'nbd.socket') + +def flatten_sock_addr(crumpled_address): + result = { 'type': crumpled_address['type'] } + result.update(crumpled_address['data']) + return result + + class NBDBlockdevAddBase(iotests.QMPTestCase): def blockdev_add_options(self, address, export=None): options = { '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)) def test_unix(self): self._server_up('-k', unix_socket) address = { 'type': 'unix', 'data': { 'path': unix_socket } } - self.client_test('nbd+unix://?socket=' + unix_socket, address) + self.client_test('nbd+unix://?socket=' + unix_socket, + flatten_sock_addr(address)) 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() 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() 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=' + unix_socket, - address, 'nbd-export') + flatten_sock_addr(address), 'nbd-export') self._server_down() 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') self._server_down()
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 <mreitz@redhat.com> --- 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(-)