From nobody Sun Apr 28 12:44:28 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 1524669362444363.4382395001894; Wed, 25 Apr 2018 08:16:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B4B43188CC4; Wed, 25 Apr 2018 15:15: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 C599E31340A0; Wed, 25 Apr 2018 15:15: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 D8BEE4CA9F; Wed, 25 Apr 2018 15:15:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFsLT020086 for ; Wed, 25 Apr 2018 11:15:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 81E9E2024CA4; Wed, 25 Apr 2018 15:15:54 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEE552023239; Wed, 25 Apr 2018 15:15:53 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:09 +0200 Message-Id: <2a167ce98b0137205be80ca3a770bac7b96eeb5c.1524668968.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 01/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 25 Apr 2018 15:16:01 +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 Reviewed-by: John Ferlan --- 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 b0257068da..21a6c4785a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8734,6 +8734,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 7484b00e23..542c625962 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14670,6 +14670,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669670762526.8760854639881; Wed, 25 Apr 2018 08:21:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67F4061B8C; Wed, 25 Apr 2018 15:21: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 485E13133BE0; Wed, 25 Apr 2018 15:21: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 14DFD4CAA2; Wed, 25 Apr 2018 15:21:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFtWb020091 for ; Wed, 25 Apr 2018 11:15:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 612382023430; Wed, 25 Apr 2018 15:15:55 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE241202342F; Wed, 25 Apr 2018 15:15:54 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:10 +0200 Message-Id: <5f1e5015059acb3eccf605889bb397e2ec82c9fe.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 02/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 25 Apr 2018 15:21:09 +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 Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 12 ++++++++++++ tests/qemustatusxml2xmldata/modern-in.xml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 326c939c85..2c5de9508b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1937,6 +1937,9 @@ static int qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src) { + src->nodestorage =3D virXPathString("string(./nodenames/nodename[@type= =3D'storage']/@name)", ctxt); + src->nodeformat =3D virXPathString("string(./nodenames/nodename[@type= =3D'format']/@name)", ctxt); + if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0) return -1; @@ -1948,6 +1951,15 @@ static int qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, virBufferPtr buf) { + if (src->nodestorage || src->nodeformat) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + virBufferEscapeString(buf, "\n", src->nodestorage); + virBufferEscapeString(buf, "\n", src->nodeformat); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0) return -1; diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxm= l2xmldata/modern-in.xml index c1e57618b6..d57e1f605f 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -309,6 +309,10 @@ + + + + base.qcow2 --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669687832938.7788053597566; Wed, 25 Apr 2018 08:21:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0D5837F43; Wed, 25 Apr 2018 15:21:25 +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 415F81BCEA; Wed, 25 Apr 2018 15:21:25 +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 C69BF180596F; Wed, 25 Apr 2018 15:21:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFuHB020099 for ; Wed, 25 Apr 2018 11:15:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4022C202342F; Wed, 25 Apr 2018 15:15:56 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D1202026E0E; Wed, 25 Apr 2018 15:15:55 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:11 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 03/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 25 Apr 2018 15:21:26 +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 Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669366779962.0931163142751; Wed, 25 Apr 2018 08:16:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F37475F7AD; Wed, 25 Apr 2018 15:16:02 +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 6BF9631340A1; Wed, 25 Apr 2018 15:16: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 93DEE4CAA1; Wed, 25 Apr 2018 15:16:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFvcd020106 for ; Wed, 25 Apr 2018 11:15:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F7672026E0E; Wed, 25 Apr 2018 15:15:57 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C76E2023430; Wed, 25 Apr 2018 15:15:56 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:12 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 04/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 25 Apr 2018 15:16:05 +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 Reviewed-by: John Ferlan --- 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 2c5de9508b..109f4f7f36 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11844,6 +11844,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 && @@ -11854,6 +11857,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669709397259.6813683014087; Wed, 25 Apr 2018 08:21:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 776538046E; Wed, 25 Apr 2018 15:21: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 A4B403133BE3; Wed, 25 Apr 2018 15:21:45 +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 08BF4180BADA; Wed, 25 Apr 2018 15:21:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFwtH020114 for ; Wed, 25 Apr 2018 11:15:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id F37E2202323A; Wed, 25 Apr 2018 15:15:57 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B8CF202342F; Wed, 25 Apr 2018 15:15:57 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:13 +0200 Message-Id: <1980f04ec8a53eefda3874b77cdb218e532e4f08.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 05/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 25 Apr 2018 15:21:48 +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 Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669640266863.1265235456004; Wed, 25 Apr 2018 08:20:40 -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 86D8F30BA352; Wed, 25 Apr 2018 15:20: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 06D408618C; Wed, 25 Apr 2018 15:20: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 0823F18033EB; Wed, 25 Apr 2018 15:20:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFwKi020121 for ; Wed, 25 Apr 2018 11:15:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1E31202698A; Wed, 25 Apr 2018 15:15:58 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AB1A2026E0E; Wed, 25 Apr 2018 15:15:58 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:14 +0200 Message-Id: <1d4fdb33a63d4453fd691e4c230f9f343db54068.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 06/35] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 25 Apr 2018 15:20:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669693596360.0301884182436; Wed, 25 Apr 2018 08:21:33 -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 229B430014A5; Wed, 25 Apr 2018 15:21:31 +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 DA9306B8D1; Wed, 25 Apr 2018 15:21: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 9DF4A4CAA5; Wed, 25 Apr 2018 15:21:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFFxDS020129 for ; Wed, 25 Apr 2018 11:16:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id B10C0202342F; Wed, 25 Apr 2018 15:15:59 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19A272023430; Wed, 25 Apr 2018 15:15:58 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:15 +0200 Message-Id: <85540de54501b81f275ff406cece47383927f367.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 07/35] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 25 Apr 2018 15:21:32 +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 Reviewed-by: John Ferlan --- 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 109f4f7f36..f8254bfdd5 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11862,6 +11862,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669658251395.65349092437486; Wed, 25 Apr 2018 08:20:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C8F830BB7DB; Wed, 25 Apr 2018 15:20:56 +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 CE7FF1BCE4; Wed, 25 Apr 2018 15:20:55 +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 ABE084CA9E; Wed, 25 Apr 2018 15:20:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG07d020134 for ; Wed, 25 Apr 2018 11:16:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90B3A2026E0E; Wed, 25 Apr 2018 15:16:00 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED0F9202323B; Wed, 25 Apr 2018 15:15:59 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:16 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 08/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 25 Apr 2018 15:20:57 +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 Reviewed-by: John Ferlan --- 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 418729b988..ecf28d3d1d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1520,20 +1520,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 f8254bfdd5..9f94809fd1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4128,6 +4128,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")); @@ -4157,6 +4159,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669724767213.99292938680503; Wed, 25 Apr 2018 08:22: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 CD97C87621; Wed, 25 Apr 2018 15:22:02 +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 F32F66A6A7; Wed, 25 Apr 2018 15:22:01 +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 F3F104CAA8; Wed, 25 Apr 2018 15:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG1TB020144 for ; Wed, 25 Apr 2018 11:16:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FA682023430; Wed, 25 Apr 2018 15:16:01 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCCD0202342F; Wed, 25 Apr 2018 15:16:00 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:17 +0200 Message-Id: <53a7d5ca9098fe3a85e5cb87aace02af4c9b8155.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 09/35] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 25 Apr 2018 15:22:03 +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 Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669672092442.90790752248415; Wed, 25 Apr 2018 08:21:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E17543B564; Wed, 25 Apr 2018 15:21:09 +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 1278031419E1; Wed, 25 Apr 2018 15:21:09 +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 54AD9180596F; Wed, 25 Apr 2018 15:21:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG2VF020149 for ; Wed, 25 Apr 2018 11:16:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4ED99202342F; Wed, 25 Apr 2018 15:16:02 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB98B2026E0E; Wed, 25 Apr 2018 15:16:01 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:18 +0200 Message-Id: <6b0e27d747c5375628457d2699c9a60a8e9be83d.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 10/35] util: file: Use only one #ifdef for __linux__ 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 25 Apr 2018 15:21:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/util/virfile.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index e12a584ca1..24f866525f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -57,11 +57,10 @@ # include # endif # include -#endif - -#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR -# include -# include +# if HAVE_DECL_LO_FLAGS_AUTOCLEAR +# include +# include +# endif #endif #include "configmake.h" --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669693026865.8538387758886; Wed, 25 Apr 2018 08:21:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD12930BEBC8; Wed, 25 Apr 2018 15:21:30 +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 863DF2015C00; Wed, 25 Apr 2018 15:21: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 9543D4CAA4; Wed, 25 Apr 2018 15:21:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG3NT020159 for ; Wed, 25 Apr 2018 11:16:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2D7412023239; Wed, 25 Apr 2018 15:16:03 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A8682023430; Wed, 25 Apr 2018 15:16:02 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:19 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 11/35] util: file: Add helper to determine whether a path is a CDROM 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 25 Apr 2018 15:21:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add detection mechanism which will allow to check whether a path to a block device is a physical CDROM drive. This will be useful once we will need to pass it to hypervisors. The linux implementation uses an ioctl to do the detection, while the fallback uses a simple string prefix match. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/libvirt_private.syms | 1 + src/util/virfile.c | 56 ++++++++++++++++++++++++++++++++++++++++++++= +++- src/util/virfile.h | 2 ++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d2728749fb..4f911c10a8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1781,6 +1781,7 @@ virFileGetMountSubtree; virFileHasSuffix; virFileInData; virFileIsAbsPath; +virFileIsCdrom; virFileIsDir; virFileIsExecutable; virFileIsLink; diff --git a/src/util/virfile.c b/src/util/virfile.c index 24f866525f..ad59b7015b 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -59,8 +59,9 @@ # include # if HAVE_DECL_LO_FLAGS_AUTOCLEAR # include -# include # endif +# include +# include #endif #include "configmake.h" @@ -1938,6 +1939,59 @@ int virFileIsMountPoint(const char *file) } +#if defined(__linux__) +/** + * virFileIsCdrom: + * @filename: File to check + * + * Returns 1 if @filename is a cdrom device 0 if it is not a cdrom and -1 = on + * error. 'errno' of the failure is preserved and no libvirt errors are + * reported. + */ +int +virFileIsCdrom(const char *filename) +{ + struct stat st; + int fd; + int ret =3D -1; + + if ((fd =3D open(filename, O_RDONLY | O_NONBLOCK)) < 0) + goto cleanup; + + if (fstat(fd, &st) < 0) + goto cleanup; + + if (!S_ISBLK(st.st_mode)) { + ret =3D 0; + goto cleanup; + } + + /* Attempt to detect via a CDROM specific ioctl */ + if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) >=3D 0) + ret =3D 1; + else + ret =3D 0; + + cleanup: + VIR_FORCE_CLOSE(fd); + return ret; +} + +#else + +int +virFileIsCdrom(const char *filename) +{ + if (STRPREFIX(filename, "/dev/cd", NULL) || + STRPREFIX(filename, "/dev/acd", NULL)) + return 1; + + return 0; +} + +#endif /* defined(__linux__) */ + + #if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R static int virFileGetMountSubtreeImpl(const char *mtabpath, diff --git a/src/util/virfile.h b/src/util/virfile.h index cd2a3867c2..8ab7d2d6a6 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -207,6 +207,8 @@ enum { int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL= (1); int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1); int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1); +int virFileIsCdrom(const char *filename) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; int virFileGetMountSubtree(const char *mtabpath, const char *prefix, --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 152466970828768.22292756445256; Wed, 25 Apr 2018 08:21:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBA65883BC; Wed, 25 Apr 2018 15:21: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 3D6463133BE0; Wed, 25 Apr 2018 15:21:45 +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 EDD57180BAD9; Wed, 25 Apr 2018 15:21:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG4MC020170 for ; Wed, 25 Apr 2018 11:16:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0CA8D2024CA4; Wed, 25 Apr 2018 15:16:04 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 690A9202323B; Wed, 25 Apr 2018 15:16:03 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:20 +0200 Message-Id: <2de2db4e9795c5d51049c093d925b65de5ca6c2b.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 12/35] qemu: domain: Store whether a virStorageSource is a host CDROM drive 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 25 Apr 2018 15:21:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use virFileIsCdrom to detect whether a block device is a cdrom drive and store it in virStorageSource. This will be necessary to correctly create the 'host_cdrom' backend in qemu when using -blockdev. We assume that host_cdrom makes only sense when used directly as a raw image, but if a backing chain would be put in front of it, libvirt will use 'host_device' in that case. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 8 ++++++++ src/util/virstoragefile.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9f94809fd1..86e40e13e0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7545,6 +7545,14 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, VIR_ALLOC(src->backingStore) < 0) goto cleanup; + /* host cdrom requires special treatment in qemu, so we need to ch= eck + * whether a block device is a cdrom */ + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM && + src->format =3D=3D VIR_STORAGE_FILE_RAW && + virStorageSourceIsBlockLocal(src) && + virFileIsCdrom(src->path) =3D=3D 1) + src->hostcdrom =3D true; + ret =3D 0; goto cleanup; } diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 57d39f98c2..c8a4a288b1 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -316,6 +316,8 @@ struct _virStorageSource { bool floppyimg; /* set to true if the storage source is going to be us= ed as a source for floppy drive */ + + bool hostcdrom; /* backing device is a cdrom */ }; --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 15246697248801014.4589561596358; Wed, 25 Apr 2018 08:22:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A48B30FA04E; Wed, 25 Apr 2018 15:22:02 +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 CA60B170F2; Wed, 25 Apr 2018 15:22:01 +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 E8C5A4CAA7; Wed, 25 Apr 2018 15:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG5U4020175 for ; Wed, 25 Apr 2018 11:16:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id DF90F2023239; Wed, 25 Apr 2018 15:16:04 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47DC1202342F; Wed, 25 Apr 2018 15:16:04 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:21 +0200 Message-Id: <5311dc0be2cd5b45df231c575d48e68a70d2c396.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 13/35] qemu: block: Properly handle block storage in JSON 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Apr 2018 15:22:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Block storage should actually be passed to qemu via 'host_device' or 'host_cdrom' according to the device type. There were no users of this behaviour so we thankfully can change it. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_block.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 516b006ce9..bf330f8238 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -977,14 +977,22 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr= src) static virJSONValuePtr qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src) { + const char *driver =3D "file"; const char *iomode =3D NULL; virJSONValuePtr ret =3D NULL; if (src->iomode !=3D VIR_DOMAIN_DISK_IO_DEFAULT) iomode =3D virDomainDiskIoTypeToString(src->iomode); + if (virStorageSourceIsBlockLocal(src)) { + if (src->hostcdrom) + driver =3D "host_cdrom"; + else + driver =3D "host_device"; + } + ignore_value(virJSONValueObjectCreate(&ret, - "s:driver", "file", + "s:driver", driver, "s:filename", src->path, "S:aio", iomode, NULL) < 0); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669709659806.8713264148115; Wed, 25 Apr 2018 08:21:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF20730BA359; Wed, 25 Apr 2018 15:21:47 +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 94C883133BE4; Wed, 25 Apr 2018 15:21:46 +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 243C7180BAD5; Wed, 25 Apr 2018 15:21:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG5BU020181 for ; Wed, 25 Apr 2018 11:16:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id BF0E6202698A; Wed, 25 Apr 2018 15:16:05 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 275782026E0E; Wed, 25 Apr 2018 15:16:05 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:22 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 14/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 25 Apr 2018 15:21:48 +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 Reviewed-by: John Ferlan --- 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 bf330f8238..29fc7edf61 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", @@ -1022,12 +1023,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; @@ -1054,7 +1057,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 ecf28d3d1d..a917eb52b1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1458,7 +1458,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669736281255.64329371899157; Wed, 25 Apr 2018 08:22:16 -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 465B43003A23; Wed, 25 Apr 2018 15:22:14 +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 BDE3486C5B; Wed, 25 Apr 2018 15:22: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 E8707180BAE9; Wed, 25 Apr 2018 15:22:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG6TT020190 for ; Wed, 25 Apr 2018 11:16:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E38A2023239; Wed, 25 Apr 2018 15:16:06 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06B0C2023430; Wed, 25 Apr 2018 15:16:05 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:23 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 15/35] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 25 Apr 2018 15:22:15 +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 Reviewed-by: John Ferlan --- 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 29fc7edf61..e3ee169368 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, @@ -1107,7 +1125,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669749422170.67788806326166; Wed, 25 Apr 2018 08:22:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E638FC04B94A; Wed, 25 Apr 2018 15:22:27 +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 714B458B1; Wed, 25 Apr 2018 15:22:27 +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 8C6A31808873; Wed, 25 Apr 2018 15:22:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG7Ew020197 for ; Wed, 25 Apr 2018 11:16:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7DAEB2024CA4; Wed, 25 Apr 2018 15:16:07 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA135202323B; Wed, 25 Apr 2018 15:16:06 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:24 +0200 Message-Id: <8efbcb5d25db4970babf42f83753faa5deef6534.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 16/35] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 25 Apr 2018 15:22:28 +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 Reviewed-by: John Ferlan --- 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 e3ee169368..3c04707618 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1038,6 +1038,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 @@ -1052,6 +1081,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: @@ -1126,10 +1156,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669728174591.2399027958949; Wed, 25 Apr 2018 08:22:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8179681DFA; Wed, 25 Apr 2018 15:22:06 +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 03DBF17788; Wed, 25 Apr 2018 15:22:06 +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 BEB8E180BADB; Wed, 25 Apr 2018 15:22:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG8QT020202 for ; Wed, 25 Apr 2018 11:16:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C6CA2023239; Wed, 25 Apr 2018 15:16:08 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8F07202342F; Wed, 25 Apr 2018 15:16:07 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:25 +0200 Message-Id: <6c04e04fc4f627b840a29e30132b9b0d39837f48.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 17/35] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 25 Apr 2018 15:22:07 +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 Reviewed-by: John Ferlan --- 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 3c04707618..b1f495b731 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1162,6 +1162,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669736270697.154067310609; Wed, 25 Apr 2018 08:22:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D763030FA030; Wed, 25 Apr 2018 15:22:13 +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 8086A1BCEA; Wed, 25 Apr 2018 15:22: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 DB8BE4CAA2; Wed, 25 Apr 2018 15:22:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFG99g020207 for ; Wed, 25 Apr 2018 11:16:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C94C202698A; Wed, 25 Apr 2018 15:16:09 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 998572026E0E; Wed, 25 Apr 2018 15:16:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:26 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 18/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Apr 2018 15:22:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Enabling discard for the storage node allows the format drivers to discard snapshots and other things, while configuration of the format layer actually decides whether to actually discard data on request from the host. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- 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 b1f495b731..6e76571796 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1163,7 +1163,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669747245354.0008813338701; Wed, 25 Apr 2018 08:22:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2469D30014D9; Wed, 25 Apr 2018 15:22:25 +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 6046B3133BE4; Wed, 25 Apr 2018 15:22: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 BF5FA4CAA2; Wed, 25 Apr 2018 15:22:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGAoi020216 for ; Wed, 25 Apr 2018 11:16:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1BF4D2024CA4; Wed, 25 Apr 2018 15:16:10 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78B852023239; Wed, 25 Apr 2018 15:16:09 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:27 +0200 Message-Id: <224ab508b944913db134cd64486327937191aae4.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 19/35] 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 25 Apr 2018 15:22:26 +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 Reviewed-by: John Ferlan --- 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 6e76571796..5231c2707a 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1176,3 +1176,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669765892203.2724498296095; Wed, 25 Apr 2018 08:22:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C5B830FA042; Wed, 25 Apr 2018 15:22:42 +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 A711E1BCE4; Wed, 25 Apr 2018 15:22:41 +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 AE4D04CAB1; Wed, 25 Apr 2018 15:22:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGBBa020221 for ; Wed, 25 Apr 2018 11:16:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id EED0A2023239; Wed, 25 Apr 2018 15:16:10 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57976202342F; Wed, 25 Apr 2018 15:16:10 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:28 +0200 Message-Id: <7832aa5232ca69de193f94d6c2bcc7b43eabf17e.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 20/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Apr 2018 15:22:43 +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 Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669759494165.21030234804277; Wed, 25 Apr 2018 08:22:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7D6530BEBF0; Wed, 25 Apr 2018 15:22:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6605E58B1; Wed, 25 Apr 2018 15:22: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 BC158180BAD3; Wed, 25 Apr 2018 15:22:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGBku020231 for ; Wed, 25 Apr 2018 11:16:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id CE2E32024CA4; Wed, 25 Apr 2018 15:16:11 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3694C2026E0E; Wed, 25 Apr 2018 15:16:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:29 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 21/35] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 25 Apr 2018 15:22:38 +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 Reviewed-by: John Ferlan --- 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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669774422953.8973267991113; Wed, 25 Apr 2018 08:22:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7480281DFA; Wed, 25 Apr 2018 15:22:52 +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 BA67758B1; Wed, 25 Apr 2018 15:22:51 +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 CDB72180BADB; Wed, 25 Apr 2018 15:22:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGC3p020241 for ; Wed, 25 Apr 2018 11:16:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id AD1A62023239; Wed, 25 Apr 2018 15:16:12 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 157812023430; Wed, 25 Apr 2018 15:16:11 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:30 +0200 Message-Id: <48cdd581c7b8e9e572a3a81466f765b6d68c0126.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 22/35] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 25 Apr 2018 15:22:53 +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 Reviewed-by: John Ferlan --- 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 86e40e13e0..079655de87 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4186,7 +4186,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669742005771.7277801544776; Wed, 25 Apr 2018 08:22:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CADA930BA35D; Wed, 25 Apr 2018 15:22:19 +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 2AA561BCEA; Wed, 25 Apr 2018 15:22:19 +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 6BDD54CAA6; Wed, 25 Apr 2018 15:22:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGDbW020253 for ; Wed, 25 Apr 2018 11:16:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C6ED2026E0E; Wed, 25 Apr 2018 15:16:13 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8B2B202323B; Wed, 25 Apr 2018 15:16:12 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:31 +0200 Message-Id: <862270f2bdd61a062a03b4a1e23f56b8b0799898.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 23/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 25 Apr 2018 15:22:21 +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 Reviewed-by: John Ferlan --- 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 079655de87..564e4e7957 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11881,7 +11881,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.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669754092812.9681892346314; Wed, 25 Apr 2018 08:22:34 -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 39EBF81E04; Wed, 25 Apr 2018 15:22:32 +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 C626E5D75E; Wed, 25 Apr 2018 15:22:31 +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 05A54180BADB; Wed, 25 Apr 2018 15:22:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGEq6020306 for ; Wed, 25 Apr 2018 11:16:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6ADFE2023239; Wed, 25 Apr 2018 15:16:14 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7990202342F; Wed, 25 Apr 2018 15:16:13 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:32 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 24/35] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 25 Apr 2018 15:22:33 +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 Reviewed-by: John Ferlan --- tests/Makefile.am | 3 + tests/qemublocktest.c | 227 +++++++++++++++++= ++++ .../xml2json/nodename-long-format.xml | 12 ++ .../xml2json/nodename-long-protocol.xml | 12 ++ 4 files changed, 254 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..8fccf850db --- /dev/null +++ b/tests/qemublocktestdata/xml2json/nodename-long-format.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/qemublocktestdata/xml2json/nodename-long-protocol.xml b/= tests/qemublocktestdata/xml2json/nodename-long-protocol.xml new file mode 100644 index 0000000000..e60d988325 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/nodename-long-protocol.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669775634884.4377547698474; Wed, 25 Apr 2018 08:22:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDFF23004418; Wed, 25 Apr 2018 15:22:53 +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 0C2C631419E4; Wed, 25 Apr 2018 15:22:53 +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 DA81E180BAE8; Wed, 25 Apr 2018 15:22:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGFM1020409 for ; Wed, 25 Apr 2018 11:16:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B307202698A; Wed, 25 Apr 2018 15:16:15 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A700F2026E0E; Wed, 25 Apr 2018 15:16:14 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:33 +0200 Message-Id: <50d6f0657c2218242c9d92408bf03a42adcd9a65.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 25/35] 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 25 Apr 2018 15:22:54 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 2 ++ tests/qemublocktestdata/xml2json/file-raw-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-raw-noopts.xml | 12 ++++++++++++ 3 files changed, 26 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..8255e64eb7 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669788481386.615813893637; Wed, 25 Apr 2018 08:23:08 -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 8C4C737EEA; Wed, 25 Apr 2018 15:23:06 +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 3F50F7A24A; Wed, 25 Apr 2018 15:23:06 +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 8EB744CAA8; Wed, 25 Apr 2018 15:23:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGG6l020441 for ; Wed, 25 Apr 2018 11:16:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2AA712023239; Wed, 25 Apr 2018 15:16:16 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8735F2023430; Wed, 25 Apr 2018 15:16:15 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:34 +0200 Message-Id: <567c92f0052d22b25e7c1d4e22d2acecb0961f31.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 26/35] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 25 Apr 2018 15:23:07 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 7 +++++++ tests/qemublocktestdata/xml2json/file-bochs-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-bochs-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-cloop-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-cloop-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-dmg-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-dmg-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-ploop-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-ploop-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vdi-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vdi-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vhd-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vhd-noopts.xml | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vpc-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/file-vpc-noopts.xml | 12 ++++++++++++ 15 files changed, 175 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..23da6c4feb --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-bochs-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..4dff296983 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-cloop-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..3650a1758f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-dmg-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..5435c4d8d7 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-ploop-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..3fa489e24b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vdi-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..25fd1ba7b0 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vhd-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + 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..d761bb33cc --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-vpc-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669788109183.49719516154119; Wed, 25 Apr 2018 08:23:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFD2C8765D; Wed, 25 Apr 2018 15:23:05 +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 74B1731419E5; Wed, 25 Apr 2018 15:23:05 +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 8C6C2180BAD4; Wed, 25 Apr 2018 15:23:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGHit020580 for ; Wed, 25 Apr 2018 11:16:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0ADF82024CA4; Wed, 25 Apr 2018 15:16:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 675E9202323B; Wed, 25 Apr 2018 15:16:16 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:35 +0200 Message-Id: <849aba8879ec3908033e3636525753fa45e06ae4.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 27/35] 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 25 Apr 2018 15:23:07 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 2 + .../xml2json/file-backing_basic-noopts.json | 51 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-noopts.xml | 46 +++++++++++++++++++ 3 files changed, 99 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..7c48433aec --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 152466980084420.198377981691237; Wed, 25 Apr 2018 08:23:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AF4730BEA59; Wed, 25 Apr 2018 15:23: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 ADC062010CAE; Wed, 25 Apr 2018 15:23: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 D5854180BAD4; Wed, 25 Apr 2018 15:23:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGH4e020590 for ; Wed, 25 Apr 2018 11:16:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE7002023430; Wed, 25 Apr 2018 15:16:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46410202342F; Wed, 25 Apr 2018 15:16:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:36 +0200 Message-Id: <27b24fab32c22802f48fbfa9b35cde7f9a0cd6f8.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 28/35] 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 25 Apr 2018 15:23:19 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 2 ++ tests/qemublocktestdata/xml2json/dir-fat-floppy.json | 14 ++++++++++++++ tests/qemublocktestdata/xml2json/dir-fat-floppy.xml | 14 ++++++++++++++ tests/qemublocktestdata/xml2json/dir-fat-readonly.json | 14 ++++++++++++++ tests/qemublocktestdata/xml2json/dir-fat-readonly.xml | 13 +++++++++++++ 5 files changed, 57 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..8f085a1832 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + +
+ + 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..9ac24b5d41 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669800619436.12989705512064; Wed, 25 Apr 2018 08:23:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F14C30BB7C0; Wed, 25 Apr 2018 15:23: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 AEC3B1BCE7; Wed, 25 Apr 2018 15:23: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 C1A6E18033EB; Wed, 25 Apr 2018 15:23:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGIfe020614 for ; Wed, 25 Apr 2018 11:16:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id BDFED202342F; Wed, 25 Apr 2018 15:16:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 266012026E0E; Wed, 25 Apr 2018 15:16:18 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:37 +0200 Message-Id: <926f85b812f12b2dc2d2f14462e2e5110281117f.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 29/35] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 25 Apr 2018 15:23:18 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 2 + .../xml2json/file-backing_basic-aio_threads.json | 62 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-aio_threads.xml | 47 ++++++++++++++++ .../xml2json/file-raw-aio_native.json | 21 ++++++++ .../xml2json/file-raw-aio_native.xml | 12 +++++ 5 files changed, 144 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..ad84fab720 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..470b60f26b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669768048682.5376305248192; Wed, 25 Apr 2018 08:22:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6773585543; Wed, 25 Apr 2018 15:22:46 +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 EDE272010CA1; Wed, 25 Apr 2018 15:22:45 +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 F11754CAB4; Wed, 25 Apr 2018 15:22:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGJWn020619 for ; Wed, 25 Apr 2018 11:16:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E101202323A; Wed, 25 Apr 2018 15:16:19 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05FF42023430; Wed, 25 Apr 2018 15:16:18 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:38 +0200 Message-Id: <168ab335312906ebc10d297875db5002e310f07e.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 30/35] 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 25 Apr 2018 15:22:47 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 42 ++++++++++++++++++= ++++ .../qemublocktestdata/xml2json/file-raw-luks.json | 13 +++++++ tests/qemublocktestdata/xml2json/file-raw-luks.xml | 15 ++++++++ 3 files changed, 70 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..f446b03bdb --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-raw-luks.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669810953776.1503103063357; Wed, 25 Apr 2018 08:23:30 -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 5360630FA040; Wed, 25 Apr 2018 15:23:29 +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 D2FD58618C; Wed, 25 Apr 2018 15:23: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 AD6164CAA6; Wed, 25 Apr 2018 15:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGK12020629 for ; Wed, 25 Apr 2018 11:16:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9B534202698A; Wed, 25 Apr 2018 15:16:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA907202323B; Wed, 25 Apr 2018 15:16:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:39 +0200 Message-Id: <23d8cd555e2e2857e7ae29ca971e213073fb7a0a.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 31/35] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 25 Apr 2018 15:23:30 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 3 + .../file-qcow2-backing-chain-encryption.json | 34 ++++++ .../file-qcow2-backing-chain-encryption.xml | 31 +++++ .../xml2json/file-qcow2-backing-chain-noopts.json | 130 +++++++++++++++++= ++++ .../xml2json/file-qcow2-backing-chain-noopts.xml | 113 ++++++++++++++++++ .../file-qcow2-backing-chain-unterminated.json | 25 ++++ .../file-qcow2-backing-chain-unterminated.xml | 24 ++++ 7 files changed, 360 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..a1292284bf --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.= xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..12db679f37 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..7520cfe86a --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminate= d.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669819585704.1137825862711; Wed, 25 Apr 2018 08:23:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 053D0C04BD2B; Wed, 25 Apr 2018 15:23: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 AD1C110018F8; Wed, 25 Apr 2018 15:23: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 10C9A180BAD3; Wed, 25 Apr 2018 15:23:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGLn1020634 for ; Wed, 25 Apr 2018 11:16:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7AEDD202698A; Wed, 25 Apr 2018 15:16:21 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id D718B2022F11; Wed, 25 Apr 2018 15:16:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:40 +0200 Message-Id: <008bb1af0d1b4f89ac500cd4a5c253c2b8126760.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 32/35] 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 25 Apr 2018 15:23:38 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 1 + ...etwork-qcow2-backing-chain-encryption_auth.json | 51 ++++++++++++++++++= ++++ ...network-qcow2-backing-chain-encryption_auth.xml | 40 +++++++++++++++++ 3 files changed, 92 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..775886801b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encrypti= on_auth.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669811323276.27048945332774; Wed, 25 Apr 2018 08:23:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E4925F7AE; Wed, 25 Apr 2018 15:23:29 +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 E1E892010CAE; Wed, 25 Apr 2018 15:23: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 D13464CAA7; Wed, 25 Apr 2018 15:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGM5Q020646 for ; Wed, 25 Apr 2018 11:16:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A3E7202323A; Wed, 25 Apr 2018 15:16:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B67CE202342F; Wed, 25 Apr 2018 15:16:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:41 +0200 Message-Id: <0a1937692bfb062c05dcd77d518ec4bb5f34dc48.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 33/35] 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 25 Apr 2018 15:23:30 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 5 ++ .../xml2json/file-backing_basic-detect.json | 60 ++++++++++++++++++= ++ .../xml2json/file-backing_basic-detect.xml | 47 ++++++++++++++++ .../xml2json/file-backing_basic-unmap-detect.json | 64 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-unmap-detect.xml | 47 ++++++++++++++++ .../xml2json/file-backing_basic-unmap-discard.json | 0 .../xml2json/file-backing_basic-unmap-ignore.json | 64 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-unmap-ignore.xml | 47 ++++++++++++++++ .../xml2json/file-backing_basic-unmap.json | 63 ++++++++++++++++++= +++ .../xml2json/file-backing_basic-unmap.xml | 47 ++++++++++++++++ 10 files changed, 444 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..eaf89d316a --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..4638a78541 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..b2d599fc6c --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..68484991c1 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669779402663.0980101260922; Wed, 25 Apr 2018 08:22:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DBA983162530; Wed, 25 Apr 2018 15:22:57 +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 5CC34170F7; Wed, 25 Apr 2018 15:22:57 +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 51227180BADB; Wed, 25 Apr 2018 15:22:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGNID020656 for ; Wed, 25 Apr 2018 11:16:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57F4C202698A; Wed, 25 Apr 2018 15:16:23 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 967C8202323B; Wed, 25 Apr 2018 15:16:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:42 +0200 Message-Id: <60dffd577a498db6d0d40b344644dfd62f8a6e35.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 34/35] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 25 Apr 2018 15:22:58 +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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 8 ++ .../qemublocktestdata/xml2json/dir-fat-cache.json | 22 ++++++ tests/qemublocktestdata/xml2json/dir-fat-cache.xml | 13 ++++ .../file-backing_basic-cache-directsync.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-directsync.xml | 47 +++++++++++ .../xml2json/file-backing_basic-cache-none.json | 91 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-cache-none.xml | 47 +++++++++++ .../xml2json/file-backing_basic-cache-unsafe.json | 91 ++++++++++++++++++= ++++ .../xml2json/file-backing_basic-cache-unsafe.xml | 47 +++++++++++ .../file-backing_basic-cache-writeback.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-writeback.xml | 47 +++++++++++ .../file-backing_basic-cache-writethrough.json | 91 ++++++++++++++++++= ++++ .../file-backing_basic-cache-writethrough.xml | 47 +++++++++++ .../network-qcow2-backing-chain-cache-unsafe.json | 57 ++++++++++++++ .../network-qcow2-backing-chain-cache-unsafe.xml | 31 ++++++++ 15 files changed, 821 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..18e652a45f --- /dev/null +++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + 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..cf4197ea86 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.= xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..240afa85d2 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..e18d33ce3c --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..7040388040 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.x= ml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..d2fe1b780b --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethroug= h.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..b4ba7470af --- /dev/null +++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-un= safe.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 12:44:28 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 1524669831864800.1191940990276; Wed, 25 Apr 2018 08:23:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6E8B4E8AB; Wed, 25 Apr 2018 15:23: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 3C37F2015C00; Wed, 25 Apr 2018 15:23: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 D01E3180BAD4; Wed, 25 Apr 2018 15:23:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PFGODW020662 for ; Wed, 25 Apr 2018 11:16:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 373942023430; Wed, 25 Apr 2018 15:16:24 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94162202342F; Wed, 25 Apr 2018 15:16:23 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 17:15:43 +0200 Message-Id: <42f9720b1d5881e648565da69e0a91fd01a63f68.1524668969.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Peter Krempa Subject: [libvirt] [PATCH 35/35] tests: qemublock: Test handling of block devices 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 25 Apr 2018 15:23:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Make sure that 'host_device' is generated for type=3D'block'. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- tests/qemublocktest.c | 2 ++ tests/qemublocktestdata/xml2json/block-raw-noopts.json | 12 ++++++++++++ tests/qemublocktestdata/xml2json/block-raw-noopts.xml | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/block-raw-noopts.json create mode 100644 tests/qemublocktestdata/xml2json/block-raw-noopts.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index a888eab524..08f165d7e0 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -478,6 +478,8 @@ mymain(void) TEST_DISK_TO_JSON("network-qcow2-backing-chain-cache-unsafe"); TEST_DISK_TO_JSON("dir-fat-cache"); + TEST_DISK_TO_JSON("block-raw-noopts"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/block-raw-noopts.json b/tests= /qemublocktestdata/xml2json/block-raw-noopts.json new file mode 100644 index 0000000000..25bf77d5aa --- /dev/null +++ b/tests/qemublocktestdata/xml2json/block-raw-noopts.json @@ -0,0 +1,12 @@ +{ + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "driver": "raw", + "file": { + "driver": "host_device", + "filename": "/dev/blah", + "node-name": "0123456789ABCDEF0123456789ABCDE", + "read-only": false, + "discard": "unmap" + } +} diff --git a/tests/qemublocktestdata/xml2json/block-raw-noopts.xml b/tests/= qemublocktestdata/xml2json/block-raw-noopts.xml new file mode 100644 index 0000000000..2f319d26d0 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/block-raw-noopts.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list