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

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