cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-rbd-add-iotest-for-rbd-legacy-keyvalue-filenam.patch

26ba25
From dba144d5f04b39a0c95c74d6084ec1015f8d09e7 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Wed, 10 Oct 2018 20:30:14 +0100
26ba25
Subject: [PATCH 4/4] block/rbd: add iotest for rbd legacy keyvalue filename
26ba25
 parsing
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20181010203015.11719-4-jsnow@redhat.com>
26ba25
Patchwork-id: 82628
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 3/4] block/rbd: add iotest for rbd legacy keyvalue filename parsing
26ba25
Bugzilla: 1635585
26ba25
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
26ba25
From: Jeff Cody <jcody@redhat.com>
26ba25
26ba25
This is a small test that will check for the ability to parse
26ba25
both legacy and modern options for rbd.
26ba25
26ba25
The way the test is set up is for failure to occur, but without
26ba25
having to wait to timeout on a non-existent rbd server.  The error
26ba25
messages in the success path show that the arguments were parsed.
26ba25
26ba25
The failure behavior prior to the patch series that has this test, is
26ba25
qemu-img complaining about mandatory options (e.g. 'pool') not being
26ba25
provided.
26ba25
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Signed-off-by: Jeff Cody <jcody@redhat.com>
26ba25
Message-id: f830580e339b974a83ed4870d11adcdc17f49a47.1536704901.git.jcody@redhat.com
26ba25
Signed-off-by: Jeff Cody <jcody@redhat.com>
26ba25
(cherry picked from commit 66e6a735e97450ac50fcaf40f78600c688534cae)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
26ba25
Conflicts:
26ba25
    tests/qemu-iotests/group: context (missing prior tests)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
---
26ba25
 tests/qemu-iotests/231     | 62 ++++++++++++++++++++++++++++++++++++++++++++++
26ba25
 tests/qemu-iotests/231.out |  9 +++++++
26ba25
 tests/qemu-iotests/group   |  1 +
26ba25
 3 files changed, 72 insertions(+)
26ba25
 create mode 100755 tests/qemu-iotests/231
26ba25
 create mode 100644 tests/qemu-iotests/231.out
26ba25
26ba25
diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231
26ba25
new file mode 100755
26ba25
index 0000000..3e28370
26ba25
--- /dev/null
26ba25
+++ b/tests/qemu-iotests/231
26ba25
@@ -0,0 +1,62 @@
26ba25
+#!/bin/bash
26ba25
+#
26ba25
+# Test legacy and modern option parsing for rbd/ceph.  This will not
26ba25
+# actually connect to a ceph server, but rather looks for the appropriate
26ba25
+# error message that indicates we parsed the options correctly.
26ba25
+#
26ba25
+# Copyright (C) 2018 Red Hat, Inc.
26ba25
+#
26ba25
+# This program is free software; you can redistribute it and/or modify
26ba25
+# it under the terms of the GNU General Public License as published by
26ba25
+# the Free Software Foundation; either version 2 of the License, or
26ba25
+# (at your option) any later version.
26ba25
+#
26ba25
+# This program is distributed in the hope that it will be useful,
26ba25
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
26ba25
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26ba25
+# GNU General Public License for more details.
26ba25
+#
26ba25
+# You should have received a copy of the GNU General Public License
26ba25
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
26ba25
+#
26ba25
+
26ba25
+# creator
26ba25
+owner=jcody@redhat.com
26ba25
+
26ba25
+seq=`basename $0`
26ba25
+echo "QA output created by $seq"
26ba25
+
26ba25
+here=`pwd`
26ba25
+status=1	# failure is the default!
26ba25
+
26ba25
+_cleanup()
26ba25
+{
26ba25
+    rm "${BOGUS_CONF}"
26ba25
+}
26ba25
+trap "_cleanup; exit \$status" 0 1 2 3 15
26ba25
+
26ba25
+# get standard environment, filters and checks
26ba25
+. ./common.rc
26ba25
+. ./common.filter
26ba25
+
26ba25
+_supported_fmt generic
26ba25
+_supported_proto rbd
26ba25
+_supported_os Linux
26ba25
+
26ba25
+BOGUS_CONF=${TEST_DIR}/ceph-$$.conf
26ba25
+touch "${BOGUS_CONF}"
26ba25
+
26ba25
+_filter_conf()
26ba25
+{
26ba25
+    sed -e "s#$BOGUS_CONF#BOGUS_CONF#g"
26ba25
+}
26ba25
+
26ba25
+# We expect this to fail, with no monitor ip provided and a null conf file.  Just want it
26ba25
+# to fail in the right way.
26ba25
+$QEMU_IMG info "json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=${BOGUS_CONF}'}" 2>&1 | _filter_conf
26ba25
+$QEMU_IMG info "json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'${BOGUS_CONF}'}" 2>&1 | _filter_conf
26ba25
+
26ba25
+# success, all done
26ba25
+echo "*** done"
26ba25
+rm -f $seq.full
26ba25
+status=0
26ba25
diff --git a/tests/qemu-iotests/231.out b/tests/qemu-iotests/231.out
26ba25
new file mode 100644
26ba25
index 0000000..579ba11
26ba25
--- /dev/null
26ba25
+++ b/tests/qemu-iotests/231.out
26ba25
@@ -0,0 +1,9 @@
26ba25
+QA output created by 231
26ba25
+qemu-img: RBD options encoded in the filename as keyvalue pairs is deprecated.  Future versions may cease to parse these options in the future.
26ba25
+unable to get monitor info from DNS SRV with service name: ceph-mon
26ba25
+no monitors specified to connect to.
26ba25
+qemu-img: Could not open 'json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=BOGUS_CONF'}': error connecting: No such file or directory
26ba25
+unable to get monitor info from DNS SRV with service name: ceph-mon
26ba25
+no monitors specified to connect to.
26ba25
+qemu-img: Could not open 'json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'BOGUS_CONF'}': error connecting: No such file or directory
26ba25
+*** done
26ba25
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
26ba25
index 1cb2ccb..303daa5 100644
26ba25
--- a/tests/qemu-iotests/group
26ba25
+++ b/tests/qemu-iotests/group
26ba25
@@ -223,3 +223,4 @@
26ba25
 223 rw auto quick
26ba25
 226 auto quick
26ba25
 229 auto quick
26ba25
+231 auto quick
26ba25
-- 
26ba25
1.8.3.1
26ba25