|
|
9bac43 |
From f3eb0c097a879c9bc80a5a2589560b7ebde3720b Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
Date: Tue, 5 Dec 2017 10:26:10 +0100
|
|
|
9bac43 |
Subject: [PATCH 35/36] qemu-iotests: Test change-backing-file command
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
Message-id: <20171204121007.12964-8-kwolf@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78111
|
|
|
9bac43 |
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 7/8] qemu-iotests: Test change-backing-file command
|
|
|
9bac43 |
Bugzilla: 1492178
|
|
|
9bac43 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
This involves a temporary read-write reopen if the backing file link in
|
|
|
9bac43 |
the middle of a backing file chain should be changed and is therefore a
|
|
|
9bac43 |
good test for the latest bdrv_reopen() vs. op blockers fixes.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit 3fb23e07516aae13d1ba566740c1c81ae12184b7)
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
tests/qemu-iotests/195 | 92 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
9bac43 |
tests/qemu-iotests/195.out | 78 +++++++++++++++++++++++++++++++++++++++
|
|
|
9bac43 |
tests/qemu-iotests/group | 1 +
|
|
|
9bac43 |
3 files changed, 171 insertions(+)
|
|
|
9bac43 |
create mode 100644 tests/qemu-iotests/195
|
|
|
9bac43 |
create mode 100644 tests/qemu-iotests/195.out
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..05a239c
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/195
|
|
|
9bac43 |
@@ -0,0 +1,92 @@
|
|
|
9bac43 |
+#!/bin/bash
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# Test change-backing-file command
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# Copyright (C) 2017 Red Hat, Inc.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
9bac43 |
+# it under the terms of the GNU General Public License as published by
|
|
|
9bac43 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
9bac43 |
+# (at your option) any later version.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# This program is distributed in the hope that it will be useful,
|
|
|
9bac43 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9bac43 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
9bac43 |
+# GNU General Public License for more details.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# You should have received a copy of the GNU General Public License
|
|
|
9bac43 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+# creator
|
|
|
9bac43 |
+owner=kwolf@redhat.com
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+seq=`basename $0`
|
|
|
9bac43 |
+echo "QA output created by $seq"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+here=`pwd`
|
|
|
9bac43 |
+status=1 # failure is the default!
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_cleanup()
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ _cleanup_test_img
|
|
|
9bac43 |
+ rm -f "$TEST_IMG.mid"
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+# get standard environment, filters and checks
|
|
|
9bac43 |
+. ./common.rc
|
|
|
9bac43 |
+. ./common.filter
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_supported_fmt qcow2
|
|
|
9bac43 |
+_supported_proto file
|
|
|
9bac43 |
+_supported_os Linux
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+function do_run_qemu()
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ echo Testing: "$@" | _filter_imgfmt
|
|
|
9bac43 |
+ $QEMU -nographic -qmp-pretty stdio -serial none "$@"
|
|
|
9bac43 |
+ echo
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+function run_qemu()
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp \
|
|
|
9bac43 |
+ | _filter_qemu_io | _filter_generated_node_ids
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+size=64M
|
|
|
9bac43 |
+TEST_IMG="$TEST_IMG.base" _make_test_img $size
|
|
|
9bac43 |
+TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
|
|
|
9bac43 |
+_make_test_img -b "$TEST_IMG.mid"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+echo "Change backing file of mid (opened read-only)"
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+run_qemu -drive if=none,file="$TEST_IMG",backing.node-name=mid <
|
|
|
9bac43 |
+{"execute":"qmp_capabilities"}
|
|
|
9bac43 |
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"mid","backing-file":"/dev/null"}}
|
|
|
9bac43 |
+{"execute":"quit"}
|
|
|
9bac43 |
+EOF
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+TEST_IMG="$TEST_IMG.mid" _img_info
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+echo "Change backing file of top (opened writable)"
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+TEST_IMG="$TEST_IMG.mid" _make_test_img -b "$TEST_IMG.base"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+run_qemu -drive if=none,file="$TEST_IMG",node-name=top <
|
|
|
9bac43 |
+{"execute":"qmp_capabilities"}
|
|
|
9bac43 |
+{"execute":"change-backing-file", "arguments":{"device":"none0","image-node-name":"top","backing-file":"/dev/null"}}
|
|
|
9bac43 |
+{"execute":"quit"}
|
|
|
9bac43 |
+EOF
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_img_info
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+# success, all done
|
|
|
9bac43 |
+echo "*** done"
|
|
|
9bac43 |
+rm -f $seq.full
|
|
|
9bac43 |
+status=0
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/195.out b/tests/qemu-iotests/195.out
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..7613575
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/195.out
|
|
|
9bac43 |
@@ -0,0 +1,78 @@
|
|
|
9bac43 |
+QA output created by 195
|
|
|
9bac43 |
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
|
|
|
9bac43 |
+Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
|
|
|
9bac43 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.mid
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+Change backing file of mid (opened read-only)
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ QMP_VERSION
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "timestamp": {
|
|
|
9bac43 |
+ "seconds": TIMESTAMP,
|
|
|
9bac43 |
+ "microseconds": TIMESTAMP
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+ "event": "SHUTDOWN",
|
|
|
9bac43 |
+ "data": {
|
|
|
9bac43 |
+ "guest": false
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+image: TEST_DIR/t.IMGFMT.mid
|
|
|
9bac43 |
+file format: IMGFMT
|
|
|
9bac43 |
+virtual size: 64M (67108864 bytes)
|
|
|
9bac43 |
+cluster_size: 65536
|
|
|
9bac43 |
+backing file: /dev/null
|
|
|
9bac43 |
+backing file format: IMGFMT
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+Change backing file of top (opened writable)
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+Formatting 'TEST_DIR/t.IMGFMT.mid', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
|
|
|
9bac43 |
+Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ QMP_VERSION
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "return": {
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ "timestamp": {
|
|
|
9bac43 |
+ "seconds": TIMESTAMP,
|
|
|
9bac43 |
+ "microseconds": TIMESTAMP
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+ "event": "SHUTDOWN",
|
|
|
9bac43 |
+ "data": {
|
|
|
9bac43 |
+ "guest": false
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+image: TEST_DIR/t.IMGFMT
|
|
|
9bac43 |
+file format: IMGFMT
|
|
|
9bac43 |
+virtual size: 64M (67108864 bytes)
|
|
|
9bac43 |
+cluster_size: 65536
|
|
|
9bac43 |
+backing file: /dev/null
|
|
|
9bac43 |
+backing file format: IMGFMT
|
|
|
9bac43 |
+*** done
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
|
|
9bac43 |
index 13760b3..491a5f5 100644
|
|
|
9bac43 |
--- a/tests/qemu-iotests/group
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/group
|
|
|
9bac43 |
@@ -188,4 +188,5 @@
|
|
|
9bac43 |
190 rw auto quick
|
|
|
9bac43 |
192 rw auto quick
|
|
|
9bac43 |
194 rw auto migration quick
|
|
|
9bac43 |
+195 rw auto quick
|
|
|
9bac43 |
198 rw auto
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|