From nobody Sun Feb 8 22:06:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585936931; cv=none; d=zohomail.com; s=zohoarc; b=lrvCvb6SPPF1vyIRbAemFMvVWuwOOQeNeVdPN+nVb/dGnUIhyhLzpYINLLrRX7SgL8EhQZ3S8B0q9DCkZ3Usvuuhh/ozYXoF9B9XEXAc94b48GGlIfMRX5uMck2VBOOKMoaSxQ4eAErbO4VuCYgi6oc7jC4V91MrhIhkiFkuc1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585936931; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ow8fHVhdF5XdDD9HXHcAMKy9dd3Xe7mid7JBL1s9T2Y=; b=Yzt+DPZcyhGcgrRAEOPTJlC8pplopPkuA4MnxRrfi1JRZV2Jt55IzkFYf/KN74JJ8x8CKd6qPIcH9a4wkix1EwHhzdPrUW1CJHy2uv4Te1GHmq58Q6rYO+PSmZ25hsPVuYqEVxUeJJZPFKQMWbRizFRywW0jUQH1hCbN8/0I6PE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585936931295637.7060381314716; Fri, 3 Apr 2020 11:02:11 -0700 (PDT) Received: from localhost ([::1]:59240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKQdt-0001cw-Sr for importer@patchew.org; Fri, 03 Apr 2020 14:02:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKQbS-00082Y-If for qemu-devel@nongnu.org; Fri, 03 Apr 2020 13:59:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKQbR-0007Wl-Fg for qemu-devel@nongnu.org; Fri, 03 Apr 2020 13:59:38 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56799 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKQbR-0007Vp-Br for qemu-devel@nongnu.org; Fri, 03 Apr 2020 13:59:37 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-u0b58hJkPs2nQclaNpvbgw-1; Fri, 03 Apr 2020 13:59:33 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63CD2107ACC4; Fri, 3 Apr 2020 17:59:30 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-246.phx2.redhat.com [10.3.113.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9463B5C1BE; Fri, 3 Apr 2020 17:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585936777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ow8fHVhdF5XdDD9HXHcAMKy9dd3Xe7mid7JBL1s9T2Y=; b=MlDTUvzQZqB7jtpxWnSc+urHZaGqUOFaDcDst0UlhUPCvCQ6uItXpRmIJLOW9vwsTduSSm FBZeA4GCEyg7aCtuiuMC4ynpLhjFbq21WTp10Aa58p5fBZqy5XBA2y/iygKW/Wh3KItxwK P0rkv/IGlroZpdi1JooPua4kmQEuadE= X-MC-Unique: u0b58hJkPs2nQclaNpvbgw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v5 1/7] sheepdog: Add trivial backing_fmt support Date: Fri, 3 Apr 2020 12:58:53 -0500 Message-Id: <20200403175859.863248-2-eblake@redhat.com> In-Reply-To: <20200403175859.863248-1-eblake@redhat.com> References: <20200403175859.863248-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pkrempa@redhat.com, "open list:Sheepdog" , qemu-block@nongnu.org, kchamart@redhat.com, libvir-list@redhat.com, Michael Tokarev , Laurent Vivier , mreitz@redhat.com, "open list:Trivial patches" , Liu Yuan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Sheepdog already requires that if backing_file is present, that it be another sheepdog image (see sd_co_create). Meanwhile, we want to move towards always being explicit about the backing format for other drivers where it matters. So for convenience, make qemu-img create -F sheepdog work, while rejecting all other explicit formats (note that this is only for QemuOpts usage; there is no change to the QAPI to allow a format through -blockdev). Signed-off-by: Eric Blake --- block/sheepdog.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 59f7ebb1710f..8f558367d2d5 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2163,13 +2163,21 @@ static int coroutine_fn sd_co_create_opts(BlockDriv= er *drv, Error **errp) { BlockdevCreateOptions *create_options =3D NULL; - QDict *qdict, *location_qdict; + QDict *qdict =3D NULL, *location_qdict; Visitor *v; - char *redundancy; + char *redundancy =3D NULL; Error *local_err =3D NULL; int ret; + char *backing_fmt =3D NULL; redundancy =3D qemu_opt_get_del(opts, BLOCK_OPT_REDUNDANCY); + backing_fmt =3D qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT); + + if (backing_fmt && strcmp(backing_fmt, "sheepdog") !=3D 0) { + error_setg(errp, "backing_file must be a sheepdog image"); + ret =3D -EINVAL; + goto fail; + } qdict =3D qemu_opts_to_qdict(opts, NULL); qdict_put_str(qdict, "driver", "sheepdog"); @@ -2234,6 +2242,7 @@ fail: qapi_free_BlockdevCreateOptions(create_options); qobject_unref(qdict); g_free(redundancy); + g_free(backing_fmt); return ret; } @@ -3191,6 +3200,11 @@ static QemuOptsList sd_create_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "File name of a base image" }, + { + .name =3D BLOCK_OPT_BACKING_FMT, + .type =3D QEMU_OPT_STRING, + .help =3D "Must be 'sheepdog' if present", + }, { .name =3D BLOCK_OPT_PREALLOC, .type =3D QEMU_OPT_STRING, --=20 2.26.0.rc2