]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0045-qemu-iotests-improve-nbd-fault-injector.py-startup-p.patch
bump version to 2.9.1-9
[pve-qemu.git] / debian / patches / extra / 0045-qemu-iotests-improve-nbd-fault-injector.py-startup-p.patch
CommitLineData
b45e13fe
AD
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Eric Blake <eblake@redhat.com>
3Date: Wed, 27 Sep 2017 17:57:23 +0200
507c6de3 4Subject: [PATCH] qemu-iotests: improve nbd-fault-injector.py startup protocol
b45e13fe
AD
5
6RH-Author: Eric Blake <eblake@redhat.com>
7Message-id: <20170927175725.20023-6-eblake@redhat.com>
8Patchwork-id: 76675
9O-Subject: [RHEV-7.4.z qemu-kvm-rhev PATCH 5/7] qemu-iotests: improve nbd-fault-injector.py startup protocol
10Bugzilla: 1495474
11RH-Acked-by: Max Reitz <mreitz@redhat.com>
12RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
13RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
14
15From: Stefan Hajnoczi <stefanha@redhat.com>
16
17Currently 083 waits for the nbd-fault-injector.py server to start up by
18looping until netstat shows the TCP listen socket.
19
20The startup protocol can be simplified by passing a 0 port number to
21nbd-fault-injector.py. The kernel will allocate a port in bind(2) and
22the final port number can be printed by nbd-fault-injector.py.
23
24This should make it slightly nicer and less TCP-specific to wait for
25server startup. This patch changes nbd-fault-injector.py, the next one
26will rewrite server startup in 083.
27
28Reviewed-by: Eric Blake <eblake@redhat.com>
29Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
30Message-Id: <20170829122745.14309-3-stefanha@redhat.com>
31Signed-off-by: Eric Blake <eblake@redhat.com>
32(cherry picked from commit 6e592fc92234a58c7156c385840633c17dedd24f)
33Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34---
35 tests/qemu-iotests/nbd-fault-injector.py | 4 ++++
36 1 file changed, 4 insertions(+)
37
38diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
507c6de3 39index 6c07191a5a..1c10dcb51c 100755
b45e13fe
AD
40--- a/tests/qemu-iotests/nbd-fault-injector.py
41+++ b/tests/qemu-iotests/nbd-fault-injector.py
42@@ -235,11 +235,15 @@ def open_socket(path):
43 sock = socket.socket()
44 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
45 sock.bind((host, int(port)))
46+
47+ # If given port was 0 the final port number is now available
48+ path = '%s:%d' % sock.getsockname()
49 else:
50 sock = socket.socket(socket.AF_UNIX)
51 sock.bind(path)
52 sock.listen(0)
53 print 'Listening on %s' % path
54+ sys.stdout.flush() # another process may be waiting, show message now
55 return sock
56
57 def usage(args):
58--
507c6de3 592.11.0
b45e13fe 60