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