From patchwork Tue Sep 11 22:32:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 10596421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 110DC14E0 for ; Tue, 11 Sep 2018 22:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0238329DDD for ; Tue, 11 Sep 2018 22:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAACC29DEA; Tue, 11 Sep 2018 22:34:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B2EE29DDD for ; Tue, 11 Sep 2018 22:34:49 +0000 (UTC) Received: from localhost ([::1]:59815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzrFA-00029e-PX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 11 Sep 2018 18:34:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzrDS-0004oL-OJ for qemu-devel@nongnu.org; Tue, 11 Sep 2018 18:33:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzrDR-0006pL-Dm for qemu-devel@nongnu.org; Tue, 11 Sep 2018 18:33:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45670) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fzrDG-0006gi-VL; Tue, 11 Sep 2018 18:32:51 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E6AE3002399; Tue, 11 Sep 2018 22:32:49 +0000 (UTC) Received: from localhost (ovpn-116-183.phx2.redhat.com [10.3.116.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C03186B95; Tue, 11 Sep 2018 22:32:49 +0000 (UTC) From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 11 Sep 2018 18:32:32 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 11 Sep 2018 22:32:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 3/4] block/rbd: add iotest for rbd legacy keyvalue filename parsing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jsnow@redhat.com, qemu-stable@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is a small test that will check for the ability to parse both legacy and modern options for rbd. The way the test is set up is for failure to occur, but without having to wait to timeout on a non-existent rbd server. The error messages in the success path show that the arguments were parsed. The failure behavior prior to the patch series that has this test, is qemu-img complaining about mandatory options (e.g. 'pool') not being provided. Reviewed-by: Eric Blake Signed-off-by: Jeff Cody --- tests/qemu-iotests/231 | 62 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/231.out | 9 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 72 insertions(+) create mode 100755 tests/qemu-iotests/231 create mode 100644 tests/qemu-iotests/231.out diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231 new file mode 100755 index 0000000000..3e283708b4 --- /dev/null +++ b/tests/qemu-iotests/231 @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Test legacy and modern option parsing for rbd/ceph. This will not +# actually connect to a ceph server, but rather looks for the appropriate +# error message that indicates we parsed the options correctly. +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=jcody@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +status=1 # failure is the default! + +_cleanup() +{ + rm "${BOGUS_CONF}" +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt generic +_supported_proto rbd +_supported_os Linux + +BOGUS_CONF=${TEST_DIR}/ceph-$$.conf +touch "${BOGUS_CONF}" + +_filter_conf() +{ + sed -e "s#$BOGUS_CONF#BOGUS_CONF#g" +} + +# We expect this to fail, with no monitor ip provided and a null conf file. Just want it +# to fail in the right way. +$QEMU_IMG info "json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=${BOGUS_CONF}'}" 2>&1 | _filter_conf +$QEMU_IMG info "json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'${BOGUS_CONF}'}" 2>&1 | _filter_conf + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/231.out b/tests/qemu-iotests/231.out new file mode 100644 index 0000000000..579ba11c16 --- /dev/null +++ b/tests/qemu-iotests/231.out @@ -0,0 +1,9 @@ +QA output created by 231 +qemu-img: RBD options encoded in the filename as keyvalue pairs is deprecated. Future versions may cease to parse these options in the future. +unable to get monitor info from DNS SRV with service name: ceph-mon +no monitors specified to connect to. +qemu-img: Could not open 'json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=BOGUS_CONF'}': error connecting: No such file or directory +unable to get monitor info from DNS SRV with service name: ceph-mon +no monitors specified to connect to. +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 +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 743790745b..31f6e77dcb 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -226,3 +226,4 @@ 226 auto quick 227 auto quick 229 auto quick +231 auto quick