From nobody Mon Feb 9 12:24:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594068022; cv=none; d=zohomail.com; s=zohoarc; b=eJj6mom/66OYmzsc0rj3RM3mHjSbAPCdpOaYF/ZHNuKEM8DIAly3rdVp++POebYsjJK7q9DN4FcfYRyV0N73EeBczHVuXql5sTvoXmIPW3VbPVmYshkCBEmiXcMcSwXcjRbm8LNwzyFxEwJLd6/AJ+p5TnV9M36HxiVVLeMCqpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594068022; 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=dNzyunD+pXhvAn7yN59D05TDaVZOw7qKdTybXGhF/gE=; b=VYseHw9GI0CiCOuLdCf7KFe9UodOSe4oAcA2BYKqdpxBNEV2adlx0H/cUSvw5rV7ScNJ/X9+On8Uq4JdJOHc90BhlJySwNdU2x5woEaoCdc5tDCPd4WplPfMsrlFHfmjs8GxJOAeRh5N8s6zpUknVobvKeGv2bQk9IyR1ZwW5zc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159406802287935.366569035985094; Mon, 6 Jul 2020 13:40:22 -0700 (PDT) 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-498-NiHZpaqMNRyqIzA2zpTPcw-1; Mon, 06 Jul 2020 16:40:19 -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 356E11902EA0; Mon, 6 Jul 2020 20:40:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17CAD5C298; Mon, 6 Jul 2020 20:40:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D73171809563; Mon, 6 Jul 2020 20:40:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 066KeBsF005169 for ; Mon, 6 Jul 2020 16:40:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE5CB7B41C; Mon, 6 Jul 2020 20:40:11 +0000 (UTC) Received: from blue.redhat.com (ovpn-113-97.phx2.redhat.com [10.3.113.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72D3F7B400; Mon, 6 Jul 2020 20:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594068021; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dNzyunD+pXhvAn7yN59D05TDaVZOw7qKdTybXGhF/gE=; b=ewjseLPNcMH2FX9vfm7j49mD2GDpA57fui55vEXVWRiMVM+jTkNBDhnDtSMremTcFob6ua MjUBbm8i07rRjJ+LNCdAdSQq4MyMJA5VuiNDh7GicHWgeNq+WjvZooQeXUC7fMF6jtVlqW 3rOGnehTl8NL7M9ES+t4pkut4nuvQlU= X-MC-Unique: NiHZpaqMNRyqIzA2zpTPcw-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v6 03/10] sheepdog: Add trivial backing_fmt support Date: Mon, 6 Jul 2020 15:39:47 -0500 Message-Id: <20200706203954.341758-4-eblake@redhat.com> In-Reply-To: <20200706203954.341758-1-eblake@redhat.com> References: <20200706203954.341758-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, pkrempa@redhat.com, "open list:Sheepdog" , qemu-block@nongnu.org, libvir-list@redhat.com, Michael Tokarev , Laurent Vivier , mreitz@redhat.com, "open list:Trivial patches" , Liu Yuan X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 27a30d17f4c9..548ce54cbc7e 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2157,13 +2157,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"); @@ -2228,6 +2236,7 @@ fail: qapi_free_BlockdevCreateOptions(create_options); qobject_unref(qdict); g_free(redundancy); + g_free(backing_fmt); return ret; } @@ -3185,6 +3194,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.27.0