Replaced qemu_comm_method=monitor _launch_qemu -m 512 "$TEST_IMG" with
_launch_qemu using -blockdev to set explicit node names (disk0-file and
disk0), and HMP savevm with QMP snapshot-save (job-based), waiting for
"concluded" status.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 tests/qemu-iotests/286     | 15 +++++++++++----
 tests/qemu-iotests/286.out |  8 +++++---
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286
index 3b030ec58aa0..565a960e9eb3 100755
--- a/tests/qemu-iotests/286
+++ b/tests/qemu-iotests/286
@@ -40,7 +40,6 @@ _supported_proto file fuse
 # Internal snapshots are (currently) impossible with refcount_bits=1,
 # and generally impossible with external data files
 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
-_require_hmp
 
 _make_test_img 64M
 
@@ -49,10 +48,18 @@ sn_name=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
 
 # More memory will give us a larger VM state, i.e. one above 1 MB.
 # This way, we get a number with a decimal point.
-qemu_comm_method=monitor _launch_qemu -m 512 "$TEST_IMG"
+_launch_qemu -m 512 \
+    -blockdev driver=file,filename="$TEST_IMG",node-name=disk0-file \
+    -blockdev driver=$IMGFMT,file=disk0-file,node-name=disk0
 
-_send_qemu_cmd $QEMU_HANDLE "savevm $sn_name" '(qemu)'
-_send_qemu_cmd $QEMU_HANDLE 'quit' '(qemu)'
+_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return'
+silent=yes _run_qmp_job $QEMU_HANDLE 'save0' \
+    "{ 'execute': 'snapshot-save',
+       'arguments': { 'job-id': 'save0',
+                      'tag': '$sn_name',
+                      'vmstate': 'disk0',
+                      'devices': ['disk0'] } }"
+_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return'
 wait=yes _cleanup_qemu
 
 # Check that all fields are separated by spaces.
diff --git a/tests/qemu-iotests/286.out b/tests/qemu-iotests/286.out
index bb04748e0808..33f1905a45ce 100644
--- a/tests/qemu-iotests/286.out
+++ b/tests/qemu-iotests/286.out
@@ -1,8 +1,10 @@
 QA output created by 286
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) savevm abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
-(qemu) quit
+{ 'execute': 'qmp_capabilities' }
+{"return": {}}
+{ 'execute': 'quit' }
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": 
"SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
+{"return": {}}
 Output structure:
 (snapshot ID) (snapshot name) (VM state size value) (VM state size unit) 
(snapshot date) (snapshot time) (VM clock) (icount)
 *** done

-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to