|
|
9ae3a8 |
From 3ca6e2a4a1ecd9515eda8ebe400e0791a227fb79 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 23 Oct 2014 10:10:09 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 05/19] qemu-iotests: Test a few blockdev-add error cases
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1414059011-15516-7-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 61841
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 6/8] qemu-iotests: Test a few blockdev-add error cases
|
|
|
9ae3a8 |
Bugzilla: 1088176
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Benoit Canet <benoit@irqsave.net>
|
|
|
9ae3a8 |
(cherry picked from commit c75203c8d343dc71d95144862bbb47290689c455)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
tests/qemu-iotests/group
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
tests/qemu-iotests/087 | 122 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
9ae3a8 |
tests/qemu-iotests/087.out | 40 +++++++++++++++
|
|
|
9ae3a8 |
tests/qemu-iotests/group | 1 +
|
|
|
9ae3a8 |
3 files changed, 163 insertions(+)
|
|
|
9ae3a8 |
create mode 100755 tests/qemu-iotests/087
|
|
|
9ae3a8 |
create mode 100644 tests/qemu-iotests/087.out
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
|
|
|
9ae3a8 |
new file mode 100755
|
|
|
9ae3a8 |
index 0000000..53b6c43
|
|
|
9ae3a8 |
--- /dev/null
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/087
|
|
|
9ae3a8 |
@@ -0,0 +1,122 @@
|
|
|
9ae3a8 |
+#!/bin/bash
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Test unsupported blockdev-add cases
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# Copyright (C) 2014 Red Hat, Inc.
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
9ae3a8 |
+# it under the terms of the GNU General Public License as published by
|
|
|
9ae3a8 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
9ae3a8 |
+# (at your option) any later version.
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# This program is distributed in the hope that it will be useful,
|
|
|
9ae3a8 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9ae3a8 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
9ae3a8 |
+# GNU General Public License for more details.
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+# You should have received a copy of the GNU General Public License
|
|
|
9ae3a8 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9ae3a8 |
+#
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+# creator
|
|
|
9ae3a8 |
+owner=kwolf@redhat.com
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+seq=`basename $0`
|
|
|
9ae3a8 |
+echo "QA output created by $seq"
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+here=`pwd`
|
|
|
9ae3a8 |
+tmp=/tmp/$$
|
|
|
9ae3a8 |
+status=1 # failure is the default!
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+# get standard environment, filters and checks
|
|
|
9ae3a8 |
+. ./common.rc
|
|
|
9ae3a8 |
+. ./common.filter
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+_supported_fmt qcow2
|
|
|
9ae3a8 |
+_supported_proto file
|
|
|
9ae3a8 |
+_supported_os Linux
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+function do_run_qemu()
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ echo Testing: "$@"
|
|
|
9ae3a8 |
+ $QEMU -nographic -qmp stdio -serial none "$@"
|
|
|
9ae3a8 |
+ echo
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+function run_qemu()
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g'
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+size=128M
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+_make_test_img $size
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+echo === Missing ID ===
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+run_qemu <
|
|
|
9ae3a8 |
+{ "execute": "qmp_capabilities" }
|
|
|
9ae3a8 |
+{ "execute": "blockdev-add",
|
|
|
9ae3a8 |
+ "arguments": {
|
|
|
9ae3a8 |
+ "options": {
|
|
|
9ae3a8 |
+ "driver": "$IMGFMT",
|
|
|
9ae3a8 |
+ "file": {
|
|
|
9ae3a8 |
+ "driver": "file",
|
|
|
9ae3a8 |
+ "filename": "$TEST_IMG"
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+{ "execute": "quit" }
|
|
|
9ae3a8 |
+EOF
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+echo === aio=native without O_DIRECT ===
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+run_qemu <
|
|
|
9ae3a8 |
+{ "execute": "qmp_capabilities" }
|
|
|
9ae3a8 |
+{ "execute": "blockdev-add",
|
|
|
9ae3a8 |
+ "arguments": {
|
|
|
9ae3a8 |
+ "options": {
|
|
|
9ae3a8 |
+ "driver": "$IMGFMT",
|
|
|
9ae3a8 |
+ "id": "disk",
|
|
|
9ae3a8 |
+ "aio": "native",
|
|
|
9ae3a8 |
+ "file": {
|
|
|
9ae3a8 |
+ "driver": "file",
|
|
|
9ae3a8 |
+ "filename": "$TEST_IMG"
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+{ "execute": "quit" }
|
|
|
9ae3a8 |
+EOF
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+echo === Encrypted image ===
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+_make_test_img -o encryption=on $size
|
|
|
9ae3a8 |
+run_qemu <
|
|
|
9ae3a8 |
+{ "execute": "qmp_capabilities" }
|
|
|
9ae3a8 |
+{ "execute": "blockdev-add",
|
|
|
9ae3a8 |
+ "arguments": {
|
|
|
9ae3a8 |
+ "options": {
|
|
|
9ae3a8 |
+ "driver": "$IMGFMT",
|
|
|
9ae3a8 |
+ "id": "disk",
|
|
|
9ae3a8 |
+ "file": {
|
|
|
9ae3a8 |
+ "driver": "file",
|
|
|
9ae3a8 |
+ "filename": "$TEST_IMG"
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+{ "execute": "quit" }
|
|
|
9ae3a8 |
+EOF
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+# success, all done
|
|
|
9ae3a8 |
+echo "*** done"
|
|
|
9ae3a8 |
+rm -f $seq.full
|
|
|
9ae3a8 |
+status=0
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
|
|
|
9ae3a8 |
new file mode 100644
|
|
|
9ae3a8 |
index 0000000..b871032
|
|
|
9ae3a8 |
--- /dev/null
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/087.out
|
|
|
9ae3a8 |
@@ -0,0 +1,40 @@
|
|
|
9ae3a8 |
+QA output created by 087
|
|
|
9ae3a8 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+=== Missing ID ===
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+Testing:
|
|
|
9ae3a8 |
+QMP_VERSION
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"error": {"class": "GenericError", "desc": "Block device needs an ID"}}
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+=== aio=native without O_DIRECT ===
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+Testing:
|
|
|
9ae3a8 |
+QMP_VERSION
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"error": {"class": "GenericError", "desc": "aio=native requires cache.direct=true"}}
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+=== Encrypted image ===
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encryption=on
|
|
|
9ae3a8 |
+Testing:
|
|
|
9ae3a8 |
+QMP_VERSION
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"error": {"class": "GenericError", "desc": "blockdev-add doesn't support encrypted devices"}}
|
|
|
9ae3a8 |
+{"return": {}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
|
|
|
9ae3a8 |
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "floppy0", "tray-open": true}}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+*** done
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
|
|
9ae3a8 |
index e588404..3fad61d 100644
|
|
|
9ae3a8 |
--- a/tests/qemu-iotests/group
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/group
|
|
|
9ae3a8 |
@@ -81,5 +81,6 @@
|
|
|
9ae3a8 |
082 rw auto quick
|
|
|
9ae3a8 |
084 img auto
|
|
|
9ae3a8 |
086 rw auto quick
|
|
|
9ae3a8 |
+087 rw auto quick
|
|
|
9ae3a8 |
088 rw auto
|
|
|
9ae3a8 |
092 rw auto quick
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|