Blame SOURCES/kvm-iotests-Make-233-output-more-reliable.patch

7711c0
From 0269fa2be355b2885e90bd676f63ae5fe4e8de08 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 27 Mar 2019 17:22:35 +0100
7711c0
Subject: [PATCH 097/163] iotests: Make 233 output more reliable
7711c0
MIME-Version: 1.0
7711c0
Content-Type: text/plain; charset=UTF-8
7711c0
Content-Transfer-Encoding: 8bit
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190327172308.31077-23-jsnow@redhat.com>
7711c0
Patchwork-id: 85189
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 22/55] iotests: Make 233 output more reliable
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: Eric Blake <eblake@redhat.com>
7711c0
7711c0
We have a race between the nbd server and the client both trying
7711c0
to report errors at once which can make the test sometimes fail
7711c0
if the output lines swap order under load.  Break the race by
7711c0
collecting server messages into a file and then replaying that
7711c0
at the end of the test.
7711c0
7711c0
We may yet want to fix the server to not output ANYTHING for a
7711c0
client action except when -v was used (to avoid malicious clients
7711c0
from being able to DoS a server by filling up its logs), but that
7711c0
is saved for a future patch.
7711c0
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
CC: Daniel P. Berrangé <berrange@redhat.com>
7711c0
Message-Id: <20190117193658.16413-2-eblake@redhat.com>
7711c0
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7711c0
(cherry picked from commit d08980511d78480ffbbd9897b7fd050bd03d518d)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 tests/qemu-iotests/233     | 11 ++++++++---
7711c0
 tests/qemu-iotests/233.out |  4 +++-
7711c0
 2 files changed, 11 insertions(+), 4 deletions(-)
7711c0
7711c0
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
7711c0
index 1814efe..ab15c77 100755
7711c0
--- a/tests/qemu-iotests/233
7711c0
+++ b/tests/qemu-iotests/233
7711c0
@@ -2,7 +2,7 @@
7711c0
 #
7711c0
 # Test NBD TLS certificate / authorization integration
7711c0
 #
7711c0
-# Copyright (C) 2018 Red Hat, Inc.
7711c0
+# Copyright (C) 2018-2019 Red Hat, Inc.
7711c0
 #
7711c0
 # This program is free software; you can redistribute it and/or modify
7711c0
 # it under the terms of the GNU General Public License as published by
7711c0
@@ -30,6 +30,7 @@ _cleanup()
7711c0
 {
7711c0
     nbd_server_stop
7711c0
     _cleanup_test_img
7711c0
+    rm -f "$TEST_DIR/server.log"
7711c0
     tls_x509_cleanup
7711c0
 }
7711c0
 trap "_cleanup; exit \$status" 0 1 2 3 15
7711c0
@@ -66,7 +67,7 @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
7711c0
 
7711c0
 echo
7711c0
 echo "== check TLS client to plain server fails =="
7711c0
-nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG"
7711c0
+nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG" 2> "$TEST_DIR/server.log"
7711c0
 
7711c0
 $QEMU_IMG info --image-opts \
7711c0
     --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
7711c0
@@ -81,7 +82,7 @@ echo "== check plain client to TLS server fails =="
7711c0
 nbd_server_start_tcp_socket \
7711c0
     --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes \
7711c0
     --tls-creds tls0 \
7711c0
-    -f $IMGFMT "$TEST_IMG"
7711c0
+    -f $IMGFMT "$TEST_IMG" 2>> "$TEST_DIR/server.log"
7711c0
 
7711c0
 $QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
7711c0
 
7711c0
@@ -109,6 +110,10 @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
7711c0
 
7711c0
 $QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
7711c0
 
7711c0
+echo
7711c0
+echo "== final server log =="
7711c0
+cat "$TEST_DIR/server.log"
7711c0
+
7711c0
 # success, all done
7711c0
 echo "*** done"
7711c0
 rm -f $seq.full
7711c0
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
7711c0
index 5f41672..2199d8a 100644
7711c0
--- a/tests/qemu-iotests/233.out
7711c0
+++ b/tests/qemu-iotests/233.out
7711c0
@@ -27,7 +27,6 @@ virtual size: 64M (67108864 bytes)
7711c0
 disk size: unavailable
7711c0
 
7711c0
 == check TLS with different CA fails ==
7711c0
-qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
7711c0
 qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': The certificate hasn't got a known issuer
7711c0
 
7711c0
 == perform I/O over TLS ==
7711c0
@@ -37,4 +36,7 @@ wrote 1048576/1048576 bytes at offset 1048576
7711c0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
 read 1048576/1048576 bytes at offset 1048576
7711c0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
7711c0
+
7711c0
+== final server log ==
7711c0
+qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
7711c0
 *** done
7711c0
-- 
7711c0
1.8.3.1
7711c0