From nobody Sat Feb 7 06:40:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1594068025; cv=none; d=zohomail.com; s=zohoarc; b=kjRq9T3sXIFqtBEwKmx+QeXmJwZCjtqsXKoTSvbRKuDhw/FiV25zQ/gkDYP/vNOC2NjGQ92fK/vzeTDaw4MGKPqjys9e/L2pOesT8E8XQCx7wh0Clvlj3y+3q883HxuzNpQswv5IC0vJB6Q245bWpEs+FNpzYi0s0VaboO/B39Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594068025; 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=/EPqpSgUt6DDbkbtCknxzu7tgVde2nJvZJCDkg/HX0w=; b=iww2ScrVu9c8QesdJ3NfBToUTkowItKVqBz0vSFbu3t96O15RA9sx+w1MpV+Fla1lmM2Z/IY0GYvUA6KKgqzOoKPNKaLnPIHnohnI9yOD3V8g60Z/wkmP7uJWO35BF7XqykJIe9rcXsZImkVVnusChyzAMTB9DgXlsBSC2Oh6pw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594068025929590.9639785546062; Mon, 6 Jul 2020 13:40:25 -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-382-5mHoevQaOt6387_mdwNr3g-1; Mon, 06 Jul 2020 16:40:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B65C1902EAD; Mon, 6 Jul 2020 20:40:17 +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 0DF647890F; Mon, 6 Jul 2020 20:40:17 +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 D2FF41806B0D; Mon, 6 Jul 2020 20:40:16 +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 066KeC9v005176 for ; Mon, 6 Jul 2020 16:40:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id B75057B41F; Mon, 6 Jul 2020 20:40:12 +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 DEE697B419; Mon, 6 Jul 2020 20:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594068024; 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=/EPqpSgUt6DDbkbtCknxzu7tgVde2nJvZJCDkg/HX0w=; b=LpPEBilomCamNDIgFmRRhnP9eG39sFR33vvR26ZT3pEnp6z4x5vZMd/QUnOB7nHdiKrrM/ M/qtj6ti+NsCPhwJfNAvDc3OSy6kz/p8ixa4Chrq9144of22PiRnXfQ9PPHEe/jvkesPR6 XkkAXIYZgc3ZnpgELk9GXJL1UOY1Vqo= X-MC-Unique: 5mHoevQaOt6387_mdwNr3g-1 From: Eric Blake To: qemu-devel@nongnu.org Subject: [PATCH v6 04/10] vmdk: Add trivial backing_fmt support Date: Mon, 6 Jul 2020 15:39:48 -0500 Message-Id: <20200706203954.341758-5-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, Fam Zheng , pkrempa@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, Michael Tokarev , Laurent Vivier , mreitz@redhat.com, "open list:Trivial patches" 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.15 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" vmdk already requires that if backing_file is present, that it be another vmdk image (see vmdk_co_do_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 vmdk 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/vmdk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/block/vmdk.c b/block/vmdk.c index 62da4651263b..6c58e5ec2e43 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2638,6 +2638,14 @@ static int coroutine_fn vmdk_co_create_opts(BlockDri= ver *drv, bool zeroed_grain; bool compat6; VMDKCreateOptsData data; + char *backing_fmt =3D NULL; + + backing_fmt =3D qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT); + if (backing_fmt && strcmp(backing_fmt, "vmdk") !=3D 0) { + error_setg(errp, "backing_file must be a vmdk image"); + ret =3D -EINVAL; + goto exit; + } if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp= )) { ret =3D -EINVAL; @@ -2696,6 +2704,7 @@ static int coroutine_fn vmdk_co_create_opts(BlockDriv= er *drv, vmdk_co_create_opts_cb, &data, errp); exit: + g_free(backing_fmt); g_free(adapter_type); g_free(backing_file); g_free(hw_version); @@ -3031,6 +3040,11 @@ static QemuOptsList vmdk_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 'vmdk' if present", + }, { .name =3D BLOCK_OPT_COMPAT6, .type =3D QEMU_OPT_BOOL, --=20 2.27.0