iotests: Fix test 147
PATCH 1/1 iotests: Fix test 147
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.
---
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(-)
tests/qemu-iotests/147 +17 -8
@@ -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()
Signature · 1 line
2.12.1
Quoted 10 lines · Max Reitz
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 <[email protected]>
Quoted 8 lines
---
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.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 10 lines · Max Reitz
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 <[email protected]>
Quoted 8 lines
---
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