Blame SOURCES/kvm-iotests-Enhance-223-233-to-cover-qemu-nbd-list.patch

7711c0
From a4e0439bc039710f1c7f3133ea1cfd88ae38fda5 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 27 Mar 2019 17:22:55 +0100
7711c0
Subject: [PATCH 117/163] iotests: Enhance 223, 233 to cover 'qemu-nbd --list'
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190327172308.31077-43-jsnow@redhat.com>
7711c0
Patchwork-id: 85215
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 42/55] iotests: Enhance 223, 233 to cover 'qemu-nbd --list'
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
Any good new feature deserves some regression testing :)
7711c0
Coverage includes:
7711c0
- 223: what happens when there are 0 or more than 1 export,
7711c0
proof that we can see multiple contexts including qemu:dirty-bitmap
7711c0
- 233: proof that we can list over TLS, and that mix-and-match of
7711c0
plain/TLS listings will behave sanely
7711c0
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
7711c0
Tested-by: Richard W.M. Jones <rjones@redhat.com>
7711c0
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
Message-Id: <20190117193658.16413-22-eblake@redhat.com>
7711c0
(cherry picked from commit ddd09448fd833d646952c769ae9ce3d39bee989f)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 tests/qemu-iotests/223     |  2 ++
7711c0
 tests/qemu-iotests/223.out | 20 ++++++++++++++++++++
7711c0
 tests/qemu-iotests/233     | 19 +++++++++++++------
7711c0
 tests/qemu-iotests/233.out | 15 +++++++++++++++
7711c0
 4 files changed, 50 insertions(+), 6 deletions(-)
7711c0
7711c0
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
7711c0
index 773892d..f120a01 100755
7711c0
--- a/tests/qemu-iotests/223
7711c0
+++ b/tests/qemu-iotests/223
7711c0
@@ -127,6 +127,7 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start",
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start",
7711c0
   "arguments":{"addr":{"type":"unix",
7711c0
     "data":{"path":"'"$TEST_DIR/nbd"1'"}}}}' "error" # Attempt second server
7711c0
+$QEMU_NBD_PROG -L -k "$TEST_DIR/nbd"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
   "arguments":{"device":"n", "bitmap":"b"}}' "return"
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
@@ -142,6 +143,7 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
7711c0
   "arguments":{"device":"n", "name":"n2", "writable":true,
7711c0
   "bitmap":"b2"}}' "return"
7711c0
+$QEMU_NBD_PROG -L -k "$TEST_DIR/nbd"
7711c0
 
7711c0
 echo
7711c0
 echo "=== Contrast normal status to large granularity dirty-bitmap ==="
7711c0
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
7711c0
index 4012bb0..963ae28 100644
7711c0
--- a/tests/qemu-iotests/223.out
7711c0
+++ b/tests/qemu-iotests/223.out
7711c0
@@ -30,12 +30,32 @@ wrote 2097152/2097152 bytes at offset 2097152
7711c0
 {"error": {"class": "GenericError", "desc": "NBD server not running"}}
7711c0
 {"return": {}}
7711c0
 {"error": {"class": "GenericError", "desc": "NBD server already running"}}
7711c0
+exports available: 0
7711c0
 {"return": {}}
7711c0
 {"error": {"class": "GenericError", "desc": "Cannot find device=nosuch nor node_name=nosuch"}}
7711c0
 {"error": {"class": "GenericError", "desc": "NBD server already has export named 'n'"}}
7711c0
 {"error": {"class": "GenericError", "desc": "Enabled bitmap 'b2' incompatible with readonly export"}}
7711c0
 {"error": {"class": "GenericError", "desc": "Bitmap 'b3' is not found"}}
7711c0
 {"return": {}}
7711c0
+exports available: 2
7711c0
+ export: 'n'
7711c0
+  size:  4194304
7711c0
+  flags: 0x4ef ( readonly flush fua trim zeroes df cache )
7711c0
+  min block: 512
7711c0
+  opt block: 4096
7711c0
+  max block: 33554432
7711c0
+  available meta contexts: 2
7711c0
+   base:allocation
7711c0
+   qemu:dirty-bitmap:b
7711c0
+ export: 'n2'
7711c0
+  size:  4194304
7711c0
+  flags: 0x4ed ( flush fua trim zeroes df cache )
7711c0
+  min block: 512
7711c0
+  opt block: 4096
7711c0
+  max block: 33554432
7711c0
+  available meta contexts: 2
7711c0
+   base:allocation
7711c0
+   qemu:dirty-bitmap:b2
7711c0
 
7711c0
 === Contrast normal status to large granularity dirty-bitmap ===
7711c0
 
7711c0
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
7711c0
index ab15c77..fc345a1 100755
7711c0
--- a/tests/qemu-iotests/233
7711c0
+++ b/tests/qemu-iotests/233
7711c0
@@ -69,10 +69,12 @@ echo
7711c0
 echo "== check TLS client to plain server fails =="
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
+obj=tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0
7711c0
+$QEMU_IMG info --image-opts --object $obj \
7711c0
     driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
7711c0
     2>&1 | sed "s/$nbd_tcp_port/PORT/g"
7711c0
+$QEMU_NBD_PROG -L -b $nbd_tcp_addr -p $nbd_tcp_port --object $obj \
7711c0
+    --tls-creds=tls0
7711c0
 
7711c0
 nbd_server_stop
7711c0
 
7711c0
@@ -85,20 +87,25 @@ nbd_server_start_tcp_socket \
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
+$QEMU_NBD_PROG -L -b $nbd_tcp_addr -p $nbd_tcp_port
7711c0
 
7711c0
 echo
7711c0
 echo "== check TLS works =="
7711c0
-$QEMU_IMG info --image-opts \
7711c0
-    --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
7711c0
+obj=tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0
7711c0
+$QEMU_IMG info --image-opts --object $obj \
7711c0
     driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
7711c0
     2>&1 | sed "s/$nbd_tcp_port/PORT/g"
7711c0
+$QEMU_NBD_PROG -L -b $nbd_tcp_addr -p $nbd_tcp_port --object $obj \
7711c0
+    --tls-creds=tls0
7711c0
 
7711c0
 echo
7711c0
 echo "== check TLS with different CA fails =="
7711c0
-$QEMU_IMG info --image-opts \
7711c0
-    --object tls-creds-x509,dir=${tls_dir}/client2,endpoint=client,id=tls0 \
7711c0
+obj=tls-creds-x509,dir=${tls_dir}/client2,endpoint=client,id=tls0
7711c0
+$QEMU_IMG info --image-opts --object $obj \
7711c0
     driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
7711c0
     2>&1 | sed "s/$nbd_tcp_port/PORT/g"
7711c0
+$QEMU_NBD_PROG -L -b $nbd_tcp_addr -p $nbd_tcp_port --object $obj \
7711c0
+    --tls-creds=tls0
7711c0
 
7711c0
 echo
7711c0
 echo "== perform I/O over TLS =="
7711c0
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
7711c0
index 2199d8a..6d45f3b 100644
7711c0
--- a/tests/qemu-iotests/233.out
7711c0
+++ b/tests/qemu-iotests/233.out
7711c0
@@ -15,19 +15,33 @@ wrote 1048576/1048576 bytes at offset 1048576
7711c0
 == check TLS client to plain server fails ==
7711c0
 qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Denied by server for option 5 (starttls)
7711c0
 server reported: TLS not configured
7711c0
+qemu-nbd: Denied by server for option 5 (starttls)
7711c0
+server reported: TLS not configured
7711c0
 
7711c0
 == check plain client to TLS server fails ==
7711c0
 qemu-img: Could not open 'nbd://localhost:PORT': TLS negotiation required before option 8 (structured reply)
7711c0
 server reported: Option 0x8 not permitted before TLS
7711c0
+qemu-nbd: TLS negotiation required before option 8 (structured reply)
7711c0
+server reported: Option 0x8 not permitted before TLS
7711c0
 
7711c0
 == check TLS works ==
7711c0
 image: nbd://127.0.0.1:PORT
7711c0
 file format: nbd
7711c0
 virtual size: 64M (67108864 bytes)
7711c0
 disk size: unavailable
7711c0
+exports available: 1
7711c0
+ export: ''
7711c0
+  size:  67108864
7711c0
+  flags: 0x4ed ( flush fua trim zeroes df cache )
7711c0
+  min block: 512
7711c0
+  opt block: 4096
7711c0
+  max block: 33554432
7711c0
+  available meta contexts: 1
7711c0
+   base:allocation
7711c0
 
7711c0
 == check TLS with different CA fails ==
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
+qemu-nbd: The certificate hasn't got a known issuer
7711c0
 
7711c0
 == perform I/O over TLS ==
7711c0
 read 1048576/1048576 bytes at offset 1048576
7711c0
@@ -39,4 +53,5 @@ read 1048576/1048576 bytes at offset 1048576
7711c0
 
7711c0
 == final server log ==
7711c0
 qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
7711c0
+qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
7711c0
 *** done
7711c0
-- 
7711c0
1.8.3.1
7711c0