From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151540066714.6794331553912; Thu, 19 Apr 2018 08:25:40 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 517143133E93; Thu, 19 Apr 2018 15:25:38 +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 A865885462; Thu, 19 Apr 2018 15:25: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 A763F1805972; Thu, 19 Apr 2018 15:25:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPYWA021829 for ; Thu, 19 Apr 2018 11:25:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5149A84424; Thu, 19 Apr 2018 15:25:34 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 773226F9E8; Thu, 19 Apr 2018 15:25:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:24:58 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 01/30] storage: Properly track that backing chain members are readonly 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 19 Apr 2018 15:25:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Everything besides the top of the chain is readonly. Track this when parsing the XML and detecting the chain from the disk. Also fix the state when taking snapshots. All other cases where the top image is changed already preserve the readonly state from the original image. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 3 +++ src/qemu/qemu_driver.c | 3 +++ src/util/virstoragefile.c | 1 + 3 files changed, 7 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35666c1347..e2c10c7757 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8711,6 +8711,9 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctx= t, if (VIR_ALLOC(backingStore) < 0) goto cleanup; + /* backing store is always read-only */ + backingStore->readonly =3D true; + /* terminator does not have a type */ if (!(type =3D virXMLPropString(ctxt->node, "type"))) { VIR_STEAL_PTR(src->backingStore, backingStore); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5673d9fd8d..d5374541e0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14671,6 +14671,9 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnaps= hotDiskDataPtr dd, if (dd->initialized) virStorageFileDeinit(dd->src); + /* the old disk image is now readonly */ + dd->disk->src->readonly =3D true; + VIR_STEAL_PTR(dd->disk->src->relPath, dd->relPath); VIR_STEAL_PTR(dd->src->backingStore, dd->disk->src); VIR_STEAL_PTR(dd->disk->src, dd->src); diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 531540ac91..d6ad6e1d0f 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3425,6 +3425,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr pa= rent) if (virStorageSourceInitChainElement(ret, parent, true) < 0) goto error; + ret->readonly =3D true; ret->detected =3D true; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151547200554.0798942574348; Thu, 19 Apr 2018 08:25:47 -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 09EBB61B8F; Thu, 19 Apr 2018 15:25:45 +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 CF4EA7E31A; Thu, 19 Apr 2018 15:25:44 +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 700DD1800CAB; Thu, 19 Apr 2018 15:25:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPZvR021837 for ; Thu, 19 Apr 2018 11:25:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76E7284420; Thu, 19 Apr 2018 15:25:35 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F7186F9E8; Thu, 19 Apr 2018 15:25:34 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:24:59 +0200 Message-Id: <035b264ad8e7d4d08ddb5fefa40fef896349a529.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 02/30] qemu: domain: Format storage source node names into private data 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.39]); Thu, 19 Apr 2018 15:25:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Save and restore node names if we know them in the status XML so that we don't need to recalculate them or don't lose them in some cases. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e2a8450e2e..224b3b0478 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1934,6 +1934,9 @@ static int qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src) { + src->nodestorage =3D virXPathString("string(./nodename/@storage)", ctx= t); + src->nodeformat =3D virXPathString("string(./nodename/@format)", ctxt); + if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0) return -1; @@ -1945,6 +1948,15 @@ static int qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, virBufferPtr buf) { + if (src->nodestorage || src->nodeformat) { + virBufferAddLit(buf, "nodestorage) + virBufferAsprintf(buf, " storage=3D'%s'", src->nodestorage); + if (src->nodeformat) + virBufferAsprintf(buf, " format=3D'%s'", src->nodeformat); + virBufferAddLit(buf, "/>\n"); + } + if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0) return -1; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152415155136190.73180142740262; Thu, 19 Apr 2018 08:25:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE1753130660; Thu, 19 Apr 2018 15:25:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68EA989FAF; Thu, 19 Apr 2018 15:25:49 +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 F2BAD4CAA0; Thu, 19 Apr 2018 15:25:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPasA021848 for ; Thu, 19 Apr 2018 11:25:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id A64126F9E8; Thu, 19 Apr 2018 15:25:36 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C28C784424; Thu, 19 Apr 2018 15:25:35 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:00 +0200 Message-Id: <2b38ac2b1b9dce51b2e947e807d4f9cc8159a70f.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 03/30] util: storage: Add shadow copies of few disk properties to virStorageSource 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 19 Apr 2018 15:25:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Few things which are currently stored the virDomainDiskDef structure are actually relevant for the storage source as well. Add the fields with a note that they are just mirror of the values from the disk. Signed-off-by: Peter Krempa --- src/util/virstoragefile.c | 4 ++++ src/util/virstoragefile.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index d6ad6e1d0f..72584404da 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2042,6 +2042,10 @@ virStorageSourceCopy(const virStorageSource *src, ret->detected =3D src->detected; ret->debugLevel =3D src->debugLevel; ret->debug =3D src->debug; + ret->iomode =3D src->iomode; + ret->cachemode =3D src->cachemode; + ret->discard =3D src->discard; + ret->detect_zeroes =3D src->detect_zeroes; /* storage driver metadata are not copied */ ret->drv =3D NULL; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index d129e81978..b450da55ae 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -305,6 +305,14 @@ struct _virStorageSource { unsigned int debugLevel; bool debug; + + /* Libvirt currently stores the following properities in virDomainDisk= Def. + * These instances are currently just copies from the parent definitio= n and + * are not mapped back to the XML */ + int iomode; /* enum virDomainDiskIo */ + int cachemode; /* enum virDomainDiskCache */ + int discard; /* enum virDomainDiskDiscard */ + int detect_zeroes; /* enum virDomainDiskDetectZeroes */ }; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151564259927.7001274789257; Thu, 19 Apr 2018 08:26:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5E635F7B2; Thu, 19 Apr 2018 15:26:02 +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 5AFFC82AE5; Thu, 19 Apr 2018 15:26:02 +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 0708C1805971; Thu, 19 Apr 2018 15:26:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPbON021856 for ; Thu, 19 Apr 2018 11:25:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id D7D1D6F9E8; Thu, 19 Apr 2018 15:25:37 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0D0384422; Thu, 19 Apr 2018 15:25:36 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:01 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 04/30] qemu: domain: Carefuly transfer configuration from disk to storage source 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Apr 2018 15:26:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some properties don't make sense to be configured for every single layer of the backing chain, but to avoid needing to pass the disk structure we will copy them to the individual virStorageSource-s Zero detection is applied only for the top layer image, while caching and iomode for all layers. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 224b3b0478..288bdb86ad 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11833,6 +11833,9 @@ qemuDomainPrepareDiskSourceChain(virDomainDiskDefPt= r disk, if (!src) src =3D disk->src; + /* transfer properties valid only for the top level image */ + src->detect_zeroes =3D disk->detect_zeroes; + for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { if (n->type =3D=3D VIR_STORAGE_TYPE_NETWORK && n->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && @@ -11843,6 +11846,11 @@ qemuDomainPrepareDiskSourceChain(virDomainDiskDefP= tr disk, if (qemuDomainValidateStorageSource(n, qemuCaps) < 0) return -1; + + /* transfer properties valid for the full chain */ + n->iomode =3D disk->iomode; + n->cachemode =3D disk->cachemode; + n->discard =3D disk->discard; } return 0; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151556015811.0274800679155; Thu, 19 Apr 2018 08:25:56 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 44CC55D687; Thu, 19 Apr 2018 15:25:54 +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 13D515F731; Thu, 19 Apr 2018 15:25:54 +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 B0A46180610F; Thu, 19 Apr 2018 15:25:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPdtM021865 for ; Thu, 19 Apr 2018 11:25:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0241A6F9E8; Thu, 19 Apr 2018 15:25:39 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3117E84422; Thu, 19 Apr 2018 15:25:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:02 +0200 Message-Id: <8749034dad679637aaddc0019771bf5402690658.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 05/30] qemu: block: Extract formatting of props for 'file' backend 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Apr 2018 15:25:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 'file' backend in qemu supports few more options than the current implementation. Extract it so that changes don't pollute the code. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index c0cf6a95ad..e7bd6c909d 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -974,6 +974,18 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr = src) } +static virJSONValuePtr +qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src) +{ + virJSONValuePtr ret =3D NULL; + + ignore_value(virJSONValueObjectCreate(&ret, + "s:driver", "file", + "s:filename", src->path, NULL) <= 0); + return ret; +} + + /** * qemuBlockStorageSourceGetBackendProps: * @src: disk source @@ -991,9 +1003,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource= Ptr src) case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_DIR: - if (virJSONValueObjectCreate(&fileprops, - "s:driver", "file", - "s:filename", src->path, NULL) < 0) + if (!(fileprops =3D qemuBlockStorageSourceGetFileProps(src))) return NULL; break; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152415164429842.51832861910361; Thu, 19 Apr 2018 08:27:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CBDB761D20; Thu, 19 Apr 2018 15:27:22 +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 57AB58E14B; Thu, 19 Apr 2018 15:27:16 +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 1D66B181AC8F; Thu, 19 Apr 2018 15:27:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPeas021877 for ; Thu, 19 Apr 2018 11:25:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 247CA84422; Thu, 19 Apr 2018 15:25:40 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FA4284426; Thu, 19 Apr 2018 15:25:39 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:03 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 06/30] qemu: block: Handle iomode property for json 'file' driver 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 19 Apr 2018 15:27:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index e7bd6c909d..6cf41cf544 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -977,11 +977,17 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr= src) static virJSONValuePtr qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src) { + const char *iomode =3D NULL; virJSONValuePtr ret =3D NULL; + if (src->iomode !=3D VIR_DOMAIN_DISK_IO_DEFAULT) + iomode =3D virDomainDiskIoTypeToString(src->iomode); + ignore_value(virJSONValueObjectCreate(&ret, "s:driver", "file", - "s:filename", src->path, NULL) <= 0); + "s:filename", src->path, + "S:aio", iomode, + NULL) < 0); return ret; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151560923620.6780874450039; Thu, 19 Apr 2018 08:26:00 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 12E92C0587F6; Thu, 19 Apr 2018 15:25:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA64D84AC9; Thu, 19 Apr 2018 15:25:58 +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 577FB4CAA1; Thu, 19 Apr 2018 15:25:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPfHn021887 for ; Thu, 19 Apr 2018 11:25:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50CDC6F9E8; Thu, 19 Apr 2018 15:25:41 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77F0A84420; Thu, 19 Apr 2018 15:25:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:04 +0200 Message-Id: <4f4f9892acde875766ed745a1643e70200e91939.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 07/30] utils: storage: Mark that a virStorageSource is going to be used as a floppy 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 19 Apr 2018 15:25:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a flag denoting that a virStorageSource is going to be used as a floppy image. This will be useful in cases where the user passes in files which shall be exposed as an image to the guest. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 3 +++ src/util/virstoragefile.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 288bdb86ad..6d7ab4ff80 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11851,6 +11851,9 @@ qemuDomainPrepareDiskSourceChain(virDomainDiskDefPt= r disk, n->iomode =3D disk->iomode; n->cachemode =3D disk->cachemode; n->discard =3D disk->discard; + + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) + n->floppyimg =3D true; } return 0; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index b450da55ae..57d39f98c2 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -313,6 +313,9 @@ struct _virStorageSource { int cachemode; /* enum virDomainDiskCache */ int discard; /* enum virDomainDiskDiscard */ int detect_zeroes; /* enum virDomainDiskDetectZeroes */ + + bool floppyimg; /* set to true if the storage source is going to be us= ed + as a source for floppy drive */ }; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151569558521.4443834994255; Thu, 19 Apr 2018 08:26:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36EAF4E907; Thu, 19 Apr 2018 15:26:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F388482783; Thu, 19 Apr 2018 15:26:07 +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 835144CA97; Thu, 19 Apr 2018 15:26:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPgf6021897 for ; Thu, 19 Apr 2018 11:25:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D8C084425; Thu, 19 Apr 2018 15:25:42 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id A207384422; Thu, 19 Apr 2018 15:25:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:05 +0200 Message-Id: <507d89e9768a83f97fefa54ab95b60f194715f96.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 08/30] qemu: Move virtual FAT disk validation from command line builder 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 19 Apr 2018 15:26:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move it to the validation callback and make it more robust. This will also put the checks in the correct place to use with -blockdev. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 14 -------------- src/qemu/qemu_domain.c | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b666f3715f..6de2fc56d5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1512,20 +1512,6 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, /* for now the DIR based storage is handled by the magic FAT forma= t */ if (actualType =3D=3D VIR_STORAGE_TYPE_DIR) { - if (disk->src->format > 0 && - disk->src->format !=3D VIR_STORAGE_FILE_FAT) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk driver type for '%s'"), - virStorageFileFormatTypeToString(disk->src-= >format)); - goto cleanup; - } - - if (!disk->src->readonly) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot create virtual FAT disks in read-= write mode")); - goto cleanup; - } - virBufferAddLit(buf, "fat:"); if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6d7ab4ff80..8f240bd66d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4117,6 +4117,8 @@ static int qemuDomainValidateStorageSource(virStorageSourcePtr src, virQEMUCapsPtr qemuCaps) { + int actualType =3D virStorageSourceGetActualType(src); + if (src->format =3D=3D VIR_STORAGE_FILE_COW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'cow' storage format is not supported")); @@ -4146,6 +4148,29 @@ qemuDomainValidateStorageSource(virStorageSourcePtr = src, return -1; } + if (src->format =3D=3D VIR_STORAGE_FILE_FAT && + actualType !=3D VIR_STORAGE_TYPE_DIR) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("storage format 'fat' is supported only with 'dir= ' " + "storage type")); + return -1; + } + + if (actualType =3D=3D VIR_STORAGE_TYPE_DIR) { + if (src->format > 0 && + src->format !=3D VIR_STORAGE_FILE_FAT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("storage type 'dir' requires use of storage f= ormat 'fat'")); + return -1; + } + + if (!src->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtual FAT storage can't be accessed in rea= d-write mode")); + return -1; + } + } + return 0; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151564880521.0491495592331; Thu, 19 Apr 2018 08:26:04 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 707D1313066A; Thu, 19 Apr 2018 15:26:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12D8D8B37D; Thu, 19 Apr 2018 15:26:03 +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 BA2C84CAA4; Thu, 19 Apr 2018 15:26:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPhRo021910 for ; Thu, 19 Apr 2018 11:25:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id B0B5084422; Thu, 19 Apr 2018 15:25:43 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB92284420; Thu, 19 Apr 2018 15:25:42 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:06 +0200 Message-Id: <31587353004e95e053785b9128f451a693339b53.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 09/30] qemu: block: Add support for accessing directories via the 'vvfat' driver 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 19 Apr 2018 15:26:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Handle VIR_STORAGE_TYPE_DIR in qemuBlockStorageSourceGetBackendProps so that a 'vvfat' driver is used, which emulates a FAT filesystem containing the folders. qemu requires us to add it as a storage layer, since a 'raw' layer is usually put on top of it. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 6cf41cf544..516b006ce9 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -992,6 +992,25 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr= src) } +static virJSONValuePtr +qemuBlockStorageSourceGetVvfatProps(virStorageSourcePtr src) +{ + virJSONValuePtr ret =3D NULL; + + /* libvirt currently does not handle the following attributes: + * '*fat-type': 'int' + * '*label': 'str' + */ + ignore_value(virJSONValueObjectCreate(&ret, + "s:driver", "vvfat", + "s:dir", src->path, + "b:floppy", src->floppyimg, + "b:rw", !src->readonly, NULL)); + + return ret; +} + + /** * qemuBlockStorageSourceGetBackendProps: * @src: disk source @@ -1008,11 +1027,17 @@ qemuBlockStorageSourceGetBackendProps(virStorageSou= rcePtr src) switch ((virStorageType) actualType) { case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_FILE: - case VIR_STORAGE_TYPE_DIR: if (!(fileprops =3D qemuBlockStorageSourceGetFileProps(src))) return NULL; break; + case VIR_STORAGE_TYPE_DIR: + /* qemu handles directories by exposing them as a device with emul= ated + * FAT filesystem */ + if (!(fileprops =3D qemuBlockStorageSourceGetVvfatProps(src))) + return NULL; + break; + case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151574537425.5346665311596; Thu, 19 Apr 2018 08:26:14 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id C8EABC0587E6; Thu, 19 Apr 2018 15:26:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C8F084AE3; Thu, 19 Apr 2018 15:26:12 +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 51F844CAA6; Thu, 19 Apr 2018 15:26:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPikO021923 for ; Thu, 19 Apr 2018 11:25:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id D31F884420; Thu, 19 Apr 2018 15:25:44 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 064A384425; Thu, 19 Apr 2018 15:25:43 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:07 +0200 Message-Id: <29ddacf557d4b1518cca0204c6e23b82cea89b29.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 10/30] qemu: block: Propagate 'legacy' parameter when formatting disk backing 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 19 Apr 2018 15:26:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The gluster protocol in qemu uses two styles, one of which is legacy and not covered by the QAPI schema. To allow using of the new style in the blockdev-add code, add a parameter for qemuBlockStorageSourceGetBackendProps which will switch between the two modes. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 11 +++++++---- src/qemu/qemu_block.h | 3 ++- src/qemu/qemu_command.c | 2 +- tests/qemublocktest.c | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 516b006ce9..9057fe4f9a 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -655,13 +655,14 @@ qemuBlockStorageSourceBuildHostsJSONInetSocketAddress= (virStorageSourcePtr src) static virJSONValuePtr -qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) +qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src, + bool legacy) { virJSONValuePtr servers =3D NULL; virJSONValuePtr props =3D NULL; virJSONValuePtr ret =3D NULL; - if (!(servers =3D qemuBlockStorageSourceBuildHostsJSONSocketAddress(sr= c, true))) + if (!(servers =3D qemuBlockStorageSourceBuildHostsJSONSocketAddress(sr= c, legacy))) return NULL; /* { driver:"gluster", @@ -1014,12 +1015,14 @@ qemuBlockStorageSourceGetVvfatProps(virStorageSourc= ePtr src) /** * qemuBlockStorageSourceGetBackendProps: * @src: disk source + * @legacy: use legacy formatting of attributes (for -drive / old qemus) * * Creates a JSON object describing the underlying storage or protocol of a * storage source. Returns NULL on error and reports an appropriate error = message. */ virJSONValuePtr -qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src) +qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src, + bool legacy) { int actualType =3D virStorageSourceGetActualType(src); virJSONValuePtr fileprops =3D NULL; @@ -1046,7 +1049,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourc= ePtr src) case VIR_STORAGE_TYPE_NETWORK: switch ((virStorageNetProtocol) src->protocol) { case VIR_STORAGE_NET_PROTOCOL_GLUSTER: - if (!(fileprops =3D qemuBlockStorageSourceGetGlusterProps(src)= )) + if (!(fileprops =3D qemuBlockStorageSourceGetGlusterProps(src,= legacy))) return NULL; break; diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 45485733fc..0e674437f4 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -58,7 +58,8 @@ bool qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src); virJSONValuePtr -qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src); +qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src, + bool legacy); virURIPtr qemuBlockStorageSourceGetURI(virStorageSourcePtr src); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6de2fc56d5..6ca83b8383 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1450,7 +1450,7 @@ qemuDiskSourceGetProps(virStorageSourcePtr src) virJSONValuePtr props; virJSONValuePtr ret; - if (!(props =3D qemuBlockStorageSourceGetBackendProps(src))) + if (!(props =3D qemuBlockStorageSourceGetBackendProps(src, true))) return NULL; if (virJSONValueObjectCreate(&ret, "a:file", &props, NULL) < 0) { diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 99584c759c..bd628295ff 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -62,7 +62,7 @@ testBackingXMLjsonXML(const void *args) goto cleanup; } - if (!(backendprops =3D qemuBlockStorageSourceGetBackendProps(xmlsrc)))= { + if (!(backendprops =3D qemuBlockStorageSourceGetBackendProps(xmlsrc, t= rue))) { fprintf(stderr, "failed to format disk source json\n"); goto cleanup; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151569973598.1697853501549; Thu, 19 Apr 2018 08:26:09 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 97BA630001DC; Thu, 19 Apr 2018 15:26:08 +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 59CDC7E238; Thu, 19 Apr 2018 15:26:08 +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 06141180BAD8; Thu, 19 Apr 2018 15:26:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPk86021930 for ; Thu, 19 Apr 2018 11:25:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0233784425; Thu, 19 Apr 2018 15:25:46 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31ADD84422; Thu, 19 Apr 2018 15:25:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:08 +0200 Message-Id: <60ae74475da04ced7cba3816bcf4a5210a3876ef.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 11/30] qemu: block: Validate node-names for use with qemu 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 19 Apr 2018 15:26:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" qemu declares node-name as a 32 byte buffer and silently truncates anything longer than that. This is unacceptable for libvirt, so we need to make sure that we won't ever supply a node-name exceeding 31 chars. Add a function which will do the validation and use it to validate storage-protocol node names. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9057fe4f9a..cf6025ac7b 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -27,6 +27,24 @@ #define VIR_FROM_THIS VIR_FROM_QEMU +/* qemu declares the buffer for node names as a 32 byte array */ +static const size_t qemuBlockNodeNameBufSize =3D 32; + +static int +qemuBlockNodeNameValidate(const char *nn) +{ + if (!nn) + return 0; + + if (strlen(nn) >=3D qemuBlockNodeNameBufSize) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("node-name '%s' too long for qemu"), nn); + return -1; + } + + return 0; +} + static int qemuBlockNamedNodesArrayToHash(size_t pos ATTRIBUTE_UNUSED, @@ -1099,7 +1117,8 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourc= ePtr src, break; } - if (virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, = NULL) < 0) { + if (qemuBlockNodeNameValidate(src->nodestorage) < 0 || + virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, = NULL) < 0) { virJSONValueFree(fileprops); return NULL; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151575149188.73482334281596; Thu, 19 Apr 2018 08:26:15 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CA5C631500A9; Thu, 19 Apr 2018 15:26:13 +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 69D338BA2D; Thu, 19 Apr 2018 15:26:13 +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 06377180BAE5; Thu, 19 Apr 2018 15:26:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPl48021939 for ; Thu, 19 Apr 2018 11:25:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2706284424; Thu, 19 Apr 2018 15:25:47 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 510A56F9E8; Thu, 19 Apr 2018 15:25:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:09 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 12/30] qemu: block: Format cache modes for disk storage backends 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 19 Apr 2018 15:26:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When used directly with blockdev-add/-blockdev the cache mode will need to be specified directly for every image rather than just for the disk itself. This implements the backing options 'direct' and 'no-flush'. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index cf6025ac7b..eb246ebd60 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1030,6 +1030,35 @@ qemuBlockStorageSourceGetVvfatProps(virStorageSource= Ptr src) } +static int +qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSourcePtr src, + virJSONValuePtr props) +{ + virJSONValuePtr cacheobj; + bool direct =3D false; + bool noflush =3D false; + + if (src->cachemode =3D=3D VIR_DOMAIN_DISK_CACHE_DEFAULT) + return 0; + + if (qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflu= sh) < 0) + return -1; + + if (virJSONValueObjectCreate(&cacheobj, + "b:direct", direct, + "b:no-flush", noflush, + NULL) < 0) + return -1; + + if (virJSONValueObjectAppend(props, "cache", cacheobj) < 0) { + virJSONValueFree(cacheobj); + return -1; + } + + return 0; +} + + /** * qemuBlockStorageSourceGetBackendProps: * @src: disk source @@ -1044,6 +1073,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourc= ePtr src, { int actualType =3D virStorageSourceGetActualType(src); virJSONValuePtr fileprops =3D NULL; + virJSONValuePtr ret =3D NULL; switch ((virStorageType) actualType) { case VIR_STORAGE_TYPE_BLOCK: @@ -1118,10 +1148,17 @@ qemuBlockStorageSourceGetBackendProps(virStorageSou= rcePtr src, } if (qemuBlockNodeNameValidate(src->nodestorage) < 0 || - virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, = NULL) < 0) { - virJSONValueFree(fileprops); - return NULL; + virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, = NULL) < 0) + goto cleanup; + + if (!legacy) { + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops)= < 0) + goto cleanup; } - return fileprops; + VIR_STEAL_PTR(ret, fileprops); + + cleanup: + virJSONValueFree(fileprops); + return ret; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151579603182.20901074078665; Thu, 19 Apr 2018 08:26:19 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 04C59C058ED8; Thu, 19 Apr 2018 15:26:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA76F84AFC; Thu, 19 Apr 2018 15:26:16 +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 44BC74CAA9; Thu, 19 Apr 2018 15:26:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPm5v021951 for ; Thu, 19 Apr 2018 11:25:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 731B784424; Thu, 19 Apr 2018 15:25:48 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A15D6F9E8; Thu, 19 Apr 2018 15:25:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:10 +0200 Message-Id: <21bfe029eb0ae16f8d404f49d79591612ba94f1f.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 13/30] qemu: block: Format 'read-only' attribute for JSON disk protocol 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 19 Apr 2018 15:26:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will be required when doing blockdev-add to conform with the approach qemu would chose to create the disks. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index eb246ebd60..44662a4603 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1154,6 +1154,9 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourc= ePtr src, if (!legacy) { if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops)= < 0) goto cleanup; + + if (virJSONValueObjectAdd(fileprops, "b:read-only", src->readonly,= NULL) < 0) + goto cleanup; } VIR_STEAL_PTR(ret, fileprops); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151583859981.1263388627576; Thu, 19 Apr 2018 08:26:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98C9C1764DD; Thu, 19 Apr 2018 15:26:22 +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 4FDC782AC0; Thu, 19 Apr 2018 15:26:22 +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 D0AC4180BAEB; Thu, 19 Apr 2018 15:26:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPqJp021979 for ; Thu, 19 Apr 2018 11:25:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68F5984425; Thu, 19 Apr 2018 15:25:52 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E04484422; Thu, 19 Apr 2018 15:25:48 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:11 +0200 Message-Id: <57fddb651b0de0f59fae11178c2cd7ed6a818bde.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 14/30] [RFC] qemu: block: Always set discard for storage nodes 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 19 Apr 2018 15:26:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" According to my research it seems that qemu always sets discard for the storage nodes. Replicate this in our generator. --- src/qemu/qemu_block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 44662a4603..0357d93384 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1155,7 +1155,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSour= cePtr src, if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, fileprops)= < 0) goto cleanup; - if (virJSONValueObjectAdd(fileprops, "b:read-only", src->readonly,= NULL) < 0) + if (virJSONValueObjectAdd(fileprops, + "b:read-only", src->readonly, + "s:discard", "unmap", + NULL) < 0) goto cleanup; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151579632840.0136429050323; Thu, 19 Apr 2018 08:26:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2567626AC4B; Thu, 19 Apr 2018 15:26:18 +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 D206A82AC5; Thu, 19 Apr 2018 15:26: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 736F8180BAE8; Thu, 19 Apr 2018 15:26:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPrDt021987 for ; Thu, 19 Apr 2018 11:25:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF05984425; Thu, 19 Apr 2018 15:25:53 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id B53846F9E8; Thu, 19 Apr 2018 15:25:52 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:12 +0200 Message-Id: <7c863d8f71cc73cdef4f934397b2ef2ea5eb352b.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 15/30] qemu: block: Add support for creating 'format' layer for blockdev-add 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 19 Apr 2018 15:26:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When using blockdev-add and friends, libvirt will need to create also properties for the qcow2/raw/... format handler in qemu. This patch adds the infrastructure and implements all formats known to libvirt including all properties which are expressed at the format level in qemu. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 296 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_block.h | 3 + 2 files changed, 299 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0357d93384..87f3cf9cbe 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1168,3 +1168,299 @@ qemuBlockStorageSourceGetBackendProps(virStorageSou= rcePtr src, virJSONValueFree(fileprops); return ret; } + + +static int +qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src, + virJSONValuePtr props) +{ + qemuDomainStorageSourcePrivatePtr srcPriv =3D QEMU_DOMAIN_STORAGE_SOUR= CE_PRIVATE(src); + const char *driver =3D "raw"; + const char *secretalias =3D NULL; + + if (src->encryption && + src->encryption->format =3D=3D VIR_STORAGE_ENCRYPTION_FORMAT_LUKS = && + srcPriv && + srcPriv->encinfo) { + driver =3D "luks"; + secretalias =3D srcPriv->encinfo->s.aes.alias; + } + + /* currently unhandled properties for the 'raw' driver: + * 'offset' + * 'size' + */ + + if (virJSONValueObjectAdd(props, + "s:driver", driver, + "S:key-secret", secretalias, NULL) < 0) + return -1; + + return 0; +} + + +static int +qemuBlockStorageSourceGetCryptoProps(virStorageSourcePtr src, + virJSONValuePtr *encprops) +{ + qemuDomainStorageSourcePrivatePtr srcpriv =3D QEMU_DOMAIN_STORAGE_SOUR= CE_PRIVATE(src); + const char *encformat =3D NULL; + + *encprops =3D NULL; + + /* qemu requires encrypted secrets regardless of encryption method use= d when + * passed using the blockdev infrastructure, thus only + * VIR_DOMAIN_SECRET_INFO_TYPE_AES works here. The correct type needs = to be + * instantiated elsewhere. */ + if (!src->encryption || + !srcpriv || + !srcpriv->encinfo || + srcpriv->encinfo->type !=3D VIR_DOMAIN_SECRET_INFO_TYPE_AES) + return 0; + + switch ((virStorageEncryptionFormatType) src->encryption->format) { + case VIR_STORAGE_ENCRYPTION_FORMAT_QCOW: + encformat =3D "aes"; + break; + + case VIR_STORAGE_ENCRYPTION_FORMAT_LUKS: + encformat =3D "luks"; + break; + + case VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT: + case VIR_STORAGE_ENCRYPTION_FORMAT_LAST: + default: + virReportEnumRangeError(virStorageEncryptionFormatType, + src->encryption->format); + return -1; + } + + return virJSONValueObjectCreate(encprops, + "s:format", encformat, + "s:key-secret", srcpriv->encinfo->s.ae= s.alias, + NULL); +} + + +static int +qemuBlockStorageSourceGetFormatQcowGenericProps(virStorageSourcePtr src, + const char *format, + virJSONValuePtr props) +{ + virJSONValuePtr encprops =3D NULL; + int ret =3D -1; + + if (qemuBlockStorageSourceGetCryptoProps(src, &encprops) < 0) + return -1; + + if (virJSONValueObjectAdd(props, + "s:driver", format, + "A:encrypt", &encprops, NULL) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virJSONValueFree(encprops); + return ret; +} + + +static int +qemuBlockStorageSourceGetFormatQcow2Props(virStorageSourcePtr src, + virJSONValuePtr props) +{ + /* currently unhandled qcow2 props: + * + * 'lazy-refcounts' + * 'pass-discard-request' + * 'pass-discard-snapshot' + * 'pass-discard-other' + * 'overlap-check' + * 'l2-cache-size' + * 'l2-cache-entry-size' + * 'refcount-cache-size' + * 'cache-clean-interval' + */ + + if (qemuBlockStorageSourceGetFormatQcowGenericProps(src, "qcow2", prop= s) < 0) + return -1; + + return 0; +} + + +static virJSONValuePtr +qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSourcePtr src) +{ + const char *detectZeroes =3D NULL; + const char *discard =3D NULL; + int detectZeroesMode =3D virDomainDiskGetDetectZeroesMode(src->discard, + src->detect_ze= roes); + virJSONValuePtr props =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (qemuBlockNodeNameValidate(src->nodeformat) < 0) + return NULL; + + if (src->discard) + discard =3D virDomainDiskDiscardTypeToString(src->discard); + + if (detectZeroesMode) + detectZeroes =3D virDomainDiskDetectZeroesTypeToString(detectZeroe= sMode); + + /* currently unhandled global properties: + * '*force-share': 'bool' + */ + + if (virJSONValueObjectCreate(&props, + "s:node-name", src->nodeformat, + "b:read-only", src->readonly, + "S:discard", discard, + "S:detect-zeroes", detectZeroes, + NULL) < 0) + return NULL; + + if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0) + goto cleanup; + + VIR_STEAL_PTR(ret, props); + + cleanup: + virJSONValueFree(props); + return ret; +} + + +static virJSONValuePtr +qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src) +{ + const char *driver =3D NULL; + virJSONValuePtr props =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (!(props =3D qemuBlockStorageSourceGetBlockdevFormatCommonProps(src= ))) + goto cleanup; + + switch ((virStorageFileFormat) src->format) { + case VIR_STORAGE_FILE_FAT: + /* The fat layer is emulated by the storage access layer, so we ne= ed to + * put a raw layer on top */ + case VIR_STORAGE_FILE_RAW: + if (qemuBlockStorageSourceGetFormatRawProps(src, props) < 0) + goto cleanup; + + break; + + case VIR_STORAGE_FILE_QCOW2: + if (qemuBlockStorageSourceGetFormatQcow2Props(src, props) < 0) + goto cleanup; + break; + + case VIR_STORAGE_FILE_QCOW: + if (qemuBlockStorageSourceGetFormatQcowGenericProps(src, "qcow", p= rops) < 0) + goto cleanup; + break; + + /* formats without any special parameters */ + case VIR_STORAGE_FILE_PLOOP: + driver =3D "parallels"; + break; + case VIR_STORAGE_FILE_VHD: + driver =3D "vhdx"; + break; + case VIR_STORAGE_FILE_BOCHS: + case VIR_STORAGE_FILE_CLOOP: + case VIR_STORAGE_FILE_DMG: + case VIR_STORAGE_FILE_VDI: + case VIR_STORAGE_FILE_VPC: + case VIR_STORAGE_FILE_QED: + case VIR_STORAGE_FILE_VMDK: + driver =3D virStorageFileFormatTypeToString(src->format); + break; + + case VIR_STORAGE_FILE_AUTO_SAFE: + case VIR_STORAGE_FILE_AUTO: + case VIR_STORAGE_FILE_NONE: + case VIR_STORAGE_FILE_COW: + case VIR_STORAGE_FILE_ISO: + case VIR_STORAGE_FILE_DIR: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("mishandled storage format '%s'"), + virStorageFileFormatTypeToString(src->format)); + goto cleanup; + + case VIR_STORAGE_FILE_LAST: + default: + virReportEnumRangeError(virStorageFileFormat, src->format); + goto cleanup; + } + + if (driver && + virJSONValueObjectAdd(props, "s:driver", driver, NULL) < 0) + goto cleanup; + + VIR_STEAL_PTR(ret, props); + + cleanup: + virJSONValueFree(props); + + return ret; +} + + +/** + * qemuBlockStorageSourceGetBlockdevProps: + * + * @src: storage source to format + * + * Formats @src into a JSON object which can be used with blockdev-add or + * -blockdev. The formatted object contains both the storage and format la= yer + * in nested form including link to the backing chain layer if necessary. + */ +virJSONValuePtr +qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src) +{ + bool backingSupported =3D src->format >=3D VIR_STORAGE_FILE_BACKING; + virJSONValuePtr storage =3D NULL; + virJSONValuePtr props =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (virStorageSourceHasBacking(src) && !backingSupported) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("storage format '%s' does not support backing sto= re"), + virStorageFileFormatTypeToString(src->format)); + goto cleanup; + } + + if (!(props =3D qemuBlockStorageSourceGetBlockdevFormatProps(src))) + goto cleanup; + + if (!(storage =3D qemuBlockStorageSourceGetBackendProps(src, false))) + goto cleanup; + + if (virJSONValueObjectAppend(props, "file", storage) < 0) + goto cleanup; + storage =3D NULL; + + if (src->backingStore && backingSupported) { + if (virStorageSourceHasBacking(src)) { + if (virJSONValueObjectAppendString(props, "backing", + src->backingStore->nodeform= at) < 0) + goto cleanup; + } else { + /* chain is terminated, indicate that no detection should happ= en + * in qemu */ + if (virJSONValueObjectAppendNull(props, "backing") < 0) + goto cleanup; + } + } + + VIR_STEAL_PTR(ret, props); + + cleanup: + virJSONValueFree(storage); + virJSONValueFree(props); + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 0e674437f4..f819c6f907 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -64,4 +64,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr= src, virURIPtr qemuBlockStorageSourceGetURI(virStorageSourcePtr src); +virJSONValuePtr +qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src); + #endif /* __QEMU_BLOCK_H__ */ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151646103221.50487720694866; Thu, 19 Apr 2018 08:27:26 -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 A3FC7316423D; Thu, 19 Apr 2018 15:27:24 +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 744BB18395; Thu, 19 Apr 2018 15:27:24 +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 2FFA4181B9FF; Thu, 19 Apr 2018 15:27:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPuYD022007 for ; Thu, 19 Apr 2018 11:25:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2ABE584425; Thu, 19 Apr 2018 15:25:56 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B9AF84420; Thu, 19 Apr 2018 15:25:53 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:13 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 16/30] tests: qemublock: Rename variables in anticipation of new tests 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.44]); Thu, 19 Apr 2018 15:27:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" New tests will add new data structures so rename the 'data' structure. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index bd628295ff..7eef9f286a 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -117,15 +117,16 @@ static int mymain(void) { int ret =3D 0; - struct testBackingXMLjsonXMLdata data; + struct testBackingXMLjsonXMLdata xmljsonxmldata; virTestCounterReset("qemu storage source xml->json->xml "); #define TEST_JSON_FORMAT(tpe, xmlstr) \ do { \ - data.type =3D tpe; \ - data.xml =3D xmlstr; \ - if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, &data)= < 0) \ + xmljsonxmldata.type =3D tpe; \ + xmljsonxmldata.xml =3D xmlstr; \ + if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ + &xmljsonxmldata) < 0) \ ret =3D -1; \ } while (0) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151589807580.9562768332978; Thu, 19 Apr 2018 08:26:29 -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 57B9E30014A4; Thu, 19 Apr 2018 15:26:28 +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 1477C7E338; Thu, 19 Apr 2018 15:26:28 +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 98335180610F; Thu, 19 Apr 2018 15:26:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPvGl022018 for ; Thu, 19 Apr 2018 11:25:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 812F584424; Thu, 19 Apr 2018 15:25:57 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D28F84420; Thu, 19 Apr 2018 15:25:56 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:14 +0200 Message-Id: <2195917332a5194d002d034e2dc9489ffdf16c39.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 17/30] tests: Makefile: Sanitize entry for qemublocktest 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.40]); Thu, 19 Apr 2018 15:26:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove gnulib from _LDADD and move LDADDS to replace it. Also reformat the _SOURCES so that they can be easily extended. Signed-off-by: Peter Krempa --- tests/Makefile.am | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7b93fbde69..67850349de 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -655,12 +655,14 @@ qemuhotplugtest_SOURCES =3D \ qemuhotplugtest_LDADD =3D libqemumonitortestutils.la $(qemu_LDADDS) $(LDAD= DS) qemublocktest_SOURCES =3D \ - qemublocktest.c testutils.h testutils.c -qemublocktest_LDADD =3D $(LDADDS) \ + qemublocktest.c \ + testutils.h testutils.c \ + $(NULL) +qemublocktest_LDADD =3D \ ../src/libvirt_conf.la \ ../src/libvirt_util.la \ $(qemu_LDADDS) \ - ../gnulib/lib/libgnu.la \ + $(LDADDS) \ $(NULL) domainsnapshotxml2xmltest_SOURCES =3D \ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151595162740.0482856869822; Thu, 19 Apr 2018 08:26:35 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7EC5426AC65; Thu, 19 Apr 2018 15:26:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0638592317; Thu, 19 Apr 2018 15:26:33 +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 8E0474CAB4; Thu, 19 Apr 2018 15:26:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFPwDP022032 for ; Thu, 19 Apr 2018 11:25:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2A8784422; Thu, 19 Apr 2018 15:25:58 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id D59C66F9E8; Thu, 19 Apr 2018 15:25:57 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:15 +0200 Message-Id: <81faad74b3c87f026cb10ef5fea09e7ccfed5b92.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 18/30] qemu: domain: Export qemuDomainDeviceDefValidateDisk 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 19 Apr 2018 15:26:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It will be used in the qemublocktest. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domain.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8f240bd66d..b8abae1afb 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4175,7 +4175,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, } -static int +int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk, virQEMUCapsPtr qemuCaps) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 2c27dfb9f3..2dccec264b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -862,6 +862,9 @@ int qemuDomainSecretPrepare(virQEMUDriverPtr driver, int qemuDomainDefValidateDiskLunSource(const virStorageSource *src) ATTRIBUTE_NONNULL(1); +int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk, + virQEMUCapsPtr qemuCaps); + int qemuDomainPrepareChannel(virDomainChrDefPtr chr, const char *domainChannelTargetDir) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151585137131.81485990252418; Thu, 19 Apr 2018 08:26:25 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id AC64E31327EE; Thu, 19 Apr 2018 15:26:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79E167E238; Thu, 19 Apr 2018 15:26:23 +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 1CCC54CAAC; Thu, 19 Apr 2018 15:26:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ0hQ022043 for ; Thu, 19 Apr 2018 11:26:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FD4B6F9E8; Thu, 19 Apr 2018 15:26:00 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E37784425; Thu, 19 Apr 2018 15:25:58 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:16 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 19/30] qemu: domain: Tolerate NULL 'cfg' in qemuDomainPrepareDiskSourceChain 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 19 Apr 2018 15:26:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function will be reused in the test code where we don't care much that the gluster debug level can't be populated from the qemu config. Set the level only when 'cfg' is passed. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b8abae1afb..8fbc793e92 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11862,7 +11862,8 @@ qemuDomainPrepareDiskSourceChain(virDomainDiskDefPt= r disk, src->detect_zeroes =3D disk->detect_zeroes; for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { - if (n->type =3D=3D VIR_STORAGE_TYPE_NETWORK && + if (cfg && + n->type =3D=3D VIR_STORAGE_TYPE_NETWORK && n->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { n->debug =3D true; --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151651326314.9066007298726; Thu, 19 Apr 2018 08:27:31 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 0DEC1C04AC5D; Thu, 19 Apr 2018 15:27:30 +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 D29D585442; Thu, 19 Apr 2018 15:27:29 +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 75C71181BA04; Thu, 19 Apr 2018 15:27:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ18J022055 for ; Thu, 19 Apr 2018 11:26:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64E5484425; Thu, 19 Apr 2018 15:26:01 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64D6284424; Thu, 19 Apr 2018 15:26:00 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:17 +0200 Message-Id: <9149aeb2379e8d3a01ea68d57f28872895761f2b.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 20/30] tests: qemublock: Add testing of blockdev JSON property generator 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 19 Apr 2018 15:27:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a test infrastructure that will allow testing the JSON object generator used for generating data to use with blockdev-add. The resulting disk including the backing chain is validated to conform to the QAPI schema and the expected output files. The first test cases make sure that libvirt will not allow nodenames exceeding 31 chars. Signed-off-by: Peter Krempa --- tests/Makefile.am | 3 + tests/qemublocktest.c | 227 +++++++++++++++++= ++++ .../xml2json/nodename-long-format.xml | 9 + .../xml2json/nodename-long-protocol.xml | 9 + 4 files changed, 248 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/nodename-long-format.x= ml create mode 100644 tests/qemublocktestdata/xml2json/nodename-long-protocol= .xml diff --git a/tests/Makefile.am b/tests/Makefile.am index 67850349de..6a61296c44 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -119,6 +119,7 @@ EXTRA_DIST =3D \ oomtrace.pl \ qemuagentdata \ qemuargv2xmldata \ + qemublocktestdata \ qemucapabilitiesdata \ qemucaps2xmldata \ qemuhotplugtestcpus \ @@ -657,8 +658,10 @@ qemuhotplugtest_LDADD =3D libqemumonitortestutils.la $= (qemu_LDADDS) $(LDADDS) qemublocktest_SOURCES =3D \ qemublocktest.c \ testutils.h testutils.c \ + testutilsqemu.h testutilsqemu.c \ $(NULL) qemublocktest_LDADD =3D \ + libqemumonitortestutils.la \ ../src/libvirt_conf.la \ ../src/libvirt_util.la \ $(qemu_LDADDS) \ diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 7eef9f286a..161053a717 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -19,10 +19,15 @@ #include #include "testutils.h" +#include "testutilsqemu.h" +#include "testutilsqemuschema.h" #include "virstoragefile.h" #include "virstring.h" #include "virlog.h" #include "qemu/qemu_block.h" +#include "qemu/qemu_qapi.h" + +#include "qemu/qemu_command.h" #define VIR_FROM_THIS VIR_FROM_NONE @@ -113,11 +118,190 @@ testBackingXMLjsonXML(const void *args) } +struct testQemuDiskXMLToJSONData { + virQEMUDriverPtr driver; + virHashTablePtr schema; + virJSONValuePtr schemaroot; + const char *name; + bool fail; + + virJSONValuePtr *props; + size_t nprops; + + virQEMUCapsPtr qemuCaps; +}; + + +static void +testQemuDiskXMLToPropsClear(struct testQemuDiskXMLToJSONData *data) +{ + size_t i; + + for (i =3D 0; i < data->nprops; i++) + virJSONValueFree(data->props[i]); + + data->nprops =3D 0; + VIR_FREE(data->props); +} + + +static const char *testQemuDiskXMLToJSONPath =3D abs_srcdir "/qemublocktes= tdata/xml2json/"; + +static int +testQemuDiskXMLToProps(const void *opaque) +{ + struct testQemuDiskXMLToJSONData *data =3D (void *) opaque; + virDomainDiskDefPtr disk =3D NULL; + virStorageSourcePtr n; + virJSONValuePtr props =3D NULL; + char *xmlpath =3D NULL; + char *xmlstr =3D NULL; + int ret =3D -1; + + if (virAsprintf(&xmlpath, "%s%s.xml", + testQemuDiskXMLToJSONPath, data->name) < 0) + goto cleanup; + + if (virTestLoadFile(xmlpath, &xmlstr) < 0) + goto cleanup; + + /* qemu stores node names in the status XML portion */ + if (!(disk =3D virDomainDiskDefParse(xmlstr, NULL, data->driver->xmlop= t, + VIR_DOMAIN_DEF_PARSE_STATUS))) + goto cleanup; + + if (qemuCheckDiskConfig(disk, data->qemuCaps) < 0 || + qemuDomainDeviceDefValidateDisk(disk, data->qemuCaps) < 0) { + VIR_TEST_VERBOSE("invalid configuration for disk\n"); + goto cleanup; + } + + if (qemuDomainPrepareDiskSourceChain(disk, NULL, NULL, data->qemuCaps)= < 0) + goto cleanup; + + for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { + if (!(props =3D qemuBlockStorageSourceGetBlockdevProps(n))) { + if (!data->fail) { + VIR_TEST_VERBOSE("failed to generate qemu blockdev props\n= "); + goto cleanup; + } + } else if (data->fail) { + VIR_TEST_VERBOSE("qemu blockdev props should have failed\n"); + goto cleanup; + } + + if (VIR_APPEND_ELEMENT(data->props, data->nprops, props) < 0) + goto cleanup; + } + + ret =3D 0; + + cleanup: + virDomainDiskDefFree(disk); + VIR_FREE(xmlpath); + VIR_FREE(xmlstr); + return ret; +} + + +static int +testQemuDiskXMLToPropsValidateSchema(const void *opaque) +{ + struct testQemuDiskXMLToJSONData *data =3D (void *) opaque; + virBuffer debug =3D VIR_BUFFER_INITIALIZER; + char *propsstr =3D NULL; + char *debugmsg =3D NULL; + int ret =3D 0; + size_t i; + + if (data->fail) + return EXIT_AM_SKIP; + + for (i =3D 0; i < data->nprops; i++) { + if (testQEMUSchemaValidate(data->props[i], data->schemaroot, + data->schema, &debug) < 0) { + debugmsg =3D virBufferContentAndReset(&debug); + propsstr =3D virJSONValueToString(data->props[i], true); + VIR_TEST_VERBOSE("json does not conform to QAPI schema"); + VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output= :\n %s", + propsstr, NULLSTR(debugmsg)); + VIR_FREE(debugmsg); + VIR_FREE(propsstr); + ret =3D -1; + } + + virBufferFreeAndReset(&debug); + } + return ret; +} + + +static int +testQemuDiskXMLToPropsValidateFile(const void *opaque) +{ + struct testQemuDiskXMLToJSONData *data =3D (void *) opaque; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + char *jsonpath =3D NULL; + char *jsonstr =3D NULL; + char *actual =3D NULL; + int ret =3D -1; + size_t i; + + if (data->fail) + return EXIT_AM_SKIP; + + if (virAsprintf(&jsonpath, "%s%s.json", + testQemuDiskXMLToJSONPath, data->name) < 0) + goto cleanup; + + for (i =3D 0; i < data->nprops; i++) { + if (!(jsonstr =3D virJSONValueToString(data->props[i], true))) + goto cleanup; + + virBufferAdd(&buf, jsonstr, -1); + } + + if (virBufferCheckError(&buf) < 0) + goto cleanup; + + actual =3D virBufferContentAndReset(&buf); + + ret =3D virTestCompareToFile(actual, jsonpath); + + cleanup: + VIR_FREE(jsonpath); + VIR_FREE(jsonstr); + VIR_FREE(actual); + return ret; +} + + static int mymain(void) { int ret =3D 0; + virQEMUDriver driver; struct testBackingXMLjsonXMLdata xmljsonxmldata; + struct testQemuDiskXMLToJSONData diskxmljsondata; + char *capslatest_x86_64 =3D NULL; + virQEMUCapsPtr caps_x86_64 =3D NULL; + + if (qemuTestDriverInit(&driver) < 0) + return EXIT_FAILURE; + + diskxmljsondata.driver =3D &driver; + + if (!(capslatest_x86_64 =3D testQemuGetLatestCapsForArch(abs_srcdir "/= qemucapabilitiesdata", + "x86_64", "xml"= ))) + return EXIT_FAILURE; + + VIR_TEST_VERBOSE("\nlatest caps x86_64: %s\n", capslatest_x86_64); + + if (!(caps_x86_64 =3D qemuTestParseCapabilitiesArch(virArchFromString(= "x86_64"), + capslatest_x86_64))) + return EXIT_FAILURE; + + diskxmljsondata.qemuCaps =3D caps_x86_64; virTestCounterReset("qemu storage source xml->json->xml "); @@ -183,6 +367,49 @@ mymain(void) " \n" "\n"); +#define TEST_DISK_TO_JSON_FULL(nme, fl) \ + do { \ + diskxmljsondata.name =3D nme; \ + diskxmljsondata.props =3D NULL; \ + diskxmljsondata.nprops =3D 0; \ + diskxmljsondata.fail =3D fl; \ + if (virTestRun("disk xml to props " nme, testQemuDiskXMLToProps, \ + &diskxmljsondata) < 0) \ + ret =3D -1; \ + if (virTestRun("disk xml to props validate schema " nme, \ + testQemuDiskXMLToPropsValidateSchema, &diskxmljsond= ata) < 0) \ + ret =3D -1; \ + if (virTestRun("disk xml to props validate file " nme, \ + testQemuDiskXMLToPropsValidateFile, &diskxmljsonda= ta) < 0) \ + ret =3D -1; \ + testQemuDiskXMLToPropsClear(&diskxmljsondata); \ + } while (0) + +#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false) + + if (!(diskxmljsondata.schema =3D testQEMUSchemaLoad())) { + ret =3D -1; + goto cleanup; + } + + if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type", + diskxmljsondata.schema, + &diskxmljsondata.schemaroot) < 0 || + !diskxmljsondata.schemaroot) { + VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add\n"); + ret =3D -1; + goto cleanup; + } + + TEST_DISK_TO_JSON_FULL("nodename-long-format", true); + TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true); + + cleanup: + virHashFree(diskxmljsondata.schema); + qemuTestDriverFree(&driver); + VIR_FREE(capslatest_x86_64); + virObjectUnref(caps_x86_64); + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemublocktestdata/xml2json/nodename-long-format.xml b/te= sts/qemublocktestdata/xml2json/nodename-long-format.xml new file mode 100644 index 0000000000..e1d9473508 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/nodename-long-format.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/nodename-long-protocol.xml b/= tests/qemublocktestdata/xml2json/nodename-long-protocol.xml new file mode 100644 index 0000000000..a4b7eba826 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/nodename-long-protocol.xml @@ -0,0 +1,9 @@ + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151600656585.9293108184726; Thu, 19 Apr 2018 08:26:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EC90C04BE07; Thu, 19 Apr 2018 15:26:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E176B89FA6; Thu, 19 Apr 2018 15:26:38 +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 63ED74CAB7; Thu, 19 Apr 2018 15:26:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ2M3022067 for ; Thu, 19 Apr 2018 11:26:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA7E884425; Thu, 19 Apr 2018 15:26:02 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C06436F9E8; Thu, 19 Apr 2018 15:26:01 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:18 +0200 Message-Id: <92ceaf76f719d977c886948a169e330fe687d89d.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 21/30] tests: qemublock: Add basic 'raw' file test 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 19 Apr 2018 15:26:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Test the JSON props generator with a very simple 'raw' image with no other options. The node-names for the image are 31 bytes long so that we validate our node name detector. The top level disk image would generate the following '-drive' cmdline: -drive file=3D/var/lib/libvirt/images/i.img,format=3Draw,if=3Dnone,id=3Ddri= ve-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 2 ++ tests/qemublocktestdata/xml2json/file-raw-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-raw-noopts.xml | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-raw-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-raw-noopts.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 161053a717..c9a2f91992 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -404,6 +404,8 @@ mymain(void) TEST_DISK_TO_JSON_FULL("nodename-long-format", true); TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true); + TEST_DISK_TO_JSON("file-raw-noopts"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.json b/tests/= qemublocktestdata/xml2json/file-raw-noopts.json new file mode 100644 index 0000000000..25de571428 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/i.img", + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.xml b/tests/q= emublocktestdata/xml2json/file-raw-noopts.xml new file mode 100644 index 0000000000..f6e3d38bad --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151611053120.08768770631843; Thu, 19 Apr 2018 08:26:51 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 6388E80474; Thu, 19 Apr 2018 15:26:49 +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 14C5E6C359; Thu, 19 Apr 2018 15:26:44 +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 5AA96180BAF4; Thu, 19 Apr 2018 15:26:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ4ho022077 for ; Thu, 19 Apr 2018 11:26:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id E63DF84422; Thu, 19 Apr 2018 15:26:03 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16C1784420; Thu, 19 Apr 2018 15:26:02 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:19 +0200 Message-Id: <1289d389a6a3e646ec67929383c67d71797e73f8.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 22/30] tests: qemublock: Add tests for all other format without special options 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 19 Apr 2018 15:26:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similarly to the 'raw' case add tests for bochs, cloop, dmg, ploop, vdi vhd, and vpc. Covering all supproted non-backing formats. Note that the JSON name for 'ploop' maps to 'parallels' and 'vhd' maps to 'vhdx'. Files added here would result in the followint configs: file-bochs-noopts.xml: -drive file=3D/path/to/i.img,format=3Dbochs,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-cloop-noopts.xml: -drive file=3D/path/to/i.img,format=3Dcloop,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-dmg-noopts.xml: -drive file=3D/path/to/i.img,format=3Ddmg,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-ploop-noopts.xml: -drive file=3D/path/to/i.img,format=3Dploop,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-vdi-noopts.xml: -drive file=3D/path/to/i.img,format=3Dvdi,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-vhd-noopts.xml: -drive file=3D/path/to/i.img,format=3Dvhd,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-vpc-noopts.xml: -drive file=3D/path/to/i.img,format=3Dvpc,if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 7 +++++++ tests/qemublocktestdata/xml2json/file-bochs-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-bochs-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-cloop-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-cloop-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-dmg-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-dmg-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-ploop-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-ploop-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-vdi-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vdi-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-vhd-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vhd-noopts.xml | 9 +++++++++ tests/qemublocktestdata/xml2json/file-vpc-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vpc-noopts.xml | 9 +++++++++ 15 files changed, 154 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-bochs-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-bochs-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-cloop-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-cloop-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-dmg-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-dmg-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-ploop-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-ploop-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-vdi-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-vdi-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-vhd-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-vhd-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-vpc-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-vpc-noopts.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index c9a2f91992..feb25c69e3 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -405,6 +405,13 @@ mymain(void) TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true); TEST_DISK_TO_JSON("file-raw-noopts"); + TEST_DISK_TO_JSON("file-bochs-noopts"); + TEST_DISK_TO_JSON("file-cloop-noopts"); + TEST_DISK_TO_JSON("file-dmg-noopts"); + TEST_DISK_TO_JSON("file-ploop-noopts"); + TEST_DISK_TO_JSON("file-vdi-noopts"); + TEST_DISK_TO_JSON("file-vhd-noopts"); + TEST_DISK_TO_JSON("file-vpc-noopts"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/file-bochs-noopts.json b/test= s/qemublocktestdata/xml2json/file-bochs-noopts.json new file mode 100644 index 0000000000..22e2560998 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-bochs-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "bochs", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-bochs-noopts.xml b/tests= /qemublocktestdata/xml2json/file-bochs-noopts.xml new file mode 100644 index 0000000000..ebe9da438c --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-bochs-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-cloop-noopts.json b/test= s/qemublocktestdata/xml2json/file-cloop-noopts.json new file mode 100644 index 0000000000..b72bb5df56 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-cloop-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "cloop", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-cloop-noopts.xml b/tests= /qemublocktestdata/xml2json/file-cloop-noopts.xml new file mode 100644 index 0000000000..d48219145d --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-cloop-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-dmg-noopts.json b/tests/= qemublocktestdata/xml2json/file-dmg-noopts.json new file mode 100644 index 0000000000..9f2912b8d3 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-dmg-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "dmg", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-dmg-noopts.xml b/tests/q= emublocktestdata/xml2json/file-dmg-noopts.xml new file mode 100644 index 0000000000..27f4fa8cd6 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-dmg-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-ploop-noopts.json b/test= s/qemublocktestdata/xml2json/file-ploop-noopts.json new file mode 100644 index 0000000000..64006d28a3 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-ploop-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "parallels", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-ploop-noopts.xml b/tests= /qemublocktestdata/xml2json/file-ploop-noopts.xml new file mode 100644 index 0000000000..5f47f6b73b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-ploop-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-vdi-noopts.json b/tests/= qemublocktestdata/xml2json/file-vdi-noopts.json new file mode 100644 index 0000000000..ce8e359c91 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vdi-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "vdi", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-vdi-noopts.xml b/tests/q= emublocktestdata/xml2json/file-vdi-noopts.xml new file mode 100644 index 0000000000..5d2e76656b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vdi-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-vhd-noopts.json b/tests/= qemublocktestdata/xml2json/file-vhd-noopts.json new file mode 100644 index 0000000000..d4b8e1f55a --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vhd-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "vhdx", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-vhd-noopts.xml b/tests/q= emublocktestdata/xml2json/file-vhd-noopts.xml new file mode 100644 index 0000000000..c6a9686a95 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vhd-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-vpc-noopts.json b/tests/= qemublocktestdata/xml2json/file-vpc-noopts.json new file mode 100644 index 0000000000..be1ec795a7 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vpc-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "vpc", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-vpc-noopts.xml b/tests/q= emublocktestdata/xml2json/file-vpc-noopts.xml new file mode 100644 index 0000000000..5f79c4a826 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vpc-noopts.xml @@ -0,0 +1,9 @@ + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151670336363.2955812853571; Thu, 19 Apr 2018 08:27:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E746C3004431; Thu, 19 Apr 2018 15:27:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 656BF827A9; Thu, 19 Apr 2018 15:27:33 +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 8D53E5BBE8; Thu, 19 Apr 2018 15:27:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ5Pm022088 for ; Thu, 19 Apr 2018 11:26:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 220D284422; Thu, 19 Apr 2018 15:26:05 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E74B84424; Thu, 19 Apr 2018 15:26:04 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:20 +0200 Message-Id: <426693388ba864d36df06e7f76f9771aaaa8eb9f.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 23/30] tests: qemublock: Add tests for basic backing chain formats 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 19 Apr 2018 15:27:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Formats supporting backing chain such as qed, vmdk, don't have any other parameters than the backing store and 'qcow' has only encryption params which will be tested extra. Add this test case so they are covered since any further test cases will mainly care about 'qcow2' and 'raw'. The top level disk image would generate the following '-drive' cmdline: -drive file=3D/var/lib/libvirt/images/a,format=3Dqed,if=3Dnone,id=3Ddrive-d= ummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 2 + .../xml2json/file-backing_basic-noopts.json | 51 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-noopts.xml | 34 +++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-noo= pts.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-noo= pts.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index feb25c69e3..881d7c17ee 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -413,6 +413,8 @@ mymain(void) TEST_DISK_TO_JSON("file-vhd-noopts"); TEST_DISK_TO_JSON("file-vpc-noopts"); + TEST_DISK_TO_JSON("file-backing_basic-noopts"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json new file mode 100644 index 0000000000..3285a6ec67 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json @@ -0,0 +1,51 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "driver": "vmdk", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/c", + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml= b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml new file mode 100644 index 0000000000..daa9423dcc --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151591375703.0963067272075; Thu, 19 Apr 2018 08:26:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0412131343AB; Thu, 19 Apr 2018 15:26:30 +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 B5CD282710; Thu, 19 Apr 2018 15:26:29 +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 5A5491800CAB; Thu, 19 Apr 2018 15:26:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ6BU022102 for ; Thu, 19 Apr 2018 11:26:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 628C084422; Thu, 19 Apr 2018 15:26:06 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AC586F9E8; Thu, 19 Apr 2018 15:26:05 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:21 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 24/30] tests: qemublock: Add test-case for the 'vvfat' driver in qemu 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 19 Apr 2018 15:26:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Test mapping of the 'FAT' disk format to 'vvfat' in qemu. The top level disk image would generate the following '-drive' cmdline: dir-fat-readonly.xml: -drive file=3Dfat:/var/somefiles,if=3Dnone,id=3Ddrive-dummy,readonly=3Don -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 2 ++ tests/qemublocktestdata/xml2json/dir-fat-floppy.json | 14 ++++++++++++++ tests/qemublocktestdata/xml2json/dir-fat-floppy.xml | 11 +++++++++++ tests/qemublocktestdata/xml2json/dir-fat-readonly.json | 14 ++++++++++++++ tests/qemublocktestdata/xml2json/dir-fat-readonly.xml | 10 ++++++++++ 5 files changed, 51 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.json create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.xml create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.json create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 881d7c17ee..81a2261dab 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -414,6 +414,8 @@ mymain(void) TEST_DISK_TO_JSON("file-vpc-noopts"); TEST_DISK_TO_JSON("file-backing_basic-noopts"); + TEST_DISK_TO_JSON("dir-fat-readonly"); + TEST_DISK_TO_JSON("dir-fat-floppy"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json b/tests/q= emublocktestdata/xml2json/dir-fat-floppy.json new file mode 100644 index 0000000000..9685acaa8b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json @@ -0,0 +1,14 @@ +{ + "node-name": "node-f", + "read-only": true, + "driver": "raw", + "file": { + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": true, + "rw": false, + "node-name": "node-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml b/tests/qe= mublocktestdata/xml2json/dir-fat-floppy.xml new file mode 100644 index 0000000000..b7f2d9f8a6 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml @@ -0,0 +1,11 @@ + + + + + + + + +
+ + diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json b/tests= /qemublocktestdata/xml2json/dir-fat-readonly.json new file mode 100644 index 0000000000..7d35d255cc --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json @@ -0,0 +1,14 @@ +{ + "node-name": "node-f", + "read-only": true, + "driver": "raw", + "file": { + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": false, + "rw": false, + "node-name": "node-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml b/tests/= qemublocktestdata/xml2json/dir-fat-readonly.xml new file mode 100644 index 0000000000..bdb291e412 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml @@ -0,0 +1,10 @@ + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151611410968.8383235893538; Thu, 19 Apr 2018 08:26:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02FCB312FF99; Thu, 19 Apr 2018 15:26:50 +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 B0C0C89FCF; Thu, 19 Apr 2018 15:26:49 +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 4EB11181A72D; Thu, 19 Apr 2018 15:26:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQ7YT022113 for ; Thu, 19 Apr 2018 11:26:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8E71184424; Thu, 19 Apr 2018 15:26:07 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEA8C6F9E8; Thu, 19 Apr 2018 15:26:06 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:22 +0200 Message-Id: <460625d7ab042b69bdad706dd0b9a58a36b58683.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 25/30] tests: qemublock: Add test cases for 'aio' options of 'file' storage 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 19 Apr 2018 15:26:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Test that the 'aio' option is applied correctly for the 'file' protocol backend and across the backing chain. The top level disk image would generate the following '-drive' cmdline: file-backing_basic-aio_threads: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow,if=3Dnone,id=3Ddrive-= dummy,aio=3Dthreads -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-raw-aio_native: -drive file=3D/path/to/i.img,format=3Draw,if=3Dnone,id=3Ddrive-dummy,cache= =3Dnone,aio=3Dnative -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Don Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 2 + .../xml2json/file-backing_basic-aio_threads.json | 62 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-aio_threads.xml | 35 ++++++++++++ .../xml2json/file-raw-aio_native.json | 21 ++++++++ .../xml2json/file-raw-aio_native.xml | 9 ++++ 5 files changed, 129 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-aio= _threads.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-aio= _threads.xml create mode 100644 tests/qemublocktestdata/xml2json/file-raw-aio_native.js= on create mode 100644 tests/qemublocktestdata/xml2json/file-raw-aio_native.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 81a2261dab..a79ffa90d8 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -416,6 +416,8 @@ mymain(void) TEST_DISK_TO_JSON("file-backing_basic-noopts"); TEST_DISK_TO_JSON("dir-fat-readonly"); TEST_DISK_TO_JSON("dir-fat-floppy"); + TEST_DISK_TO_JSON("file-raw-aio_native"); + TEST_DISK_TO_JSON("file-backing_basic-aio_threads"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_thread= s.json b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.js= on new file mode 100644 index 0000000000..dcaf905085 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json @@ -0,0 +1,62 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "aio": "threads", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "aio": "threads", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "aio": "threads", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_thread= s.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml new file mode 100644 index 0000000000..0bd1388f0f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json b/te= sts/qemublocktestdata/xml2json/file-raw-aio_native.json new file mode 100644 index 0000000000..2752e0b204 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json @@ -0,0 +1,21 @@ +{ + "node-name": "test1", + "read-only": false, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/path/to/i.img", + "aio": "native", + "node-name": "test2", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml b/tes= ts/qemublocktestdata/xml2json/file-raw-aio_native.xml new file mode 100644 index 0000000000..d1b98ff992 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml @@ -0,0 +1,9 @@ + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151660993820.5399639366267; Thu, 19 Apr 2018 08:27:40 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id ABE8031325B6; Thu, 19 Apr 2018 15:27:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A72E85458; Thu, 19 Apr 2018 15:27:39 +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 1F07D5BBEF; Thu, 19 Apr 2018 15:27:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQCGt022156 for ; Thu, 19 Apr 2018 11:26:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 311C184424; Thu, 19 Apr 2018 15:26:12 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A4766F9E8; Thu, 19 Apr 2018 15:26:07 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:23 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 26/30] tests: qemublock: Add test for raw luks disk format 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 19 Apr 2018 15:27:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Apart from adding test data add a function which sets up fake secrets for the test. The top level disk image would generate the following '-drive' cmdline: -drive file=3D/path/luks.img,key-secret=3Dtest1-encalias,format=3Dluks,if= =3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 42 ++++++++++++++++++= ++++ .../qemublocktestdata/xml2json/file-raw-luks.json | 13 +++++++ tests/qemublocktestdata/xml2json/file-raw-luks.xml | 12 +++++++ 3 files changed, 67 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-raw-luks.json create mode 100644 tests/qemublocktestdata/xml2json/file-raw-luks.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index a79ffa90d8..55d028e9fb 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -145,6 +145,44 @@ testQemuDiskXMLToPropsClear(struct testQemuDiskXMLToJS= ONData *data) } +static int +testQemuDiskXMLToJSONFakeSecrets(virStorageSourcePtr src) +{ + qemuDomainStorageSourcePrivatePtr srcpriv; + + if (!src->privateData && + !(src->privateData =3D qemuDomainStorageSourcePrivateNew())) + return -1; + + srcpriv =3D QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); + + if (src->auth) { + if (VIR_ALLOC(srcpriv->secinfo) < 0) + return -1; + + srcpriv->secinfo->type =3D VIR_DOMAIN_SECRET_INFO_TYPE_AES; + if (VIR_STRDUP(srcpriv->secinfo->s.aes.username, src->auth->userna= me) < 0) + return -1; + + if (virAsprintf(&srcpriv->secinfo->s.aes.alias, "%s-secalias", + NULLSTR(src->nodestorage)) < 0) + return -1; + } + + if (src->encryption) { + if (VIR_ALLOC(srcpriv->encinfo) < 0) + return -1; + + srcpriv->encinfo->type =3D VIR_DOMAIN_SECRET_INFO_TYPE_AES; + if (virAsprintf(&srcpriv->encinfo->s.aes.alias, "%s-encalias", + NULLSTR(src->nodeformat)) < 0) + return -1; + } + + return 0; +} + + static const char *testQemuDiskXMLToJSONPath =3D abs_srcdir "/qemublocktes= tdata/xml2json/"; static int @@ -180,6 +218,9 @@ testQemuDiskXMLToProps(const void *opaque) goto cleanup; for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { + if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) + goto cleanup; + if (!(props =3D qemuBlockStorageSourceGetBlockdevProps(n))) { if (!data->fail) { VIR_TEST_VERBOSE("failed to generate qemu blockdev props\n= "); @@ -418,6 +459,7 @@ mymain(void) TEST_DISK_TO_JSON("dir-fat-floppy"); TEST_DISK_TO_JSON("file-raw-aio_native"); TEST_DISK_TO_JSON("file-backing_basic-aio_threads"); + TEST_DISK_TO_JSON("file-raw-luks"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/file-raw-luks.json b/tests/qe= mublocktestdata/xml2json/file-raw-luks.json new file mode 100644 index 0000000000..e3d9c4c26b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-luks.json @@ -0,0 +1,13 @@ +{ + "node-name": "test1", + "read-only": false, + "driver": "luks", + "key-secret": "test1-encalias", + "file": { + "driver": "file", + "filename": "/path/luks.img", + "node-name": "test2", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-raw-luks.xml b/tests/qem= ublocktestdata/xml2json/file-raw-luks.xml new file mode 100644 index 0000000000..1cbff5c83f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-luks.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15241516683421015.2206963531714; Thu, 19 Apr 2018 08:27:48 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id F3D26312C012; Thu, 19 Apr 2018 15:27:46 +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 BC9665F731; Thu, 19 Apr 2018 15:27:43 +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 2916C181BA0A; Thu, 19 Apr 2018 15:27:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQDox022172 for ; Thu, 19 Apr 2018 11:26:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9913584422; Thu, 19 Apr 2018 15:26:13 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E64384424; Thu, 19 Apr 2018 15:26:12 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:24 +0200 Message-Id: <0ac7e971cfe047d2ad45ae59c061ab3bbc7ad469.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 27/30] tests: qemublock: basic qcow2 tests 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 19 Apr 2018 15:27:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add tests for backing chain handling, including a very long chain which is fully specified in the XML and an unterminated chain. The top level disk image would generate the following '-drive': file-qcow2-backing-chain-encryption.xml: -drive file=3D/var/lib/libvirt/images/a,encrypt.format=3Dluks, encrypt.key-secret=3Dnode-b-f-encalias,format=3Dqcow2,if=3Dnone,id=3Ddr= ive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-qcow2-backing-chain-noopts.xml: -drive file=3D/var/lib/libvirt/images/rhel7.3.1507297895,format=3Dqcow2,if= =3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-qcow2-backing-chain-unterminated.xml: -drive file=3D/var/lib/libvirt/images/rhel7.3.1507297895,format=3Dqcow2,if= =3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 3 + .../file-qcow2-backing-chain-encryption.json | 34 ++++++ .../file-qcow2-backing-chain-encryption.xml | 25 ++++ .../xml2json/file-qcow2-backing-chain-noopts.json | 130 +++++++++++++++++= ++++ .../xml2json/file-qcow2-backing-chain-noopts.xml | 83 +++++++++++++ .../file-qcow2-backing-chain-unterminated.json | 25 ++++ .../file-qcow2-backing-chain-unterminated.xml | 18 +++ 7 files changed, 318 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-encryption.json create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-encryption.xml create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-noopts.xml create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-unterminated.json create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-cha= in-unterminated.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 55d028e9fb..44d76bebbb 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -460,6 +460,9 @@ mymain(void) TEST_DISK_TO_JSON("file-raw-aio_native"); TEST_DISK_TO_JSON("file-backing_basic-aio_threads"); TEST_DISK_TO_JSON("file-raw-luks"); + TEST_DISK_TO_JSON("file-qcow2-backing-chain-noopts"); + TEST_DISK_TO_JSON("file-qcow2-backing-chain-unterminated"); + TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encr= yption.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-enc= ryption.json new file mode 100644 index 0000000000..94e2ecd1e2 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= json @@ -0,0 +1,34 @@ +{ + "node-name": "node-b-f", + "read-only": false, + "driver": "qcow2", + "encrypt": { + "format": "luks", + "key-secret": "node-b-f-encalias" + }, + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "driver": "qcow2", + "encrypt": { + "format": "aes", + "key-secret": "node-b-f-encalias" + }, + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": null +} diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encr= yption.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encr= yption.xml new file mode 100644 index 0000000000..4e49be9bef --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noop= ts.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.= json new file mode 100644 index 0000000000..3e7c08f080 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json @@ -0,0 +1,130 @@ +{ + "node-name": "#block126", + "read-only": false, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", + "node-name": "#block004", + "read-only": false, + "discard": "unmap" + }, + "backing": "#block313" +} +{ + "node-name": "#block313", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "node-name": "#block256", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block556" +} +{ + "node-name": "#block556", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "node-name": "#block418", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block767" +} +{ + "node-name": "#block767", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "node-name": "#block624", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block937" +} +{ + "node-name": "#block937", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "node-name": "#block869", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block1157" +} +{ + "node-name": "#block1157", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "node-name": "#block1047", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block1392" +} +{ + "node-name": "#block1392", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "node-name": "#block1279", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block1523" +} +{ + "node-name": "#block1523", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "node-name": "#block1444", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block1742" +} +{ + "node-name": "#block1742", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "node-name": "#block1602", + "read-only": true, + "discard": "unmap" + }, + "backing": "#block1909" +} +{ + "node-name": "#block1909", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "node-name": "#block1864", + "read-only": true, + "discard": "unmap" + }, + "backing": null +} diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noop= ts.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.x= ml new file mode 100644 index 0000000000..d69d51ebfb --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unte= rminated.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-u= nterminated.json new file mode 100644 index 0000000000..8fcdc48bb0 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.json @@ -0,0 +1,25 @@ +{ + "node-name": "#block126", + "read-only": false, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1507297895", + "node-name": "#block004", + "read-only": false, + "discard": "unmap" + }, + "backing": "#block313" +} +{ + "node-name": "#block313", + "read-only": true, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "node-name": "#block256", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unte= rminated.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-un= terminated.xml new file mode 100644 index 0000000000..29ed9665df --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151673116744.7435606035534; Thu, 19 Apr 2018 08:27:53 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id C9F793130640; Thu, 19 Apr 2018 15:27:51 +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 8A28E8BA5C; Thu, 19 Apr 2018 15:27:50 +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 6C723181BA0F; Thu, 19 Apr 2018 15:27:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQF7w022184 for ; Thu, 19 Apr 2018 11:26:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0493784424; Thu, 19 Apr 2018 15:26:15 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id E874C84420; Thu, 19 Apr 2018 15:26:13 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:25 +0200 Message-Id: <35ad8512df5395c841fbfcf6166bc380213316f5.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 28/30] tests: qemublock: Add test combining authentication and encryption 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 19 Apr 2018 15:27:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" iscsi and rbd support authentication of the connection. Combine it with encryption of qcow2. The top level disk image would generate the following '-drive' cmdline: -drive file=3Drbd:rbdpool/rbdimg:id=3Dtestuser-rbd:auth_supported=3Dcephx\;= none: mon_host=3Dhost1.example.com\;host2.example.com, file.password-secret=3Dnode-a-s-secalias,encrypt.format=3Dluks, encrypt.key-secret=3Dnode-b-f-encalias,format=3Dqcow2, if=3Dnone,id=3Ddrive-dummy -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 1 + ...etwork-qcow2-backing-chain-encryption_auth.json | 51 ++++++++++++++++++= ++++ ...network-qcow2-backing-chain-encryption_auth.xml | 34 +++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/network-qcow2-backing-= chain-encryption_auth.json create mode 100644 tests/qemublocktestdata/xml2json/network-qcow2-backing-= chain-encryption_auth.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 44d76bebbb..34509be543 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -463,6 +463,7 @@ mymain(void) TEST_DISK_TO_JSON("file-qcow2-backing-chain-noopts"); TEST_DISK_TO_JSON("file-qcow2-backing-chain-unterminated"); TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption"); + TEST_DISK_TO_JSON("network-qcow2-backing-chain-encryption_auth"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-e= ncryption_auth.json b/tests/qemublocktestdata/xml2json/network-qcow2-backin= g-chain-encryption_auth.json new file mode 100644 index 0000000000..f307ba8805 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.json @@ -0,0 +1,51 @@ +{ + "node-name": "node-b-f", + "read-only": false, + "driver": "qcow2", + "encrypt": { + "format": "luks", + "key-secret": "node-b-f-encalias" + }, + "file": { + "driver": "rbd", + "pool": "rbdpool", + "image": "rbdimg", + "server": [ + { + "host": "host1.example.com", + "port": "0" + }, + { + "host": "host2.example.com", + "port": "0" + } + ], + "user": "testuser-rbd", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "driver": "qcow2", + "encrypt": { + "format": "aes", + "key-secret": "node-b-f-encalias" + }, + "file": { + "driver": "iscsi", + "portal": "example.org:3260", + "target": "iscsitarget", + "lun": 1, + "transport": "tcp", + "user": "testuser-iscsi", + "password-secret": "node-b-s-secalias", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": null +} diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-e= ncryption_auth.xml b/tests/qemublocktestdata/xml2json/network-qcow2-backing= -chain-encryption_auth.xml new file mode 100644 index 0000000000..d8cd38866b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151621034159.43436518790713; Thu, 19 Apr 2018 08:27:01 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 8DCEF31500BD; Thu, 19 Apr 2018 15:26:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3CE384AFE; Thu, 19 Apr 2018 15:26:56 +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 6EEA94CABA; Thu, 19 Apr 2018 15:26:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQGZm022204 for ; Thu, 19 Apr 2018 11:26:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 750F26F9E8; Thu, 19 Apr 2018 15:26:16 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60B0684420; Thu, 19 Apr 2018 15:26:15 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:26 +0200 Message-Id: <4a50df2e81372abb7ab0e8380974d5279f12985a.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 29/30] tests: qemublock: Test handling of 'unmap' and 'detect-zeroes' options 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 19 Apr 2018 15:27:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test cases would correspond to the following -drive command lines: file-backing_basic-detect.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow,if=3Dnone,id=3Ddrive-= dummy,detect-zeroes=3Don -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-backing_basic-unmap-detect.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow,if=3Dnone,id=3Ddrive-= dummy,discard=3Dunmap,detect-zeroes=3Dunmap -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-backing_basic-unmap-ignore.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow,if=3Dnone,id=3Ddrive-= dummy,discard=3Dignore,detect-zeroes=3Don -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy file-backing_basic-unmap.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow,if=3Dnone,id=3Ddrive-= dummy,discard=3Dunmap -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy --- tests/qemublocktest.c | 5 ++ .../xml2json/file-backing_basic-detect.json | 60 ++++++++++++++++++= ++ .../xml2json/file-backing_basic-detect.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap-detect.json | 64 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-unmap-detect.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap-discard.json | 0 .../xml2json/file-backing_basic-unmap-ignore.json | 64 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-unmap-ignore.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap.json | 63 ++++++++++++++++++= +++ .../xml2json/file-backing_basic-unmap.xml | 35 ++++++++++++ 10 files changed, 396 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-det= ect.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-det= ect.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap-detect.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap-detect.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap-discard.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap-ignore.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap-ignore.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unm= ap.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 34509be543..4a2051da57 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -465,6 +465,11 @@ mymain(void) TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption"); TEST_DISK_TO_JSON("network-qcow2-backing-chain-encryption_auth"); + TEST_DISK_TO_JSON("file-backing_basic-unmap"); + TEST_DISK_TO_JSON("file-backing_basic-unmap-detect"); + TEST_DISK_TO_JSON("file-backing_basic-unmap-ignore"); + TEST_DISK_TO_JSON("file-backing_basic-detect"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.jso= n b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json new file mode 100644 index 0000000000..c1e4c40757 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json @@ -0,0 +1,60 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "detect-zeroes": "on", + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml= b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml new file mode 100644 index 0000000000..99c4d58534 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-dete= ct.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.= json new file mode 100644 index 0000000000..b00008dd54 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json @@ -0,0 +1,64 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "unmap", + "detect-zeroes": "unmap", + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "discard": "unmap", + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "discard": "unmap", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "unmap", + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-dete= ct.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.x= ml new file mode 100644 index 0000000000..afccea8b61 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-disc= ard.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discar= d.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-igno= re.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.= json new file mode 100644 index 0000000000..5419deafc0 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json @@ -0,0 +1,64 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "ignore", + "detect-zeroes": "on", + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "discard": "ignore", + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "discard": "ignore", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "ignore", + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-igno= re.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.x= ml new file mode 100644 index 0000000000..8cd4bb90e4 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json= b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json new file mode 100644 index 0000000000..1efc462c06 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json @@ -0,0 +1,63 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "unmap", + "driver": "qcow", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "discard": "unmap", + "driver": "qed", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "discard": "unmap", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "unmap", + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml = b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml new file mode 100644 index 0000000000..4c7356b178 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 20:12:09 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524151596384118.39285033826741; Thu, 19 Apr 2018 08:26:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1193804F3; Thu, 19 Apr 2018 15:26:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72FB58272A; Thu, 19 Apr 2018 15:26:34 +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 09FE24CAB8; Thu, 19 Apr 2018 15:26:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3JFQIMA022234 for ; Thu, 19 Apr 2018 11:26:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0047584424; Thu, 19 Apr 2018 15:26:18 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-221.brq.redhat.com [10.40.204.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C035784420; Thu, 19 Apr 2018 15:26:16 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 19 Apr 2018 17:25:27 +0200 Message-Id: <7a9daf14861115894dc20b245160a0bb18c14143.1524151023.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, Peter Krempa Subject: [libvirt] [RFC PATCH 30/30] tests: qemublock: Test handling of all cache modes 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 19 Apr 2018 15:26:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test cases would correspond to the following -drive command lines: dir-fat-cache.xml: -drive file=3Dfat:/var/somefiles,if=3Dnone,id=3Ddrive-dummy,readonly=3Don,c= ache=3Ddirectsync -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Doff file-backing_basic-cache-directsync.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow2,if=3Dnone,id=3Ddrive= -dummy,cache=3Ddirectsync -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Doff file-backing_basic-cache-none.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow2,if=3Dnone,id=3Ddrive= -dummy,cache=3Dnone -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Don file-backing_basic-cache-unsafe.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow2,if=3Dnone,id=3Ddrive= -dummy,cache=3Dunsafe -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Don file-backing_basic-cache-writeback.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow2,if=3Dnone,id=3Ddrive= -dummy,cache=3Dwriteback -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Don file-backing_basic-cache-writethrough.xml: -drive file=3D/var/lib/libvirt/images/a,format=3Dqcow2,if=3Dnone,id=3Ddrive= -dummy,cache=3Dwritethrough -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Doff network-qcow2-backing-chain-cache-unsafe.xml: -drive file=3Drbd:rbdpool/rbdimg:id=3Dtestuser-rbd:auth_supported=3Dcephx\;= none: mon_host=3Dhost1.example.com\;host2.example.com, file.password-secret=3Dnode-a-s-secalias,format=3Dqcow2, if=3Dnone,id=3Ddrive-dummy,cache=3Ddirectsync -device virtio-blk-pci,scsi=3Doff,drive=3Ddrive-dummy,id=3Ddummy,write-cach= e=3Doff --- tests/qemublocktest.c | 8 ++ .../qemublocktestdata/xml2json/dir-fat-cache.json | 22 ++++++ tests/qemublocktestdata/xml2json/dir-fat-cache.xml | 10 +++ .../file-backing_basic-cache-directsync.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-directsync.xml | 35 +++++++++ .../xml2json/file-backing_basic-cache-none.json | 91 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-cache-none.xml | 35 +++++++++ .../xml2json/file-backing_basic-cache-unsafe.json | 91 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-cache-unsafe.xml | 35 +++++++++ .../file-backing_basic-cache-writeback.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-writeback.xml | 35 +++++++++ .../file-backing_basic-cache-writethrough.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-writethrough.xml | 35 +++++++++ .../network-qcow2-backing-chain-cache-unsafe.json | 57 ++++++++++++++ .../network-qcow2-backing-chain-cache-unsafe.xml | 25 ++++++ 15 files changed, 752 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-cache.json create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-cache.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-directsync.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-directsync.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-none.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-none.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-unsafe.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-unsafe.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-writeback.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-writeback.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-writethrough.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-cac= he-writethrough.xml create mode 100644 tests/qemublocktestdata/xml2json/network-qcow2-backing-= chain-cache-unsafe.json create mode 100644 tests/qemublocktestdata/xml2json/network-qcow2-backing-= chain-cache-unsafe.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 4a2051da57..a888eab524 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -470,6 +470,14 @@ mymain(void) TEST_DISK_TO_JSON("file-backing_basic-unmap-ignore"); TEST_DISK_TO_JSON("file-backing_basic-detect"); + TEST_DISK_TO_JSON("file-backing_basic-cache-none"); + TEST_DISK_TO_JSON("file-backing_basic-cache-writethrough"); + TEST_DISK_TO_JSON("file-backing_basic-cache-writeback"); + TEST_DISK_TO_JSON("file-backing_basic-cache-directsync"); + TEST_DISK_TO_JSON("file-backing_basic-cache-unsafe"); + TEST_DISK_TO_JSON("network-qcow2-backing-chain-cache-unsafe"); + TEST_DISK_TO_JSON("dir-fat-cache"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache.json b/tests/qe= mublocktestdata/xml2json/dir-fat-cache.json new file mode 100644 index 0000000000..8c0a045ed5 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.json @@ -0,0 +1,22 @@ +{ + "node-name": "node-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "vvfat", + "dir": "/var/somefiles", + "floppy": false, + "rw": false, + "node-name": "node-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache.xml b/tests/qem= ublocktestdata/xml2json/dir-fat-cache.xml new file mode 100644 index 0000000000..32143512d1 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dire= ctsync.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dir= ectsync.json new file mode 100644 index 0000000000..023caf013f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= json @@ -0,0 +1,91 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dire= ctsync.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-dire= ctsync.xml new file mode 100644 index 0000000000..208a3a6c40 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none= .json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json new file mode 100644 index 0000000000..023caf013f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json @@ -0,0 +1,91 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none= .xml b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.xml new file mode 100644 index 0000000000..c7b020684f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsa= fe.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.= json new file mode 100644 index 0000000000..5f6b94a9d5 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json @@ -0,0 +1,91 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "cache": { + "direct": false, + "no-flush": true + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": true + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": true + }, + "driver": "qcow2", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": true + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": true + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsa= fe.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.x= ml new file mode 100644 index 0000000000..ff0f37280a --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.json new file mode 100644 index 0000000000..9dc7d38850 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.j= son @@ -0,0 +1,91 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= eback.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-write= back.xml new file mode 100644 index 0000000000..35dd653adc --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.x= ml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= ethrough.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-w= ritethrough.json new file mode 100644 index 0000000000..9dc7d38850 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.json @@ -0,0 +1,91 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/a", + "node-name": "node-a-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/b", + "node-name": "node-b-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-c-f" +} +{ + "node-name": "node-c-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "cache": { + "direct": false, + "no-flush": false + }, + "driver": "raw", + "file": { + "driver": "file", + "filename": "/var/lib/libvirt/images/d", + "node-name": "node-d-s", + "cache": { + "direct": false, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writ= ethrough.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-wr= itethrough.xml new file mode 100644 index 0000000000..1b4d9b6697 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-c= ache-unsafe.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-c= hain-cache-unsafe.json new file mode 100644 index 0000000000..de4be359cb --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.json @@ -0,0 +1,57 @@ +{ + "node-name": "node-b-f", + "read-only": false, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "rbd", + "pool": "rbdpool", + "image": "rbdimg", + "server": [ + { + "host": "host1.example.com", + "port": "0" + }, + { + "host": "host2.example.com", + "port": "0" + } + ], + "user": "testuser-rbd", + "node-name": "node-a-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": false, + "discard": "unmap" + }, + "backing": "node-b-f" +} +{ + "node-name": "node-b-f", + "read-only": true, + "cache": { + "direct": true, + "no-flush": false + }, + "driver": "qcow2", + "file": { + "driver": "iscsi", + "portal": "example.org:3260", + "target": "iscsitarget", + "lun": 1, + "transport": "tcp", + "node-name": "node-b-s", + "cache": { + "direct": true, + "no-flush": false + }, + "read-only": true, + "discard": "unmap" + }, + "backing": null +} diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-c= ache-unsafe.xml b/tests/qemublocktestdata/xml2json/network-qcow2-backing-ch= ain-cache-unsafe.xml new file mode 100644 index 0000000000..abd48227e3 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list