From nobody Mon Feb 9 09:33:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1584041327; cv=none; d=zohomail.com; s=zohoarc; b=GeSLUwvDLCX57vFB3v3fDRnYKntC0RD99RMe12+ymY/PxGsDZVZp0Hq8F59p/IDwydBcnqj9IlPMCeXyefWBp0cjtPzQTr8dVS+p7HuDWcRV3s5qv/hORUZhipJQZboHRGNhgVc8F5iw3BXxlplT6d27Jt/v5+VoePfetk2xNM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584041327; 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=OmtK5I7dZ+qRFL1n9MbERx53nrOlbYxLc9ckSTE2AwY=; b=Bzka1lW9TvSYpqOdslTWzPT05LQIAcYd0/RMR2DT3Uznk936lcJHiBU9Iv8Ii9e/dmYarFM+ruGLYJP0jslGAbPJWT2qEqiaUaNyWhxSfe/4LbQ5pMGA2Q5HbndI1go9MlJWThJ6GQSx1IJ6v7PZHz14aaGjLGjuOs+w+eB42A4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1584041327672633.6819679531413; Thu, 12 Mar 2020 12:28:47 -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-465-AeTOeHW9OIKTJJMhKuhDEQ-1; Thu, 12 Mar 2020 15:28:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93DC38010EF; Thu, 12 Mar 2020 19:28:37 +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 5C81F8AC4D; Thu, 12 Mar 2020 19:28:37 +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 64EFD18089CF; Thu, 12 Mar 2020 19:28:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02CJSWQX003408 for ; Thu, 12 Mar 2020 15:28:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AC605DA82; Thu, 12 Mar 2020 19:28:32 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-177.phx2.redhat.com [10.3.116.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id D52D65DA76; Thu, 12 Mar 2020 19:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584041326; 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=OmtK5I7dZ+qRFL1n9MbERx53nrOlbYxLc9ckSTE2AwY=; b=eHNyJY3Yr41+SuXmDtmtT/luxRzjiL2A1gV6x4tO3KaUS/FW4nZszPHaS1VbpKvGfZwTIa yvH0h0dhMkbXrSLvwBE6/taoNRRsBmKD2znOp48OVNrfVrRVzeczkV0XfrOuTuSA7fc5P0 Xyv2mfk1T3GaaYDnavM7sjrPPI5advg= X-MC-Unique: AeTOeHW9OIKTJJMhKuhDEQ-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v4 1/7] sheepdog: Add trivial backing_fmt support Date: Thu, 12 Mar 2020 14:28:16 -0500 Message-Id: <20200312192822.3739399-2-eblake@redhat.com> In-Reply-To: <20200312192822.3739399-1-eblake@redhat.com> References: <20200312192822.3739399-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.11 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index cfa84338a2d6..376f4ef74638 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2166,8 +2166,16 @@ static int coroutine_fn sd_co_create_opts(const char= *filename, QemuOpts *opts, char *redundancy; 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"); @@ -2232,6 +2240,7 @@ fail: qapi_free_BlockdevCreateOptions(create_options); qobject_unref(qdict); g_free(redundancy); + g_free(backing_fmt); return ret; } @@ -3189,6 +3198,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.25.1