b38b0f
From 58bf58e416a89ea5166865664887cfe4562b1fc0 Mon Sep 17 00:00:00 2001
b38b0f
From: Max Reitz <mreitz@redhat.com>
b38b0f
Date: Wed, 26 Jun 2019 16:24:01 +0100
b38b0f
Subject: [PATCH 2/2] iotests: Make 182 do without device_add
b38b0f
MIME-Version: 1.0
b38b0f
Content-Type: text/plain; charset=UTF-8
b38b0f
Content-Transfer-Encoding: 8bit
b38b0f
b38b0f
RH-Author: Max Reitz <mreitz@redhat.com>
b38b0f
Message-id: <20190626162401.11112-2-mreitz@redhat.com>
b38b0f
Patchwork-id: 88951
b38b0f
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 1/1] iotests: Make 182 do without device_add
b38b0f
Bugzilla: 1707598
b38b0f
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
b38b0f
RH-Acked-by: John Snow <jsnow@redhat.com>
b38b0f
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
b38b0f
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
b38b0f
b38b0f
182 fails if qemu has no support for hotplugging of a virtio-blk device.
b38b0f
Using an NBD server instead works just as well for the test, even on
b38b0f
qemus without hotplugging support.
b38b0f
b38b0f
Fixes: 6d0a4a0fb5c8f10c8eb68b52cfda0082b00ae963
b38b0f
Reported-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
Signed-off-by: Max Reitz <mreitz@redhat.com>
b38b0f
Message-Id: <20190417153005.30096-1-mreitz@redhat.com>
b38b0f
Tested-by: Eric Blake <eblake@redhat.com>
b38b0f
Reviewed-by: Eric Blake <eblake@redhat.com>
b38b0f
Acked-by: Alberto Garcia <berto@igalia.com>
b38b0f
Signed-off-by: Eric Blake <eblake@redhat.com>
b38b0f
(cherry picked from commit 8fabb8be37775ebb32b0d78bc7be815a29b8a107)
b38b0f
Signed-off-by: Max Reitz <mreitz@redhat.com>
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 tests/qemu-iotests/182     | 22 +++++++++++++++++-----
b38b0f
 tests/qemu-iotests/182.out |  1 +
b38b0f
 2 files changed, 18 insertions(+), 5 deletions(-)
b38b0f
b38b0f
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
b38b0f
index 3b7689c..c1520ed 100755
b38b0f
--- a/tests/qemu-iotests/182
b38b0f
+++ b/tests/qemu-iotests/182
b38b0f
@@ -32,6 +32,7 @@ _cleanup()
b38b0f
 {
b38b0f
     _cleanup_test_img
b38b0f
     rm -f "$TEST_IMG.overlay"
b38b0f
+    rm -f "$TEST_DIR/nbd.socket"
b38b0f
 }
b38b0f
 trap "_cleanup; exit \$status" 0 1 2 3 15
b38b0f
 
b38b0f
@@ -127,15 +128,26 @@ success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
b38b0f
     'return' \
b38b0f
     'error'
b38b0f
 
b38b0f
-# Now we attach the image to a virtio-blk device.  This device does
b38b0f
-# require some permissions (at least WRITE and READ_CONSISTENT), so if
b38b0f
+# Start an NBD server to which we can attach node1
b38b0f
+success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
b38b0f
+    "{'execute': 'nbd-server-start',
b38b0f
+      'arguments': {
b38b0f
+          'addr': {
b38b0f
+              'type': 'unix',
b38b0f
+              'data': {
b38b0f
+                  'path': '$TEST_DIR/nbd.socket'
b38b0f
+              } } } }" \
b38b0f
+    'return' \
b38b0f
+    'error'
b38b0f
+
b38b0f
+# Now we attach the image to the NBD server.  This server does require
b38b0f
+# some permissions (at least WRITE and READ_CONSISTENT), so if
b38b0f
 # reopening node0 unshared any (which it should not have), this will
b38b0f
 # fail (but it should not).
b38b0f
 success_or_failure=y _send_qemu_cmd $QEMU_HANDLE \
b38b0f
-    "{'execute': 'device_add',
b38b0f
+    "{'execute': 'nbd-server-add',
b38b0f
       'arguments': {
b38b0f
-          'driver': 'virtio-blk',
b38b0f
-          'drive': 'node1'
b38b0f
+          'device': 'node1'
b38b0f
       } }" \
b38b0f
     'return' \
b38b0f
     'error'
b38b0f
diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out
b38b0f
index af501ca..33d41ee 100644
b38b0f
--- a/tests/qemu-iotests/182.out
b38b0f
+++ b/tests/qemu-iotests/182.out
b38b0f
@@ -14,4 +14,5 @@ Formatting 'TEST_DIR/t.qcow2.overlay', fmt=qcow2 size=197120 backing_file=TEST_D
b38b0f
 {"return": {}}
b38b0f
 {"return": {}}
b38b0f
 {"return": {}}
b38b0f
+{"return": {}}
b38b0f
 *** done
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f