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