From nobody Mon Feb 9 05:20:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498568137922914.3406291131203; Tue, 27 Jun 2017 05:55:37 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id E966A7D0FF; Tue, 27 Jun 2017 12:55:35 +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 C312F87F96; Tue, 27 Jun 2017 12:55:35 +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 55C691853E34; Tue, 27 Jun 2017 12:55:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5RClVkO023859 for ; Tue, 27 Jun 2017 08:47:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id C60ED8A768; Tue, 27 Jun 2017 12:47:31 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id D05A48A791; Tue, 27 Jun 2017 12:47:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E966A7D0FF Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E966A7D0FF From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 27 Jun 2017 14:46:49 +0200 Message-Id: <747b9b83feacd16ce25a099668e799740888c99a.1498567512.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 8/9] util: storage: Always deflatten JSON pseudo-protocol objects 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 27 Jun 2017 12:55:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that the JSON deflattener is working sanely we can always attempt the deflattening so that we can then parse the tree as expected. Reviewed-by: John Ferlan --- src/util/virstoragefile.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index d24502fbf..f3dc860ae 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3249,24 +3249,22 @@ static int virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src, virJSONValuePtr json) { - virJSONValuePtr fixedroot =3D NULL; + virJSONValuePtr deflattened =3D NULL; virJSONValuePtr file; const char *drvname; char *str =3D NULL; size_t i; int ret =3D -1; - if (!(file =3D virJSONValueObjectGetObject(json, "file"))) { - if (!(fixedroot =3D virJSONValueObjectDeflatten(json))) - goto cleanup; + if (!(deflattened =3D virJSONValueObjectDeflatten(json))) + goto cleanup; - if (!(file =3D virJSONValueObjectGetObject(fixedroot, "file"))) { - str =3D virJSONValueToString(json, false); - virReportError(VIR_ERR_INVALID_ARG, - _("JSON backing volume defintion '%s' lacks 'file' object"= ), - str); - goto cleanup; - } + if (!(file =3D virJSONValueObjectGetObject(deflattened, "file"))) { + str =3D virJSONValueToString(json, false); + virReportError(VIR_ERR_INVALID_ARG, + _("JSON backing volume defintion '%s' lacks 'file' object"), + str); + goto cleanup; } if (!(drvname =3D virJSONValueObjectGetString(file, "driver"))) { @@ -3290,7 +3288,7 @@ virStorageSourceParseBackingJSONInternal(virStorageSo= urcePtr src, cleanup: VIR_FREE(str); - virJSONValueFree(fixedroot); + virJSONValueFree(deflattened); return ret; } --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list