From nobody Mon Feb 9 00:56:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1584987171; cv=none; d=zohomail.com; s=zohoarc; b=NyrXFCmITaCLsA6SHjUwqjZCkumK3vWAJ/BYc76Vb4QjpkC6M3EeyHNGaPsEs0BJc2H/r3C/EtGgYriv1P7mZyMZ5Nl1rzaBFuY0a5uhofZz/cvLF13KA9P8Y9A2GBaPw1xTQBHT15DPk/E+TYrZnc4HkFyW7c85o3k2MkmrR/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584987171; h=Content-Type:Content-Transfer-Encoding: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=ltDIuSlM+fyp5jdjWIrpfWCsTZSRL33hdTKGvrfehd4=; b=GkZIN8H0qqjqWIYFYYSIDc5a5hKZaIM6ms1V3kNCMph5AP0Eh2mUvh6BZqZOGDXgnzTWkccHqbWwtDy+QQOZcSOYpJ3bwNGwMfIC+4pLx07zjZpQ7WwF6vXVVZLn/x/xrT13b9+GkZ3yG7QLswr4eox1m+SgN5rxO2NgtBAnxFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1584987171551386.41175906473586; Mon, 23 Mar 2020 11:12:51 -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-111-M-MGBHlLPBCgQImR55Pz-w-1; Mon, 23 Mar 2020 14:12:48 -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 469021922965; Mon, 23 Mar 2020 18:12:42 +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 1DE8A5C1BB; Mon, 23 Mar 2020 18:12:42 +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 CBB601803C41; Mon, 23 Mar 2020 18:12:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02NICIQT009522 for ; Mon, 23 Mar 2020 14:12:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 60E568D574; Mon, 23 Mar 2020 18:12:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBC89A0A60 for ; Mon, 23 Mar 2020 18:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584987170; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ltDIuSlM+fyp5jdjWIrpfWCsTZSRL33hdTKGvrfehd4=; b=fBvCwW/3hG2+UITXpym4X2jrddN1d63vACs5JwNFnaPDJX3ARWO6Id8ofVPCQjjoTpUbNO dv6u10bJ3iGWkOKGBxb3AHmMziRk8sZHf0F2m/F1wBhbnQaaE+9BGeV4X3aHFuMMaMqohS ZMBGHCuU12a9TaAQ85MldcUhyOzr9DY= X-MC-Unique: M-MGBHlLPBCgQImR55Pz-w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/14] qemuBlockGetBackingStoreString: Add extra wrapping object to JSON strings Date: Mon, 23 Mar 2020 19:12:01 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 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" QEMU requires an extra wrapper object where only the "file" member is populated. This is basically a placeholder for establishing the format layer. We did the same in qemuDiskSourceGetProps for the old-school JSON usage with -drive but forgot to adopt this for -blockdev. https://bugzilla.redhat.com/show_bug.cgi?id=3D1804617 Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 2 +- .../imagecreate/qcow2-backing-qcow2-slice.json | 2 +- .../qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json | 2 +- .../network-qcow2-backing-chain-cache-unsafe-srconly.json | 3 ++- .../network-qcow2-backing-chain-encryption_auth-srconly.json | 3 ++- tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a44cfeb99c..3365ee677b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2104,7 +2104,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr sr= c, if (!(backingJSON =3D virJSONValueToString(props, pretty))) return NULL; - return g_strdup_printf("json:%s", backingJSON); + return g_strdup_printf("json:{\"file\":%s}", backingJSON); } diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.= json b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json index 2fa27c1933..2526740b9a 100644 --- a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json @@ -10,6 +10,6 @@ format: "driver": "qcow2", "file": "0123456789ABCDEF0123456789ABCDE", "size": 8589934590, - "backing-file": "json:{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,= \"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow= 2\"}}", + "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":1234,\"si= ze\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/ima= ges/i.qcow2\"}}}", "backing-fmt": "qcow2" } diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.js= on b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json index 761002afd9..e76221da16 100644 --- a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json @@ -10,6 +10,6 @@ format: "driver": "qcow2", "file": "0123456789ABCDEF0123456789ABCDE", "size": 8589934590, - "backing-file": "json:{\"driver\":\"raw\",\"offset\":9876,\"size\":54321= ,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img= \"}}", + "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":9876,\"si= ze\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/im= ages/i.img\"}}}", "backing-fmt": "raw" } diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-c= ache-unsafe-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow2-b= acking-chain-cache-unsafe-srconly.json index 2d7eeb3bca..0fb0b8eff9 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe-srconly.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe-srconly.json @@ -16,7 +16,7 @@ ] } backing store string: - json:{ + json:{"file":{ "driver": "rbd", "pool": "rbdpool", "image": "rbdimg", @@ -31,6 +31,7 @@ } ] } + } ) ( source only properties: diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-e= ncryption_auth-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow= 2-backing-chain-encryption_auth-srconly.json index 5679318fbe..777a372471 100644 --- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth-srconly.json +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth-srconly.json @@ -16,7 +16,7 @@ ] } backing store string: - json:{ + json:{"file":{ "driver": "rbd", "pool": "rbdpool", "image": "rbdimg", @@ -31,6 +31,7 @@ } ] } + } ) ( source only properties: diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json = b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json index 970e1bb8af..26f9557c80 100644 --- a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json +++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json @@ -6,9 +6,10 @@ "namespace": 1 } backing store string: - json:{ + json:{"file":{ "driver": "nvme", "device": "0000:01:00.0", "namespace": 1 } + } ) --=20 2.24.1