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

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