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

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