Blame SOURCES/kvm-iotests-Make-nbd-fault-injector-flush.patch

7711c0
From 1006959f0d9606cc07fd6c7944228b8e1a8ffe98 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 27 Mar 2019 17:22:15 +0100
7711c0
Subject: [PATCH 076/163] iotests: Make nbd-fault-injector flush
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190327172308.31077-3-jsnow@redhat.com>
7711c0
Patchwork-id: 85177
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 02/55] iotests: Make nbd-fault-injector flush
7711c0
Bugzilla: 1691009
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Max Reitz <mreitz@redhat.com>
7711c0
7711c0
When closing a connection, make the nbd-fault-injector flush the socket.
7711c0
Without this, the output is a bit unreliable with Python 3.
7711c0
7711c0
Signed-off-by: Max Reitz <mreitz@redhat.com>
7711c0
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
7711c0
Reviewed-by: Cleber Rosa <crosa@redhat.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
Message-Id: <20181022135307.14398-2-mreitz@redhat.com>
7711c0
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7711c0
(cherry picked from commit 6d39db96d23ebe0d4361d108fa202091aa9cbfc1)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 tests/qemu-iotests/083.out               | 9 +++++++++
7711c0
 tests/qemu-iotests/nbd-fault-injector.py | 1 +
7711c0
 2 files changed, 10 insertions(+)
7711c0
7711c0
diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out
7711c0
index be6079d..f9af8bb 100644
7711c0
--- a/tests/qemu-iotests/083.out
7711c0
+++ b/tests/qemu-iotests/083.out
7711c0
@@ -41,6 +41,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo
7711c0
 
7711c0
 === Check disconnect after neg2 ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
 Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
@@ -54,6 +55,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo
7711c0
 
7711c0
 === Check disconnect before request ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
 Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
@@ -116,6 +118,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/
7711c0
 
7711c0
 === Check disconnect after neg-classic ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
 Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
@@ -161,6 +164,8 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock
7711c0
 
7711c0
 === Check disconnect after neg2 ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
+Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
 === Check disconnect 8 neg2 ===
7711c0
@@ -173,6 +178,8 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock
7711c0
 
7711c0
 === Check disconnect before request ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
+Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
 === Check disconnect after request ===
7711c0
@@ -234,6 +241,8 @@ can't open device nbd+unix:///?socket=TEST_DIR/nbd.sock
7711c0
 
7711c0
 === Check disconnect after neg-classic ===
7711c0
 
7711c0
+Unable to read from socket: Connection reset by peer
7711c0
+Connection closed
7711c0
 read failed: Input/output error
7711c0
 
7711c0
 *** done
7711c0
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
7711c0
index 8a04d97..44823f4 100755
7711c0
--- a/tests/qemu-iotests/nbd-fault-injector.py
7711c0
+++ b/tests/qemu-iotests/nbd-fault-injector.py
7711c0
@@ -111,6 +111,7 @@ class FaultInjectionSocket(object):
7711c0
             if rule.match(event, io):
7711c0
                 if rule.when == 0 or bufsize is None:
7711c0
                     print 'Closing connection on rule match %s' % rule.name
7711c0
+                    self.sock.flush()
7711c0
                     sys.exit(0)
7711c0
                 if rule.when != -1:
7711c0
                     return rule.when
7711c0
-- 
7711c0
1.8.3.1
7711c0