From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489595993862802.6384067135391; Wed, 15 Mar 2017 09:39:53 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGajbT023585; Wed, 15 Mar 2017 12:36:45 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaiZt024868 for ; Wed, 15 Mar 2017 12:36:44 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIF000870; Wed, 15 Mar 2017 12:36:43 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:13 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 01/23] qemu: driver: Don't call qemuDomainDetermineDiskChain on block jobs 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Our code calls it when starting or re-starting the domain or when hotplugging the disk so there's nothing to be detected. --- src/qemu/qemu_driver.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2032fac71..06bd442ee 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16508,9 +16508,6 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, goto endjob; } - if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0) - goto endjob; - /* clear the _SHALLOW flag if there is only one layer */ if (!disk->src->backingStore) flags &=3D ~VIR_DOMAIN_BLOCK_COPY_SHALLOW; @@ -16890,8 +16887,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; - if (qemuDomainDetermineDiskChain(driver, vm, disk, false, true) < 0) - goto endjob; if (!top) topSource =3D disk->src; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489595997977468.9625198533255; Wed, 15 Mar 2017 09:39:57 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGaoTw016460; Wed, 15 Mar 2017 12:36:50 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGajvx024879 for ; Wed, 15 Mar 2017 12:36:45 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIG000870; Wed, 15 Mar 2017 12:36:44 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:14 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 02/23] util: buffer: Add API to set indentation level to a given value 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It will be useful to set indentation level to 0 after formatting a nested structure rather than having to track the depth. --- src/libvirt_private.syms | 1 + src/util/virbuffer.c | 19 +++++++++++++++++++ src/util/virbuffer.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 4efea0098..39e2b40c5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1303,6 +1303,7 @@ virBufferEscapeShell; virBufferEscapeString; virBufferFreeAndReset; virBufferGetIndent; +virBufferSetIndent; virBufferStrcat; virBufferTrim; virBufferURIEncodeString; diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c index 41d541b32..8f0f49d7f 100644 --- a/src/util/virbuffer.c +++ b/src/util/virbuffer.c @@ -88,6 +88,25 @@ virBufferAdjustIndent(virBufferPtr buf, int indent) buf->indent +=3D indent; } + +/** + * virBufferAdjustIndent: + * @buf: the buffer + * @indent: new indentation size. + * + * Set the auto-indent value to @indent. See virBufferAdjustIndent on how = auto + * indentation is applied. + */ +void +virBufferSetIndent(virBufferPtr buf, int indent) +{ + if (!buf || buf->error) + return; + + buf->indent =3D indent; +} + + /** * virBufferGetIndent: * @buf: the buffer diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h index 94f14b5b1..d1b64ca3a 100644 --- a/src/util/virbuffer.h +++ b/src/util/virbuffer.h @@ -95,6 +95,8 @@ void virBufferURIEncodeString(virBufferPtr buf, const cha= r *str); virBufferAdd(buf_, "" literal_string_ "", sizeof(literal_string_) - 1) void virBufferAdjustIndent(virBufferPtr buf, int indent); +void virBufferSetIndent(virBufferPtr, int indent); + int virBufferGetIndent(const virBuffer *buf, bool dynamic); void virBufferTrim(virBufferPtr buf, const char *trim, int len); --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596003896542.571626436405; Wed, 15 Mar 2017 09:40:03 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGambY016447; Wed, 15 Mar 2017 12:36:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGakTv024892 for ; Wed, 15 Mar 2017 12:36:46 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIH000870; Wed, 15 Mar 2017 12:36:45 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:15 +0100 Message-Id: <272a9bc85055fecff8bc1a1fa2b7ac3e919d3dc9.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 03/23] util: storage: Split out useful bits of virStorageFileParseChainIndex 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function has very specific semantics. Split out the part that parses the backing store specification string into a separate helper so that it can be reused later while keeping the wrapper with existing semantics. Note that virStorageFileParseChainIndex is pretty well covered by the test suite. --- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 68 +++++++++++++++++++++++++++++++++++++++----= ---- src/util/virstoragefile.h | 5 ++++ 3 files changed, 63 insertions(+), 11 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 39e2b40c5..31d6085cb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2476,6 +2476,7 @@ virStorageFileGetMetadataInternal; virStorageFileGetRelativeBackingPath; virStorageFileGetSCSIKey; virStorageFileIsClusterFS; +virStorageFileParseBackingStoreStr; virStorageFileParseChainIndex; virStorageFileProbeFormat; virStorageFileResize; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c9420fdb7..c8eb26aa7 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1442,32 +1442,78 @@ int virStorageFileGetSCSIKey(const char *path, } #endif + +/** + * virStorageFileParseBackingStoreStr: + * @str: backing store specifier string to parse + * @target: returns target device portion of the string + * @chainIndex: returns the backing store portion of the string + * + * Parses the backing store specifier string such as vda[1], or sda into + * components and returns them via arguments. If the string did not specif= y an + * index, 0 is assumed. + * + * Returns 0 on success -1 on error + */ +int +virStorageFileParseBackingStoreStr(const char *str, + char **target, + unsigned int *chainIndex) +{ + char **strings =3D NULL; + size_t nstrings; + unsigned int idx =3D 0; + char *suffix; + int ret =3D -1; + + *chainIndex =3D 0; + + if (!(strings =3D virStringSplitCount(str, "[", 2, &nstrings))) + return -1; + + if (nstrings =3D=3D 2) { + if (virStrToLong_uip(strings[1], &suffix, 10, &idx) < 0 || + STRNEQ(suffix, "]")) + goto cleanup; + } + + if (target && + VIR_STRDUP(*target, strings[0]) < 0) + goto cleanup; + + *chainIndex =3D idx; + ret =3D 0; + + cleanup: + virStringListFreeCount(strings, nstrings); + return ret; +} + + int virStorageFileParseChainIndex(const char *diskTarget, const char *name, unsigned int *chainIndex) { - char **strings =3D NULL; unsigned int idx =3D 0; - char *suffix; + char *target =3D NULL; int ret =3D 0; *chainIndex =3D 0; - if (name && diskTarget) - strings =3D virStringSplit(name, "[", 2); + if (!name || !diskTarget) + return 0; - if (virStringListLength((const char * const *)strings) !=3D 2) - goto cleanup; + if (virStorageFileParseBackingStoreStr(name, &target, &idx) < 0) + return 0; - if (virStrToLong_uip(strings[1], &suffix, 10, &idx) < 0 || - STRNEQ(suffix, "]")) + if (idx =3D=3D 0) goto cleanup; - if (STRNEQ(diskTarget, strings[0])) { + if (STRNEQ(diskTarget, target)) { virReportError(VIR_ERR_INVALID_ARG, _("requested target '%s' does not match target '%s'= "), - strings[0], diskTarget); + target, diskTarget); ret =3D -1; goto cleanup; } @@ -1475,7 +1521,7 @@ virStorageFileParseChainIndex(const char *diskTarget, *chainIndex =3D idx; cleanup: - virStringListFree(strings); + VIR_FREE(target); return ret; } diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index bea1c35a2..5f6e41911 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -309,6 +309,11 @@ int virStorageFileParseChainIndex(const char *diskTarg= et, unsigned int *chainIndex) ATTRIBUTE_NONNULL(3); +int virStorageFileParseBackingStoreStr(const char *str, + char **target, + unsigned int *chainIndex) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); + virStorageSourcePtr virStorageFileChainLookup(virStorageSourcePtr chain, virStorageSourcePtr startFro= m, const char *name, --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489596001695837.4220360256344; Wed, 15 Mar 2017 09:40:01 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGaqJp023605; Wed, 15 Mar 2017 12:36:52 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGalWw024900 for ; Wed, 15 Mar 2017 12:36:47 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafII000870; Wed, 15 Mar 2017 12:36:47 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:16 +0100 Message-Id: <1838446d333e75580e18d5479abe805ba47f5940.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 04/23] util: storage: Add variables for node names into 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 'nodeformat' should be used for strings which describe the storage format object, and 'nodebacking' for the actual storage object itself. --- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/util/virstoragefile.h | 10 ++++++++++ 3 files changed, 51 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 31d6085cb..bf2039a75 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2490,6 +2490,7 @@ virStorageNetProtocolTypeToString; virStorageSourceBackingStoreClear; virStorageSourceClear; virStorageSourceCopy; +virStorageSourceFindByNodeName; virStorageSourceFree; virStorageSourceGetActualType; virStorageSourceGetSecurityLabelDef; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c8eb26aa7..3bcb69bf6 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2012,6 +2012,8 @@ virStorageSourceCopy(const virStorageSource *src, VIR_STRDUP(ret->backingStoreRaw, src->backingStoreRaw) < 0 || VIR_STRDUP(ret->snapshot, src->snapshot) < 0 || VIR_STRDUP(ret->configFile, src->configFile) < 0 || + VIR_STRDUP(ret->nodeformat, src->nodeformat) < 0 || + VIR_STRDUP(ret->nodebacking, src->nodebacking) < 0 || VIR_STRDUP(ret->compat, src->compat) < 0) goto error; @@ -2232,6 +2234,9 @@ virStorageSourceClear(virStorageSourcePtr def) virStorageNetHostDefFree(def->nhosts, def->hosts); virStorageAuthDefFree(def->auth); + VIR_FREE(def->nodebacking); + VIR_FREE(def->nodeformat); + virStorageSourceBackingStoreClear(def); } @@ -3781,3 +3786,38 @@ virStorageSourceIsRelative(virStorageSourcePtr src) return false; } + + +/** + * virStorageSourceFindByNodeName: + * @top: backing chain top + * @nodeName: node name to find in backing chain + * @index: if provided the index in the backing chain + * + * Looks up the given storage source in the backing chain and returns the + * pointer to it. If @index is passed then it's filled by the index in the + * backing chain. On failure NULL is returned and no error is reported. + */ +virStorageSourcePtr +virStorageSourceFindByNodeName(virStorageSourcePtr top, + const char *nodeName, + unsigned int *index) +{ + virStorageSourcePtr tmp; + + if (index) + *index =3D 0; + + for (tmp =3D top; tmp; tmp =3D tmp->backingStore) { + if (STREQ_NULLABLE(tmp->nodeformat, nodeName) || + STREQ_NULLABLE(tmp->nodebacking, nodeName)) + return tmp; + + if (index) + (*index)++; + } + + if (index) + *index =3D 0; + return NULL; +} diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 5f6e41911..9ebfc1108 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -276,6 +276,10 @@ struct _virStorageSource { /* Name of the child backing store recorded in metadata of the * current file. */ char *backingStoreRaw; + + /* metadata that allows identifying given storage source */ + char *nodeformat; /* name of the format handler object */ + char *nodebacking; /* name of the backing storage object */ }; @@ -395,4 +399,10 @@ virStorageSourcePtr virStorageSourceNewFromBackingAbso= lute(const char *path); bool virStorageSourceIsRelative(virStorageSourcePtr src); +virStorageSourcePtr +virStorageSourceFindByNodeName(virStorageSourcePtr top, + const char *nodeName, + unsigned int *index) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + #endif /* __VIR_STORAGE_FILE_H__ */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 148959601642869.9119743394665; Wed, 15 Mar 2017 09:40:16 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGaqJ8016471; Wed, 15 Mar 2017 12:36:52 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGanFS024913 for ; Wed, 15 Mar 2017 12:36:49 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIJ000870; Wed, 15 Mar 2017 12:36:48 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:17 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 05/23] lib: Introduce event for tracking disk backing file write threshold 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When using thin provisioning, management tools need to resize the disk in certain cases. To avoid having them to poll disk usage introduce an event which will be fired when a given offset of the storage is written by the hypervisor. Together with the API which will be added later, it will allow registering thresholds for given storage backing volumes and this event will then notify management if the threshold is exceeded. --- daemon/remote.c | 45 +++++++++++++++++ examples/object-events/event-test.c | 19 ++++++++ include/libvirt/libvirt-domain.h | 31 ++++++++++++ src/conf/domain_event.c | 97 +++++++++++++++++++++++++++++++++= ++++ src/conf/domain_event.h | 15 ++++++ src/libvirt_private.syms | 2 + src/remote/remote_driver.c | 33 +++++++++++++ src/remote/remote_protocol.x | 18 ++++++- src/remote_protocol-structs | 9 ++++ tools/virsh-domain.c | 21 ++++++++ 10 files changed, 289 insertions(+), 1 deletion(-) diff --git a/daemon/remote.c b/daemon/remote.c index f2b9b9aec..7888f85b5 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1295,6 +1295,50 @@ remoteRelayDomainEventMetadataChange(virConnectPtr c= onn, } +static int +remoteRelayDomainEventBlockThreshold(virConnectPtr conn, + virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess, + void *opaque) +{ + daemonClientEventCallbackPtr callback =3D opaque; + remote_domain_event_block_threshold_msg data; + + if (callback->callbackID < 0 || + !remoteRelayDomainEventCheckACL(callback->client, conn, dom)) + return -1; + + VIR_DEBUG("Relaying domain block threshold event %s %d %s %s %llu %llu= , callback %d", + dom->name, dom->id, dev, NULLSTR(path), threshold, excess, c= allback->callbackID); + + /* build return data */ + memset(&data, 0, sizeof(data)); + data.callbackID =3D callback->callbackID; + if (VIR_STRDUP(data.dev, dev) < 0) + goto error; + if (path) { + if (VIR_ALLOC(data.path) < 0) + goto error; + if (VIR_STRDUP(*(data.path), path) < 0) + goto error; + } + data.threshold =3D threshold; + data.excess =3D excess; + make_nonnull_domain(&data.dom, dom); + + remoteDispatchObjectEventSend(callback->client, remoteProgram, + REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD, + (xdrproc_t)xdr_remote_domain_event_block= _threshold_msg, &data); + + return 0; + error: + VIR_FREE(data.dev); + return -1; +} + static virConnectDomainEventGenericCallback domainEventCallbacks[] =3D { VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle), @@ -1321,6 +1365,7 @@ static virConnectDomainEventGenericCallback domainEve= ntCallbacks[] =3D { VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventJobCompleted), VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDeviceRemovalFailed), VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMetadataChange), + VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockThreshold), }; verify(ARRAY_CARDINALITY(domainEventCallbacks) =3D=3D VIR_DOMAIN_EVENT_ID_= LAST); diff --git a/examples/object-events/event-test.c b/examples/object-events/e= vent-test.c index 55c004f93..12690cac0 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -15,6 +15,7 @@ #define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array))) #define STREQ(a, b) (strcmp(a, b) =3D=3D 0) +#define NULLSTR(s) ((s) ? (s) : "") #ifndef ATTRIBUTE_UNUSED # define ATTRIBUTE_UNUSED __attribute__((__unused__)) @@ -925,6 +926,23 @@ myDomainEventBlockJobCallback(virConnectPtr conn ATTRI= BUTE_UNUSED, static int +myDomainEventBlockThresholdCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess, + void *opaque ATTRIBUTE_UNUSED) +{ + printf("%s EVENT: Domain %s(%d) block threshold callback dev '%s'(%s),= " + "threshold: '%llu', excess: '%llu'", + __func__, virDomainGetName(dom), virDomainGetID(dom), + dev, NULLSTR(path), threshold, excess); + return 0; +} + + +static int myDomainEventMigrationIterationCallback(virConnectPtr conn ATTRIBUTE_UNUSE= D, virDomainPtr dom, int iteration, @@ -1053,6 +1071,7 @@ struct domainEventData domainEvents[] =3D { DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, myDomainEventJobComple= tedCallback), DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventD= eviceRemovalFailedCallback), DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, myDomainEventMetadat= aChangeCallback), + DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD, myDomainEventBlockTh= resholdCallback), }; struct storagePoolEventData { diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index c490d712f..12f8ac21c 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4267,6 +4267,36 @@ typedef void (*virConnectDomainEventAgentLifecycleCa= llback)(virConnectPtr conn, /** + * virConnectDomainEventBlockThresholdCallback: + * @conn: connection object + * @dom: domain on which the event occurred + * @dev: name associated with the affected disk or storage backing chain + * element + * @path: for local storage, the path of the backing chain element + * @threshold: threshold offset in bytes + * @excess: number of bytes written beyond the threshold + * @opaque: application specified data + * + * The callback occurs when the hypervisor detects that the given storage + * element was written beyond the point specified by @threshold. The excess + * data size written beyond @threshold is reported by @excess (if supported + * by the hypervisor, 0 otherwise). The event is useful for thin-provision= ed + * storage. + * + * The threshold size can be set via the virDomainSetBlockThreshold API. + * + * The callback signature to use when registering for an event of type + * VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD with virConnectDomainEventRegisterA= ny() + */ +typedef void (*virConnectDomainEventBlockThresholdCallback)(virConnectPtr = conn, + virDomainPtr d= om, + const char *de= v, + const char *pa= th, + unsigned long = long threshold, + unsigned long = long excess, + void *opaque); + +/** * VIR_DOMAIN_EVENT_CALLBACK: * * Used to cast the event specific callback into the generic one @@ -4307,6 +4337,7 @@ typedef enum { VIR_DOMAIN_EVENT_ID_JOB_COMPLETED =3D 21, /* virConnectDomainEventJob= CompletedCallback */ VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED =3D 22, /* virConnectDomainE= ventDeviceRemovalFailedCallback */ VIR_DOMAIN_EVENT_ID_METADATA_CHANGE =3D 23, /* virConnectDomainEventMe= tadataChangeCallback */ + VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD =3D 24, /* virConnectDomainEventBl= ockThresholdCallback */ # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_EVENT_ID_LAST diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index da503f3ee..6243b4262 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -60,6 +60,7 @@ static virClassPtr virDomainEventMigrationIterationClass; static virClassPtr virDomainEventJobCompletedClass; static virClassPtr virDomainEventDeviceRemovalFailedClass; static virClassPtr virDomainEventMetadataChangeClass; +static virClassPtr virDomainEventBlockThresholdClass; static void virDomainEventDispose(void *obj); static void virDomainEventLifecycleDispose(void *obj); @@ -81,6 +82,7 @@ static void virDomainEventMigrationIterationDispose(void = *obj); static void virDomainEventJobCompletedDispose(void *obj); static void virDomainEventDeviceRemovalFailedDispose(void *obj); static void virDomainEventMetadataChangeDispose(void *obj); +static void virDomainEventBlockThresholdDispose(void *obj); static void virDomainEventDispatchDefaultFunc(virConnectPtr conn, @@ -277,6 +279,17 @@ struct _virDomainEventMetadataCange { typedef struct _virDomainEventMetadataCange virDomainEventMetadataChange; typedef virDomainEventMetadataChange *virDomainEventMetadataChangePtr; +struct _virDomainEventBlockThreshold { + virDomainEvent parent; + + char *dev; + char *path; + + unsigned long long threshold; + unsigned long long excess; +}; +typedef struct _virDomainEventBlockThreshold virDomainEventBlockThreshold; +typedef virDomainEventBlockThreshold *virDomainEventBlockThresholdPtr; static int @@ -402,6 +415,12 @@ virDomainEventsOnceInit(void) sizeof(virDomainEventMetadataChange), virDomainEventMetadataChangeDispose))) return -1; + if (!(virDomainEventBlockThresholdClass =3D + virClassNew(virDomainEventClass, + "virDomainEventBlockThreshold", + sizeof(virDomainEventBlockThreshold), + virDomainEventBlockThresholdDispose))) + return -1; return 0; } @@ -600,6 +619,17 @@ virDomainEventMetadataChangeDispose(void *obj) } +static void +virDomainEventBlockThresholdDispose(void *obj) +{ + virDomainEventBlockThresholdPtr event =3D obj; + VIR_DEBUG("obj=3D%p", event); + + VIR_FREE(event->dev); + VIR_FREE(event->path); +} + + static void * virDomainEventNew(virClassPtr klass, int eventID, @@ -1674,6 +1704,60 @@ virDomainEventMetadataChangeNewFromDom(virDomainPtr = dom, } +static virObjectEventPtr +virDomainEventBlockThresholdNew(int id, + const char *name, + unsigned char *uuid, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess) +{ + virDomainEventBlockThresholdPtr ev; + + if (virDomainEventsInitialize() < 0) + return NULL; + + if (!(ev =3D virDomainEventNew(virDomainEventBlockThresholdClass, + VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD, + id, name, uuid))) + return NULL; + + if (VIR_STRDUP(ev->dev, dev) < 0 || + VIR_STRDUP(ev->path, path) < 0) { + virObjectUnref(ev); + return NULL; + } + ev->threshold =3D threshold; + ev->excess =3D excess; + + return (virObjectEventPtr)ev; +} + +virObjectEventPtr +virDomainEventBlockThresholdNewFromObj(virDomainObjPtr obj, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess) +{ + return virDomainEventBlockThresholdNew(obj->def->id, obj->def->name, + obj->def->uuid, dev, path, + threshold, excess); +} + +virObjectEventPtr +virDomainEventBlockThresholdNewFromDom(virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess) +{ + return virDomainEventBlockThresholdNew(dom->id, dom->name, dom->uuid, + dev, path, threshold, excess); +} + + static void virDomainEventDispatchDefaultFunc(virConnectPtr conn, virObjectEventPtr event, @@ -1943,6 +2027,19 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn, goto cleanup; } + case VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD: + { + virDomainEventBlockThresholdPtr blockThresholdEvent; + + blockThresholdEvent =3D (virDomainEventBlockThresholdPtr)event; + ((virConnectDomainEventBlockThresholdCallback)cb)(conn, dom, + blockThresho= ldEvent->dev, + blockThresho= ldEvent->path, + blockThresho= ldEvent->threshold, + blockThresho= ldEvent->excess, + cbopaque); + goto cleanup; + } case VIR_DOMAIN_EVENT_ID_LAST: break; } diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index 1933f4724..3992a29c5 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -244,6 +244,21 @@ virDomainEventMetadataChangeNewFromDom(virDomainPtr do= m, int type, const char *nsuri); + +virObjectEventPtr +virDomainEventBlockThresholdNewFromObj(virDomainObjPtr obj, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess); + +virObjectEventPtr +virDomainEventBlockThresholdNewFromDom(virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess); + int virDomainEventStateRegister(virConnectPtr conn, virObjectEventStatePtr state, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index bf2039a75..fcc87675b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -536,6 +536,8 @@ virDomainEventBlockJob2NewFromDom; virDomainEventBlockJob2NewFromObj; virDomainEventBlockJobNewFromDom; virDomainEventBlockJobNewFromObj; +virDomainEventBlockThresholdNewFromDom; +virDomainEventBlockThresholdNewFromObj; virDomainEventControlErrorNewFromDom; virDomainEventControlErrorNewFromObj; virDomainEventDeviceAddedNewFromDom; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0c8bfeed1..efa47beaf 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -396,6 +396,11 @@ remoteSecretBuildEventValueChanged(virNetClientProgram= Ptr prog ATTRIBUTE_UNUSED, void *evdata, void *opaque); static void +remoteDomainBuildEventBlockThreshold(virNetClientProgramPtr prog, + virNetClientPtr client, + void *evdata, void *opaque); + +static void remoteConnectNotifyEventConnectionClosed(virNetClientProgramPtr prog ATTRI= BUTE_UNUSED, virNetClientPtr client ATTRIBUTE_= UNUSED, void *evdata, void *opaque); @@ -602,6 +607,10 @@ static virNetClientProgramEvent remoteEvents[] =3D { remoteSecretBuildEventValueChanged, sizeof(remote_secret_event_value_changed_msg), (xdrproc_t)xdr_remote_secret_event_value_changed_msg }, + { REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD, + remoteDomainBuildEventBlockThreshold, + sizeof(remote_domain_event_block_threshold_msg), + (xdrproc_t)xdr_remote_domain_event_block_threshold_msg }, }; static void @@ -5577,6 +5586,30 @@ remoteSecretGetValue(virSecretPtr secret, size_t *va= lue_size, } +static void +remoteDomainBuildEventBlockThreshold(virNetClientProgramPtr prog ATTRIBUTE= _UNUSED, + virNetClientPtr client ATTRIBUTE_UNUS= ED, + void *evdata, void *opaque) +{ + virConnectPtr conn =3D opaque; + remote_domain_event_block_threshold_msg *msg =3D evdata; + struct private_data *priv =3D conn->privateData; + virDomainPtr dom; + virObjectEventPtr event =3D NULL; + + if (!(dom =3D get_nonnull_domain(conn, msg->dom))) + return; + + event =3D virDomainEventBlockThresholdNewFromDom(dom, msg->dev, + msg->path ? *msg->path = : NULL, + msg->threshold, msg->ex= cess); + + virObjectUnref(dom); + + remoteEventQueue(priv, event, msg->callbackID); +} + + static int remoteStreamSend(virStreamPtr st, const char *data, diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index abe63af07..39dd2b728 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3071,6 +3071,15 @@ struct remote_domain_event_block_job_2_msg { int status; }; +struct remote_domain_event_block_threshold_msg { + int callbackID; + remote_nonnull_domain dom; + remote_nonnull_string dev; + remote_string path; + unsigned hyper threshold; + unsigned hyper excess; +}; + struct remote_domain_event_callback_tunable_msg { int callbackID; remote_nonnull_domain dom; @@ -6033,5 +6042,12 @@ enum remote_procedure { * @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE * @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG */ - REMOTE_PROC_DOMAIN_SET_VCPU =3D 384 + REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, + + /** + * @generate: both + * @acl: none + */ + REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385 + }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index e1e53d21b..67e43a4ac 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2516,6 +2516,14 @@ struct remote_domain_event_block_job_2_msg { int type; int status; }; +struct remote_domain_event_block_threshold_msg { + int callbackID; + remote_nonnull_domain dom; + remote_nonnull_string dev; + remote_string path; + uint64_t threshold; + uint64_t excess; +}; struct remote_domain_event_callback_tunable_msg { int callbackID; remote_nonnull_domain dom; @@ -3217,4 +3225,5 @@ enum remote_procedure { REMOTE_PROC_SECRET_EVENT_LIFECYCLE =3D 382, REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383, REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, + REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385, }; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 09a9f8203..ee702f3c4 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12870,6 +12870,25 @@ virshEventMetadataChangePrint(virConnectPtr conn A= TTRIBUTE_UNUSED, } +static void +virshEventBlockThresholdPrint(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + const char *dev, + const char *path, + unsigned long long threshold, + unsigned long long excess, + void *opaque) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + + virBufferAsprintf(&buf, _("event 'block-threshold' for domain %s: " + "dev: %s(%s) %llu %llu\n"), + virDomainGetName(dom), + dev, NULLSTR(path), threshold, excess); + virshEventPrint(opaque, &buf); +} + + static vshEventCallback vshEventCallbacks[] =3D { { "lifecycle", VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), }, @@ -12917,6 +12936,8 @@ static vshEventCallback vshEventCallbacks[] =3D { VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceRemovalFailedPrint), }, { "metadata-change", VIR_DOMAIN_EVENT_CALLBACK(virshEventMetadataChangePrint), }, + { "block-threshold", + VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockThresholdPrint), }, }; verify(VIR_DOMAIN_EVENT_ID_LAST =3D=3D ARRAY_CARDINALITY(vshEventCallbacks= )); --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1489596061865531.3705910735962; Wed, 15 Mar 2017 09:41:01 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGarb1005260; Wed, 15 Mar 2017 12:36:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaowc024924 for ; Wed, 15 Mar 2017 12:36:50 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIK000870; Wed, 15 Mar 2017 12:36:49 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:18 +0100 Message-Id: <7cda1a44b62fec681e83fec47a46c79adec463e2.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 06/23] qemu: monitor: Add support for BLOCK_WRITE_THRESHOLD event 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The event is fired when a given block backend node (identified by the node name) experiences a write beyond the bound set via block-set-write-threshold QMP command. This wires up the monitor code to extract the data and allow us receiving the events and the capability. --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_monitor.c | 18 +++++++++++++++ src/qemu/qemu_monitor.h | 14 ++++++++++++ src/qemu/qemu_monitor_json.c | 26 ++++++++++++++++++= ++++ tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + .../caps_2.6.0-gicv2.aarch64.xml | 1 + .../caps_2.6.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + 16 files changed, 72 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 70f9ed777..c4695693a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -359,6 +359,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "query-cpu-model-expansion", /* 245 */ "virtio-net.host_mtu", "spice-rendernode", + "block-write-threshold", ); @@ -1529,6 +1530,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] =3D= { { "MIGRATION", QEMU_CAPS_MIGRATION_EVENT }, { "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE }, { "DEVICE_TRAY_MOVED", QEMU_CAPS_DEVICE_TRAY_MOVED }, + { "BLOCK_WRITE_THRESHOLD", QEMU_CAPS_BLOCK_WRITE_THRESHOLD }, }; struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index cc9f46e65..eb72ad646 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -394,6 +394,7 @@ typedef enum { QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion = */ QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */ QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */ + QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index d71f84c80..f43d79b98 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1580,6 +1580,24 @@ qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon, int +qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold, + unsigned long long excess) +{ + int ret =3D -1; + + VIR_DEBUG("mon=3D%p, node-name=3D'%s', threshold=3D'%llu', excess=3D'%= llu'", + mon, nodename, threshold, excess); + + QEMU_MONITOR_CALLBACK(mon, ret, domainBlockThreshold, mon->vm, + nodename, threshold, excess); + + return ret; +} + + +int qemuMonitorSetCapabilities(qemuMonitorPtr mon) { QEMU_CHECK_MONITOR(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 847e9458a..66dcd2468 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -207,6 +207,14 @@ typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qe= muMonitorPtr mon, void *opaque); +typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon, + virDomainObjPtr vm, + const char *nodenam= e, + unsigned long long = threshold, + unsigned long long = excess, + void *opaque); + + typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks; typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr; struct _qemuMonitorCallbacks { @@ -238,6 +246,7 @@ struct _qemuMonitorCallbacks { qemuMonitorDomainMigrationStatusCallback domainMigrationStatus; qemuMonitorDomainMigrationPassCallback domainMigrationPass; qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo; + qemuMonitorDomainBlockThresholdCallback domainBlockThreshold; }; char *qemuMonitorEscapeArg(const char *in); @@ -357,6 +366,11 @@ int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon, unsigned int source, unsigned int status); +int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold, + unsigned long long excess); + int qemuMonitorStartCPUs(qemuMonitorPtr mon, virConnectPtr conn); int qemuMonitorStopCPUs(qemuMonitorPtr mon); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3a29f1aa7..fc33e8635 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -89,6 +89,7 @@ static void qemuMonitorJSONHandleSpiceMigrated(qemuMonito= rPtr mon, virJSONValueP static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon, virJS= ONValuePtr data); static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSON= ValuePtr data); static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONVa= luePtr data); +static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSO= NValuePtr data); typedef struct { const char *type; @@ -102,6 +103,7 @@ static qemuEventHandler eventHandlers[] =3D { { "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, }, { "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJobCompleted, }, { "BLOCK_JOB_READY", qemuMonitorJSONHandleBlockJobReady, }, + { "BLOCK_WRITE_THRESHOLD", qemuMonitorJSONHandleBlockThreshold, }, { "DEVICE_DELETED", qemuMonitorJSONHandleDeviceDeleted, }, { "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, }, { "GUEST_PANICKED", qemuMonitorJSONHandleGuestPanic, }, @@ -1065,6 +1067,30 @@ qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon,= virJSONValuePtr data) } +static void +qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr da= ta) +{ + const char *nodename; + unsigned long long threshold; + unsigned long long excess; + + if (!(nodename =3D virJSONValueObjectGetString(data, "node-name"))) + goto error; + + if (virJSONValueObjectGetNumberUlong(data, "write-threshold", &thresho= ld) < 0) + goto error; + + if (virJSONValueObjectGetNumberUlong(data, "amount-exceeded", &excess)= < 0) + goto error; + + qemuMonitorEmitBlockThreshold(mon, nodename, threshold, excess); + return; + + error: + VIR_WARN("malformed 'BLOCK_WRITE_THRESHOLD' event"); +} + + int qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon, const char *cmd_str, diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.4.0.x86_64.xml index b1b9e1571..8b72751e9 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml @@ -182,6 +182,7 @@ + 2004000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.5.0.x86_64.xml index 2e23a93d6..215c3f110 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml @@ -188,6 +188,7 @@ + 2005000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml index 0aed651e7..80c29d3ab 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml @@ -164,6 +164,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml index 1041a12c1..2ef53173c 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml @@ -164,6 +164,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemu= capabilitiesdata/caps_2.6.0.ppc64le.xml index 92e27810f..78e78ca96 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml @@ -159,6 +159,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.6.0.x86_64.xml index 1286f84df..8caf448b4 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml @@ -197,6 +197,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.7.0.s390x.xml index af21017bc..6206bad9e 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml @@ -127,6 +127,7 @@ + 2007000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.7.0.x86_64.xml index 0c0b423f3..fd13ae4f7 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml @@ -199,6 +199,7 @@ + 2007000 0 (v2.7.0) diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.8.0.s390x.xml index d179a8413..b7ce2c6c0 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml @@ -129,6 +129,7 @@ + 2007093 0 diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.8.0.x86_64.xml index d650f094a..b741e8fcc 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -200,6 +200,7 @@ + 2008000 0 (v2.8.0) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 334f8e74b..8043240e2 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -202,6 +202,7 @@ + 2008050 0 (v2.8.0-1961-g5b10b94bd5) --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 148959600383498.9429380724772; Wed, 15 Mar 2017 09:40:03 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGathG016483; Wed, 15 Mar 2017 12:36:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGapOg024929 for ; Wed, 15 Mar 2017 12:36:51 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIL000870; Wed, 15 Mar 2017 12:36:50 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:19 +0100 Message-Id: <01946b284e1be9b144f92146c79c16f98b0a1a9d.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 07/23] qemu: domain: Add helper to lookup disk by node name 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Looks up a disk and it's corresponding backing chain element by node name. --- src/qemu/qemu_domain.c | 43 +++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 07ce22417..95ea63615 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8369,3 +8369,46 @@ qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driv= er, cleanup: return ret; } + + +/** + * qemuDomainDiskLookupByNodename: + * @def: domain definition to look for the disk + * @nodename: block backend node name to find + * @src: filled with the specific backing store element if provided + * @idx: index of @src in the backing chain, if provided + * + * Looks up the disk in the domain via @nodename and returns it's definiti= on. + * Optionally fills @src and @idx if provided with the specific backing ch= ain + * element which corresponds to the node name. + */ +virDomainDiskDefPtr +qemuDomainDiskLookupByNodename(virDomainDefPtr def, + const char *nodename, + virStorageSourcePtr *src, + unsigned int *idx) +{ + size_t i; + unsigned int srcindex; + virStorageSourcePtr tmp =3D NULL; + + if (!idx) + idx =3D &srcindex; + + if (src) + *src =3D NULL; + + *idx =3D 0; + + for (i =3D 0; i < def->ndisks; i++) { + if ((tmp =3D virStorageSourceFindByNodeName(def->disks[i]->src, + nodename, idx))) { + if (src) + *src =3D tmp; + + return def->disks[i]; + } + } + + return NULL; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index c646828e6..15eb72a5c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -852,4 +852,10 @@ int qemuDomainNamespaceSetupRNG(virQEMUDriverPtr drive= r, int qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainRNGDefPtr rng); + +virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def, + const char *nodename, + virStorageSourcePtr *sr= c, + unsigned int *idx); + #endif /* __QEMU_DOMAIN_H__ */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1489596006570789.8682869835901; Wed, 15 Mar 2017 09:40:06 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGatAY005272; Wed, 15 Mar 2017 12:36:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaqiI024937 for ; Wed, 15 Mar 2017 12:36:52 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIM000870; Wed, 15 Mar 2017 12:36:51 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:20 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 08/23] qemu: domain: Add helper to generate indexed backing store names 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The code is currently simple, but if we later add node names, it will be necessary to generate the names based on the node name. Add a helper so that there's a central point to fix once we add self-generated node names. --- src/qemu/qemu_domain.c | 22 ++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 95ea63615..0c633af33 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8412,3 +8412,25 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def, return NULL; } + + +/** + * qemuDomainDiskBackingStoreGetName: + * + * Creates a name using the indexed syntax (vda[1])for the given backing s= tore + * entry for a disk. + */ +char * +qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk, + virStorageSourcePtr src ATTRIBUTE_UNUSED, + unsigned int idx) +{ + char *ret =3D NULL; + + if (idx) + ignore_value(virAsprintf(&ret, "%s[%d]", disk->dst, idx)); + else + ignore_value(VIR_STRDUP(ret, disk->dst)); + + return ret; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 15eb72a5c..a07d671a9 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -858,4 +858,8 @@ virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virD= omainDefPtr def, virStorageSourcePtr *sr= c, unsigned int *idx); +char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk, + virStorageSourcePtr src, + unsigned int idx); + #endif /* __QEMU_DOMAIN_H__ */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 148959600843730.502785629539403; Wed, 15 Mar 2017 09:40:08 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGauxI005280; Wed, 15 Mar 2017 12:36:56 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGarFc024949 for ; Wed, 15 Mar 2017 12:36:53 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIN000870; Wed, 15 Mar 2017 12:36:52 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:21 +0100 Message-Id: <70ef8d606ad21be81b8c0e02e99713840c04e09f.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 09/23] qemu: process: Wire up firing of the VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD event 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Bind it to qemus BLOCK_WRITE_THRESHOLD event. Look up the disk by nodename and construct the string to return. --- src/qemu/qemu_process.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b9c1847bb..d40deea10 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1441,6 +1441,45 @@ qemuProcessHandleAcpiOstInfo(qemuMonitorPtr mon ATTR= IBUTE_UNUSED, static int +qemuProcessHandleBlockThreshold(qemuMonitorPtr mon ATTRIBUTE_UNUSED, + virDomainObjPtr vm, + const char *nodename, + unsigned long long threshold, + unsigned long long excess, + void *opaque) +{ + virQEMUDriverPtr driver =3D opaque; + virObjectEventPtr event =3D NULL; + virDomainDiskDefPtr disk; + virStorageSourcePtr src; + unsigned int idx; + char *dev =3D NULL; + const char *path =3D NULL; + + virObjectLock(vm); + + VIR_DEBUG("BLOCK_WRITE_THRESHOLD event for block node '%s' in domain %= p %s:" + "threshold '%llu' exceeded by '%llu'", + nodename, vm, vm->def->name, threshold, excess); + + if ((disk =3D qemuDomainDiskLookupByNodename(vm->def, nodename, &src, = &idx))) { + if (virStorageSourceIsLocalStorage(src)) + path =3D src->path; + + if ((dev =3D qemuDomainDiskBackingStoreGetName(disk, src, idx))) { + event =3D virDomainEventBlockThresholdNewFromObj(vm, dev, path, + threshold, exce= ss); + } + } + + virObjectUnlock(vm); + qemuDomainEventQueue(driver, event); + + return 0; +} + + +static int qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjPtr vm, const char *devAlias, @@ -1636,6 +1675,7 @@ static qemuMonitorCallbacks monitorCallbacks =3D { .domainMigrationStatus =3D qemuProcessHandleMigrationStatus, .domainMigrationPass =3D qemuProcessHandleMigrationPass, .domainAcpiOstInfo =3D qemuProcessHandleAcpiOstInfo, + .domainBlockThreshold =3D qemuProcessHandleBlockThreshold, }; static void --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596009488659.4954534082287; Wed, 15 Mar 2017 09:40:09 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGawjL016496; Wed, 15 Mar 2017 12:36:58 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGas1l024959 for ; Wed, 15 Mar 2017 12:36:54 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIO000870; Wed, 15 Mar 2017 12:36:54 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:22 +0100 Message-Id: <06be8364dbc49ab74df235d8eef5912a66b76e11.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 10/23] lib: Add API for setting the threshold size for VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The new API can be used to configure the threshold when VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD should be fired. --- include/libvirt/libvirt-domain.h | 5 ++++ src/driver-hypervisor.h | 8 +++++++ src/libvirt-domain.c | 51 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 17 +++++++++++++- src/remote_protocol-structs | 7 ++++++ 7 files changed, 89 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 12f8ac21c..296c5664f 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4656,4 +4656,9 @@ int virDomainSetVcpu(virDomainPtr domain, int state, unsigned int flags); +int virDomainSetBlockThreshold(virDomainPtr domain, + const char *dev, + unsigned long long threshold, + unsigned int flags); + #endif /* __VIR_LIBVIRT_DOMAIN_H__ */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index b81420aef..3053d7ae8 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1257,6 +1257,13 @@ typedef int int state, unsigned int flags); +typedef int +(*virDrvDomainSetBlockThreshold)(virDomainPtr domain, + const char *dev, + unsigned long long threshold, + unsigned int flags); + + typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; @@ -1496,6 +1503,7 @@ struct _virHypervisorDriver { virDrvDomainGetGuestVcpus domainGetGuestVcpus; virDrvDomainSetGuestVcpus domainSetGuestVcpus; virDrvDomainSetVcpu domainSetVcpu; + virDrvDomainSetBlockThreshold domainSetBlockThreshold; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index d8c88e06c..fd367bcb0 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11822,3 +11822,54 @@ virDomainSetVcpu(virDomainPtr domain, virDispatchError(domain->conn); return -1; } + + +/** + * virDomainSetBlockThreshold: + * @domain: pointer to domain object + * @dev: string specifying the block device or backing chain element + * @threshold: threshold in bytes when to fire the event + * @flags: currently unused, callers should pass 0 + * + * Set the threshold level for delivering the + * VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD if the device or backing chain elem= ent + * described by @dev is written beyond the set threshold level. The thresh= old + * level is unset once the event fired. The event may not be delivered at = all if + * libvirtd was not running at the moment when the threshold was reached. + * + * This event allows to use thin-provisioned storage which needs management + * tools to grow it without the need for polling of the data. + * + * Returns 0 if the operation has started, -1 on failure. + */ +int +virDomainSetBlockThreshold(virDomainPtr domain, + const char *dev, + unsigned long long threshold, + unsigned int flags) +{ + VIR_DOMAIN_DEBUG(domain, "dev=3D'%s' threshold=3D%llu flags=3D%x", + NULLSTR(dev), threshold, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + virCheckReadOnlyGoto(domain->conn->flags, error); + + virCheckNonNullArgGoto(dev, error); + + if (domain->conn->driver->domainSetBlockThreshold) { + int ret; + ret =3D domain->conn->driver->domainSetBlockThreshold(domain, dev, + threshold, fla= gs); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(domain->conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 04ef58021..428cf2e19 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -755,6 +755,7 @@ LIBVIRT_3.0.0 { LIBVIRT_3.1.0 { global: + virDomainSetBlockThreshold; virDomainSetVcpu; } LIBVIRT_3.0.0; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index efa47beaf..baa5cbab3 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8436,6 +8436,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainGetGuestVcpus =3D remoteDomainGetGuestVcpus, /* 2.0.0 */ .domainSetGuestVcpus =3D remoteDomainSetGuestVcpus, /* 2.0.0 */ .domainSetVcpu =3D remoteDomainSetVcpu, /* 3.1.0 */ + .domainSetBlockThreshold =3D remoteDomainSetBlockThreshold, /* 3.1.0 */ }; static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 39dd2b728..87b2bd365 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3402,6 +3402,14 @@ struct remote_secret_event_value_changed_msg { remote_nonnull_secret secret; }; +struct remote_domain_set_block_threshold_args { + remote_nonnull_domain dom; + remote_nonnull_string dev; + unsigned hyper threshold; + unsigned int flags; +}; + + /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here.= */ @@ -6048,6 +6056,13 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385 + REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385, + + /** + * @generate: both + * @acl: domain:write + */ + REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386 + }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 67e43a4ac..a46fe37bf 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2840,6 +2840,12 @@ struct remote_secret_event_value_changed_msg { int callbackID; remote_nonnull_secret secret; }; +struct remote_domain_set_block_threshold_args { + remote_nonnull_domain dom; + remote_nonnull_string dev; + uint64_t threshold; + u_int flags; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3226,4 +3232,5 @@ enum remote_procedure { REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383, REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385, + REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386, }; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1489596018670802.7996786959343; Wed, 15 Mar 2017 09:40:18 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaw3W005917; Wed, 15 Mar 2017 12:36:58 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGauHj024967 for ; Wed, 15 Mar 2017 12:36:56 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIP000870; Wed, 15 Mar 2017 12:36:55 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:23 +0100 Message-Id: <45cf7ae72cda7eea7a1a30893bc63c70584ee61f.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 11/23] virsh: Implement 'domblkthreshold' command to call virDomainSetBlockThreshold 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a simple wrapper which will allow to set the threshold for delivering the event. --- tools/virsh-domain.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 8 +++++++ 2 files changed, 72 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ee702f3c4..36629523b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7097,6 +7097,64 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) /* + * "domblkthreshold" command + */ +static const vshCmdInfo info_domblkthreshold[] =3D { + {.name =3D "help", + .data =3D N_("set the threshold for block-threshold event for a given= block " + "device or it's backing chain element") + }, + {.name =3D "desc", + .data =3D N_("set threshold for ") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_domblkthreshold[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL, + {.name =3D "dev", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("device to set threshold for") + }, + {.name =3D "threshold", + .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("threshold as a scaled number (by default bytes)") + }, + {.name =3D NULL} +}; + +static bool +cmdDomblkthreshold(vshControl *ctl, const vshCmd *cmd) +{ + unsigned long long threshold; + const char *dev =3D NULL; + virDomainPtr dom; + bool ret =3D false; + + if (vshCommandOptStringReq(ctl, cmd, "dev", &dev)) + return false; + + if (vshCommandOptScaledInt(ctl, cmd, "threshold", + &threshold, 1, ULLONG_MAX) < 0) + return false; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (virDomainSetBlockThreshold(dom, dev, threshold, 0) < 0) + goto cleanup; + + ret =3D true; + + cleanup: + virDomainFree(dom); + return ret; +} + + +/* * "iothreadinfo" command */ static const vshCmdInfo info_iothreadinfo[] =3D { @@ -14060,5 +14118,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_setvcpu, .flags =3D 0 }, + {.name =3D "domblkthreshold", + .handler =3D cmdDomblkthreshold, + .opts =3D opts_domblkthreshold, + .info =3D info_domblkthreshold, + .flags =3D 0 + }, {.name =3D NULL} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index ee7904611..48be19234 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1274,6 +1274,14 @@ I<--bytes> with a scaled value allows to use finer g= ranularity. A scaled value used without I<--bytes> will be rounded down to MiB/s. Note that the I<--bytes> may be unsupported by the hypervisor. + +=3Ditem B I I I + +Set the threshold value for delivering the block-threshold event. I +specifies the disk device target or backing chain element of given device = using +the 'target[1]' syntax. I is a scaled value of the offset. If t= he +block device should write beyond that offset the event will be delivered. + =3Ditem B I I I Resize a block device of domain while the domain is running, I --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 148959600928664.76603629182921; Wed, 15 Mar 2017 09:40:09 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGawO4023620; Wed, 15 Mar 2017 12:36:58 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGavL4024982 for ; Wed, 15 Mar 2017 12:36:57 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIQ000870; Wed, 15 Mar 2017 12:36:56 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:24 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 12/23] qemu: domain: Add helper to look up disk soruce by the backing store string 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/qemu/qemu_domain.c | 37 +++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 2 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0c633af33..402b0730e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8434,3 +8434,40 @@ qemuDomainDiskBackingStoreGetName(virDomainDiskDefPt= r disk, return ret; } + + +virStorageSourcePtr +qemuDomainGetStorageSourceByDevstr(const char *devstr, + virDomainDefPtr def) +{ + virDomainDiskDefPtr disk =3D NULL; + virStorageSourcePtr src =3D NULL; + char *target =3D NULL; + unsigned int idx; + size_t i; + + if (virStorageFileParseBackingStoreStr(devstr, &target, &idx) < 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("failed to parse block device '%s'"), devstr); + return NULL; + } + + for (i =3D 0; i < def->ndisks; i++) { + if (STREQ(target, def->disks[i]->dst)) { + disk =3D def->disks[i]; + break; + } + } + + if (!disk) { + virReportError(VIR_ERR_INVALID_ARG, + _("failed to find disk '%s"), target); + goto cleanup; + } + + src =3D virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL); + + cleanup: + VIR_FREE(target); + return src; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a07d671a9..3a7afdf45 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -862,4 +862,7 @@ char *qemuDomainDiskBackingStoreGetName(virDomainDiskDe= fPtr disk, virStorageSourcePtr src, unsigned int idx); +virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr, + virDomainDefPtr def= ); + #endif /* __QEMU_DOMAIN_H__ */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 14895960252771014.5907373917654; Wed, 15 Mar 2017 09:40:25 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb1v0005937; Wed, 15 Mar 2017 12:37:01 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGawIc024989 for ; Wed, 15 Mar 2017 12:36:58 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIR000870; Wed, 15 Mar 2017 12:36:57 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:25 +0100 Message-Id: <0da5a734503bc72b594ee783a4b9ceafaa835c1e.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 13/23] qemu: implement qemuDomainSetBlockThreshold 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add code to call the appropriate monitor command and code to lookup the given disk backing chain member. --- src/qemu/qemu_driver.c | 70 ++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_monitor.c | 13 ++++++++ src/qemu/qemu_monitor.h | 5 ++++ src/qemu/qemu_monitor_json.c | 31 ++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 6 ++++ 5 files changed, 125 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 06bd442ee..d8e3ddf57 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20291,6 +20291,75 @@ qemuDomainSetVcpu(virDomainPtr dom, } +static int +qemuDomainSetBlockThreshold(virDomainPtr dom, + const char *dev, + unsigned long long threshold, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + qemuDomainObjPrivatePtr priv; + virDomainObjPtr vm =3D NULL; + virStorageSourcePtr src; + char *nodename =3D NULL; + int rc; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D qemuDomObjFromDomain(dom))) + goto cleanup; + + priv =3D vm->privateData; + + if (virDomainSetBlockThresholdEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCK_WRITE_THRESHOLD)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("this qemu does not support setting device thresh= old")); + goto cleanup; + } + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); + goto endjob; + } + + if (!(src =3D qemuDomainGetStorageSourceByDevstr(dev, vm->def))) + goto endjob; + + if (!src->nodebacking) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("threshold currently can't be set for block devic= e '%s'"), + dev); + goto endjob; + } + + if (VIR_STRDUP(nodename, src->nodebacking) < 0) + goto endjob; + + qemuDomainObjEnterMonitor(driver, vm); + rc =3D qemuMonitorSetBlockThreshold(priv->mon, nodename, threshold); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + goto endjob; + + ret =3D 0; + + endjob: + qemuDomainObjEndJob(driver, vm); + + cleanup: + VIR_FREE(nodename); + virDomainObjEndAPI(&vm); + return ret; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectOpen =3D qemuConnectOpen, /* 0.2.0 */ @@ -20505,6 +20574,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainGetGuestVcpus =3D qemuDomainGetGuestVcpus, /* 2.0.0 */ .domainSetGuestVcpus =3D qemuDomainSetGuestVcpus, /* 2.0.0 */ .domainSetVcpu =3D qemuDomainSetVcpu, /* 3.1.0 */ + .domainSetBlockThreshold =3D qemuDomainSetBlockThreshold /* 3.2.0 */ }; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f43d79b98..e2af0ca02 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4171,3 +4171,16 @@ qemuMonitorQueryQMPSchema(qemuMonitorPtr mon) return qemuMonitorJSONQueryQMPSchema(mon); } + + +int +qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold) +{ + VIR_DEBUG("mon=3D%p, node=3D'%s', threshold=3D%llu", mon, nodename, th= reshold); + + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONSetBlockThreshold(mon, nodename, threshold); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 66dcd2468..61d89a9cf 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1072,4 +1072,9 @@ int qemuMonitorGetRTCTime(qemuMonitorPtr mon, virHashTablePtr qemuMonitorQueryQMPSchema(qemuMonitorPtr mon); +int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold); + + #endif /* QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index fc33e8635..6fb2af48a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7487,3 +7487,34 @@ qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon) return ret; } + + +int +qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold) +{ + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + int ret =3D -1; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("block-set-write-threshold", + "s:node-name", nodename, + "U:write-threshold", threshold, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 59d9f098c..e0dd696d9 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -511,4 +511,10 @@ int qemuMonitorJSONGetHotpluggableCPUs(qemuMonitorPtr = mon, virHashTablePtr qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon) ATTRIBUTE_NONNULL(1); + +int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, + const char *nodename, + unsigned long long threshold) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + #endif /* QEMU_MONITOR_JSON_H */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596018899646.9131500636719; Wed, 15 Mar 2017 09:40:18 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGb1n0016507; Wed, 15 Mar 2017 12:37:01 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaxBI025002 for ; Wed, 15 Mar 2017 12:36:59 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIS000870; Wed, 15 Mar 2017 12:36:58 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:26 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 14/23] qemu: capabilities: add capability for query-named-block-nodes qmp cmd 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + 14 files changed, 15 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c4695693a..918c20fa3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -360,6 +360,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "virtio-net.host_mtu", "spice-rendernode", "block-write-threshold", + "query-named-block-nodes", ); @@ -1517,6 +1518,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = =3D { { "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS }, { "query-qmp-schema", QEMU_CAPS_QUERY_QMP_SCHEMA }, { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION}, + { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES} }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index eb72ad646..86a129a75 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -395,6 +395,7 @@ typedef enum { QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */ QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */ QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ + QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.1.1.x86_64.xml index f3635d9a0..fd044c192 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml @@ -161,6 +161,7 @@ + 2001001 0 diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.4.0.x86_64.xml index 8b72751e9..3423bec2a 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml @@ -183,6 +183,7 @@ + 2004000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.5.0.x86_64.xml index 215c3f110..d761935af 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml @@ -189,6 +189,7 @@ + 2005000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml index 80c29d3ab..47616d8e8 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml @@ -165,6 +165,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml index 2ef53173c..6f8a7031a 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml @@ -165,6 +165,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemu= capabilitiesdata/caps_2.6.0.ppc64le.xml index 78e78ca96..8f0419993 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml @@ -160,6 +160,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.6.0.x86_64.xml index 8caf448b4..c71a857b2 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml @@ -198,6 +198,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.7.0.s390x.xml index 6206bad9e..2c2fb408f 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml @@ -128,6 +128,7 @@ + 2007000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.7.0.x86_64.xml index fd13ae4f7..e3d7e7bf4 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml @@ -200,6 +200,7 @@ + 2007000 0 (v2.7.0) diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.8.0.s390x.xml index b7ce2c6c0..256540ad4 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml @@ -130,6 +130,7 @@ + 2007093 0 diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.8.0.x86_64.xml index b741e8fcc..04e4fcd09 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -201,6 +201,7 @@ + 2008000 0 (v2.8.0) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 8043240e2..aa4a06dcb 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -203,6 +203,7 @@ + 2008050 0 (v2.8.0-1961-g5b10b94bd5) --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596016596294.6430145561965; Wed, 15 Mar 2017 09:40:16 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGb3jH016519; Wed, 15 Mar 2017 12:37:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb0rx025013 for ; Wed, 15 Mar 2017 12:37:00 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIT000870; Wed, 15 Mar 2017 12:36:59 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:27 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 15/23] qemu: monitor: Add monitor infrastructure for query-named-block-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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add monitor tooling for calling query-named-block-nodes. The monitor returns the data as the raw JSON array that is returned from the monitor. Unfortunately the logic to extract the node names for a complete backing chain will be so complex that I won't be able to extract any meaningful subset of the data in the monitor code. --- src/qemu/qemu_monitor.c | 11 +++++++++++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 41 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index e2af0ca02..36b8b5ea4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4184,3 +4184,14 @@ qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, return qemuMonitorJSONSetBlockThreshold(mon, nodename, threshold); } + + +virJSONValuePtr +qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon) +{ + VIR_DEBUG("mon=3D%p", mon); + + QEMU_CHECK_MONITOR_JSON_NULL(mon); + + return qemuMonitorJSONQueryNamedBlockNodes(mon); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 61d89a9cf..77e7aeeca 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1076,5 +1076,6 @@ int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon, const char *nodename, unsigned long long threshold); +virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon); #endif /* QEMU_MONITOR_H */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6fb2af48a..141d56b3d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7518,3 +7518,29 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, return ret; } + + +virJSONValuePtr +qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) +{ + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + virJSONValuePtr ret =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-named-block-nodes", NU= LL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + ret =3D virJSONValueObjectStealArray(reply, "return"); + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index e0dd696d9..9c363a0a1 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -517,4 +517,7 @@ int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon, unsigned long long threshold) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon) + ATTRIBUTE_NONNULL(1); + #endif /* QEMU_MONITOR_JSON_H */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489596037151436.90290873816764; Wed, 15 Mar 2017 09:40:37 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGb5AP023647; Wed, 15 Mar 2017 12:37:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb1Qm025021 for ; Wed, 15 Mar 2017 12:37:01 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIU000870; Wed, 15 Mar 2017 12:37:00 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:28 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 16/23] qemu: block: Add code to allow detection of auto-allocated node names 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" qemu for some time already sets node names automatically for the block nodes. This patch adds code that attempts a best-effort detection of the node names for the backing chain from the output of 'query-named-block-nodes'. The only drawback is that the data provided by qemu needs to be matched by the filename as seen by qemu and thus if two disks share a single backing store file the detection won't work. This will allow us to use qemu commands such as 'block-set-write-threshold' which only accepts node names. In this patch only the detection code is added, it will be used later. --- src/Makefile.am | 1 + src/qemu/qemu_block.c | 280 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_block.h | 47 +++++++++ 3 files changed, 328 insertions(+) create mode 100644 src/qemu/qemu_block.c create mode 100644 src/qemu/qemu_block.h diff --git a/src/Makefile.am b/src/Makefile.am index f0d8efe50..b4ecd6366 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -823,6 +823,7 @@ VBOX_DRIVER_EXTRA_DIST =3D \ QEMU_DRIVER_SOURCES =3D \ qemu/qemu_agent.c qemu/qemu_agent.h \ qemu/qemu_alias.c qemu/qemu_alias.h \ + qemu/qemu_block.c qemu/qemu_block.h \ qemu/qemu_blockjob.c qemu/qemu_blockjob.h \ qemu/qemu_capabilities.c qemu/qemu_capabilities.h \ qemu/qemu_command.c qemu/qemu_command.h \ diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c new file mode 100644 index 000000000..91c04ab7f --- /dev/null +++ b/src/qemu/qemu_block.c @@ -0,0 +1,280 @@ +/* + * qemu_block.c: helper functions for QEMU block subsystem + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "qemu_block.h" +#include "qemu_domain.h" + +#include "viralloc.h" +#include "virstring.h" + +#define VIR_FROM_THIS VIR_FROM_QEMU + + +static void +qemuBlockNodeNameBackingChainDataFree(qemuBlockNodeNameBackingChainDataPtr= data) +{ + size_t i; + + if (!data) + return; + + for (i =3D 0; i < data->nelems; i++) + virJSONValueFree(data->elems[i]); + + VIR_FREE(data->nodeformat); + VIR_FREE(data->nodestorage); + VIR_FREE(data->nodebacking); + + VIR_FREE(data->qemufilename); + VIR_FREE(data->backingstore); + + VIR_FREE(data); +} + + +static void +qemuBlockNodeNameBackingChainDataHashEntryFree(void *opaque, + const void *name ATTRIBUTE_= UNUSED) +{ + qemuBlockNodeNameBackingChainDataFree(opaque); +} + + +struct qemuBlockNodeNameGetBackingChainData { + virHashTablePtr table; + qemuBlockNodeNameBackingChainDataPtr *entries; + size_t nentries; +}; + + +static int +qemuBlockNodeNameDetectProcessByFilename(size_t pos ATTRIBUTE_UNUSED, + virJSONValuePtr item, + void *opaque) +{ + struct qemuBlockNodeNameGetBackingChainData *data =3D opaque; + qemuBlockNodeNameBackingChainDataPtr entry; + const char *file; + + if (!(file =3D virJSONValueObjectGetString(item, "file"))) + return 1; + + if (!(entry =3D virHashLookup(data->table, file))) { + if (VIR_ALLOC(entry) < 0) + return -1; + + if (VIR_APPEND_ELEMENT_COPY(data->entries, data->nentries, entry) = < 0) { + VIR_FREE(entry); + return -1; + } + + if (VIR_STRDUP(entry->qemufilename, file) < 0) + return -1; + + if (virHashAddEntry(data->table, file, entry) < 0) + return -1; + } + + if (VIR_APPEND_ELEMENT(entry->elems, entry->nelems, item) < 0) + return -1; + + return 0; +} + + +static const char *qemuBlockDriversFormat[] =3D { + "qcow2", "raw", "qcow", "luks", "qed", "bochs", "cloop", "dmg", "paral= lels", + "vdi", "vhdx", "vmdk", "vpc", "vvfat", NULL}; +static const char *qemuBlockDriversStorage[] =3D { + "file", "iscsi", "nbd", "host_cdrom", "host_device", "ftp", "ftps", + "gluster", "http", "https", "nfs", "rbd", "sheepdog", "ssh", "tftp", N= ULL}; + + +static bool +qemuBlockDriverMatch(const char *drvname, + const char **drivers) +{ + while (*drivers) { + if (STREQ(drvname, *drivers)) + return true; + + drivers++; + } + + return false; +} + + +static int +qemuBlockNodeNameDetectProcessExtract(qemuBlockNodeNameBackingChainDataPtr= data) +{ + const char *drv; + const char *nodename; + const char *backingstore; + size_t i; + + /* Since the only way to construct the backing chain is to look up the= files + * by file name, if two disks share a backing image we can't know whic= h node + * belongs to which backing chain. Refuse to detect such chains. */ + if (data->nelems > 2) + return 0; + + for (i =3D 0; i < data->nelems; i++) { + drv =3D virJSONValueObjectGetString(data->elems[i], "drv"); + nodename =3D virJSONValueObjectGetString(data->elems[i], "node-nam= e"); + backingstore =3D virJSONValueObjectGetString(data->elems[i], "back= ing_file"); + + if (!drv || !nodename) + continue; + + if (qemuBlockDriverMatch(drv, qemuBlockDriversFormat)) { + if (data->nodeformat) + continue; + + if (VIR_STRDUP(data->nodeformat, nodename) < 0) + return -1; + + /* extract the backing store file name for the protocol layer = */ + if (VIR_STRDUP(data->backingstore, backingstore) < 0) + return -1; + } else if (qemuBlockDriverMatch(drv, qemuBlockDriversStorage)) { + if (data->nodestorage) + continue; + + if (VIR_STRDUP(data->nodestorage, nodename) < 0) + return -1; + } + } + + return 0; +} + + +static int +qemuBlockNodeNameDetectProcessLinkBacking(qemuBlockNodeNameBackingChainDat= aPtr data, + virHashTablePtr table) +{ + qemuBlockNodeNameBackingChainDataPtr backing; + + if (!data->backingstore) + return 0; + + if (!(backing =3D virHashLookup(table, data->backingstore))) + return 0; + + if (VIR_STRDUP(data->nodebacking, backing->nodeformat) < 0) + return -1; + + return 0; +} + + +static void +qemuBlockNodeNameGetBackingChainDataClearLookup(qemuBlockNodeNameBackingCh= ainDataPtr data) +{ + size_t i; + + for (i =3D 0; i < data->nelems; i++) + virJSONValueFree(data->elems[i]); + + VIR_FREE(data->elems); + data->nelems =3D 0; +} + + +/** + * qemuBlockNodeNameGetBackingChain: + * @json: JSON array of data returned from 'query-named-block-nodes' + * + * Tries to reconstruct the backing chain from @json to allow detection of + * node names that were auto-assigned by qemu. This is a best-effort opera= tion + * and may not be successful. The returned hash table contains the entries= as + * qemuBlockNodeNameBackingChainDataPtr accessible by the node name. The f= ields + * then can be used to recover the full backing chain. + * + * Returns a hash table on success and NULL on failure. + */ +virHashTablePtr +qemuBlockNodeNameGetBackingChain(virJSONValuePtr json) +{ + struct qemuBlockNodeNameGetBackingChainData data; + virHashTablePtr nodetable =3D NULL; + virHashTablePtr ret =3D NULL; + size_t i; + + memset(&data, 0, sizeof(data)); + + /* hash table keeps the entries accessible by the 'file' in qemu */ + if (!(data.table =3D virHashCreate(50, NULL))) + goto cleanup; + + /* first group the named entries by the 'file' field */ + if (virJSONValueArrayForeachSteal(json, + qemuBlockNodeNameDetectProcessByFile= name, + &data) < 0) + goto cleanup; + + /* extract the node names for the format and storage layer */ + for (i =3D 0; i < data.nentries; i++) { + if (qemuBlockNodeNameDetectProcessExtract(data.entries[i]) < 0) + goto cleanup; + } + + /* extract the node name for the backing file */ + for (i =3D 0; i < data.nentries; i++) { + if (qemuBlockNodeNameDetectProcessLinkBacking(data.entries[i], + data.table) < 0) + goto cleanup; + } + + /* clear JSON data necessary only for the lookup procedure */ + for (i =3D 0; i < data.nentries; i++) + qemuBlockNodeNameGetBackingChainDataClearLookup(data.entries[i]); + + /* create hash table hashed by the format node name */ + if (!(nodetable =3D virHashCreate(50, + qemuBlockNodeNameBackingChainDataHashE= ntryFree))) + goto cleanup; + + /* fill the entries */ + for (i =3D 0; i < data.nentries; i++) { + if (!data.entries[i]->nodeformat) + continue; + + if (virHashAddEntry(nodetable, data.entries[i]->nodeformat, + data.entries[i]) < 0) + goto cleanup; + + /* hash table steals the entry and then frees it by itself */ + data.entries[i] =3D NULL; + } + + VIR_STEAL_PTR(ret, nodetable); + + cleanup: + virHashFree(data.table); + virHashFree(nodetable); + for (i =3D 0; i < data.nentries; i++) + qemuBlockNodeNameBackingChainDataFree(data.entries[i]); + + VIR_FREE(data.entries); + + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h new file mode 100644 index 000000000..26f5ae062 --- /dev/null +++ b/src/qemu/qemu_block.h @@ -0,0 +1,47 @@ +/* + * qemu_block.h: helper functions for QEMU block subsystem + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#ifndef __QEMU_BLOCK_H__ +# define __QEMU_BLOCK_H__ + +# include "internal.h" + +# include "qemu_conf.h" + +# include "virhash.h" +# include "virjson.h" + +typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingC= hainData; +typedef qemuBlockNodeNameBackingChainData *qemuBlockNodeNameBackingChainDa= taPtr; +struct qemuBlockNodeNameBackingChainData { + char *qemufilename; /* name of the image from qemu */ + char *backingstore; + char *nodeformat; /* node name of the format layer */ + char *nodestorage; /* node name of the storage backing the format nod= e */ + + char *nodebacking; /* node name of the backing file format layer */ + + /* data necessary for detection of the node names from qemu */ + virJSONValuePtr *elems; + size_t nelems; +}; + +virHashTablePtr +qemuBlockNodeNameGetBackingChain(virJSONValuePtr data); + +#endif /* __QEMU_BLOCK_H__ */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1489596038189121.39847999416986; Wed, 15 Mar 2017 09:40:38 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb5TK005306; Wed, 15 Mar 2017 12:37:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb3r5025034 for ; Wed, 15 Mar 2017 12:37:03 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIV000870; Wed, 15 Mar 2017 12:37:02 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:29 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 17/23] tests: qemumonitorjson: Add test case for node name detection code 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The code is rather magic so a test case will help making sure that everything works well. The first case is a simple backing chain. --- .../qemumonitorjson-nodename-1.json | 268 +++++++++++++++++= ++++ .../qemumonitorjson-nodename-1.result | 15 ++ tests/qemumonitorjsontest.c | 116 +++++++++ 3 files changed, 399 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-1.js= on create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-1.re= sult diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.json b/te= sts/qemumonitorjsondata/qemumonitorjson-nodename-1.json new file mode 100644 index 000000000..fe2f32176 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.json @@ -0,0 +1,268 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block567", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 9665380352, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "format": "file", + "actual-size": 9665384448, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block424", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block331", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block281", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 32968704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14835364= 02", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block118", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545313", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 33030144, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "format": "file", + "actual-size": 32968704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block078", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545313", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result b/= tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result new file mode 100644 index 000000000..e43f3d366 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result @@ -0,0 +1,15 @@ +filename : '/var/lib/libvirt/images/rhel7.3.1483545313' +format node : '#block118' +storage node: '#block078' +backingfile : '/var/lib/libvirt/images/rhel7.3.1483536402' +backing ptr : '#block331' + filename : '/var/lib/libvirt/images/rhel7.3.1483536402' + format node : '#block331' + storage node: '#block281' + backingfile : '/var/lib/libvirt/images/rhel7.3.qcow2' + backing ptr : '#block567' + filename : '/var/lib/libvirt/images/rhel7.3.qcow2' + format node : '#block567' + storage node: '#block424' + backingfile : '' + backing ptr : '' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 402c87d45..fcc1540a8 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -23,6 +23,7 @@ #include "testutilsqemu.h" #include "qemumonitortestutils.h" #include "qemu/qemu_domain.h" +#include "qemu/qemu_block.h" #include "qemu/qemu_monitor_json.h" #include "virthread.h" #include "virerror.h" @@ -2659,6 +2660,109 @@ testQemuMonitorCPUInfo(const void *opaque) } +struct testBlockNodeNameDetectData { + const char *name; + const char *nodenames; +}; + + +static void +testBlockNodeNameDetectFormat(virBufferPtr buf, + const char *basenode, + virHashTablePtr nodedata) +{ + qemuBlockNodeNameBackingChainDataPtr entry =3D NULL; + const char *node =3D basenode; + + virBufferSetIndent(buf, 0); + + while (node) { + if (!(entry =3D virHashLookup(nodedata, node))) + break; + + virBufferAsprintf(buf, "filename : '%s'\n", entry->qemufilename= ); + virBufferAsprintf(buf, "format node : '%s'\n", + NULLSTR(entry->nodeformat)); + virBufferAsprintf(buf, "storage node: '%s'\n", + NULLSTR(entry->nodestorage)); + virBufferAsprintf(buf, "backingfile : '%s'\n", + NULLSTR(entry->backingstore)); + virBufferAsprintf(buf, "backing ptr : '%s'\n", + NULLSTR(entry->nodebacking)); + + virBufferAdjustIndent(buf, 2); + + node =3D entry->nodebacking; + } + + virBufferSetIndent(buf, 0); + virBufferAddLit(buf, "\n"); +} + + +static int +testBlockNodeNameDetect(const void *opaque) +{ + const struct testBlockNodeNameDetectData *data =3D opaque; + char *jsonFile =3D NULL; + char *jsonStr =3D NULL; + char *resultFile =3D NULL; + char *actual =3D NULL; + char **nodenames =3D NULL; + char **next; + virJSONValuePtr json =3D NULL; + virHashTablePtr nodedata =3D NULL; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + int ret =3D -1; + + if (virAsprintf(&jsonFile, + "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.js= on", + abs_srcdir, data->name) < 0 || + virAsprintf(&resultFile, + "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.re= sult", + abs_srcdir, data->name) < 0) + goto cleanup; + + if (!(nodenames =3D virStringSplit(data->nodenames, ",", 0))) + goto cleanup; + + if (virTestLoadFile(jsonFile, &jsonStr) < 0) + goto cleanup; + + if (!(json =3D virJSONValueFromString(jsonStr))) + goto cleanup; + + if (!(nodedata =3D qemuBlockNodeNameGetBackingChain(json))) + goto cleanup; + + for (next =3D nodenames; *next; next++) + testBlockNodeNameDetectFormat(&buf, *next, nodedata); + + virBufferTrim(&buf, "\n", -1); + + if (virBufferCheckError(&buf) < 0) + goto cleanup; + + actual =3D virBufferContentAndReset(&buf); + + if (virTestCompareToFile(actual, resultFile) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + VIR_FREE(jsonFile); + VIR_FREE(resultFile); + VIR_FREE(jsonStr); + VIR_FREE(actual); + virHashFree(nodedata); + virStringListFree(nodenames); + virJSONValueFree(json); + + return ret; +} + + static int mymain(void) { @@ -2793,6 +2897,18 @@ mymain(void) DO_TEST_CPU_INFO("ppc64-hotplug-4", 24); DO_TEST_CPU_INFO("ppc64-no-threads", 16); +#define DO_TEST_BLOCK_NODE_DETECT(testname, testnodes) = \ + do { = \ + struct testBlockNodeNameDetectData testdata =3D {testname, testnod= es}; \ + if (virTestRun("node-name-detect(" testname ")", = \ + testBlockNodeNameDetect, &testdata) < 0) = \ + ret =3D -1; = \ + } while (0) + + DO_TEST_BLOCK_NODE_DETECT("1", "#block118"); + +#undef DO_TEST_BLOCK_NODE_DETECT + qemuTestDriverFree(&driver); return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489596053377422.34063519047527; Wed, 15 Mar 2017 09:40:53 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGb5cw023640; Wed, 15 Mar 2017 12:37:05 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb4SN025046 for ; Wed, 15 Mar 2017 12:37:04 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIW000870; Wed, 15 Mar 2017 12:37:03 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:30 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 18/23] tests: qemumonitorjson: Add long backing chain test case for node name detection 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- .../qemumonitorjson-nodename-2.json | 2270 ++++++++++++++++= ++++ .../qemumonitorjson-nodename-2.result | 60 + tests/qemumonitorjsontest.c | 1 + 3 files changed, 2331 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.js= on create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.re= sult diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json b/te= sts/qemumonitorjsondata/qemumonitorjson-nodename-2.json new file mode 100644 index 000000000..452b9d695 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json @@ -0,0 +1,2270 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block2399", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 9665380352, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "format": "file", + "actual-size": 9665384448, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block2281", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block2157", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.qcow2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block2008", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14835364= 02", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1979", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483536402", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545313", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 33161216, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "format": "file", + "actual-size": 33099776, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1814", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545313", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow= 2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148353= 6402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14835453= 13", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1799", + "backing_file_depth": 3, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483545313", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545901", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1690", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483545901", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qc= ow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148353640= 2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148354= 5313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14835459= 01", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1528", + "backing_file_depth": 4, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483545901", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483546244", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1427", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483546244", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2= ", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536= 402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148354531= 3", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148354= 5901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14835462= 44", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1350", + "backing_file_depth": 5, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483546244", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483605920", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 19529728, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "format": "file", + "actual-size": 19472384, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1204", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483605920", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.qco= w2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14835= 36402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545= 313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148354590= 1", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148354= 6244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14836059= 20", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1119", + "backing_file_depth": 6, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483605920", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483605924", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 7798784, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "format": "file", + "actual-size": 7618560, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block1075", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483605924", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148353640= 2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel= 7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.q= cow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.1483536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148= 3536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14835= 45313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545= 901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 546244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148354624= 4", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148360= 5920", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 159182365, + "name": "1483615264", + "date-sec": 1483615264, + "date-nsec": 325173000, + "vm-clock-sec": 8, + "id": "1", + "vm-state-size": 151985953 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 163266560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14836059= 24", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block998", + "backing_file_depth": 7, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483605924", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483615252", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 163446784, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "format": "file", + "actual-size": 163266560, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block843", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1483615252", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qcow2= ", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483536= 402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rh= el7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7.3= .qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148354531= 3", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel= 7.3.1483536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1= 483536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.1483545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148= 3545313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14835= 45901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83546244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546= 244", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 605920", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148360592= 0", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 159182365, + "name": "1483615264", + "date-sec": 1483615264, + "date-nsec": 325173000, + "vm-clock-sec": 8, + "id": "1", + "vm-state-size": 151985953 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 163266560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148360= 5924", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 4132864, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14836152= 52", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block717", + "backing_file_depth": 8, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1483615252", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071872", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 4194304, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "format": "file", + "actual-size": 4132864, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block612", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071872", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.qco= w2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.14835= 36402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/= rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhel7= .3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545= 313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rh= el7.3.1483536402", + "backing-filename": "/var/lib/libvirt/images/rhel7.3= .1483536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148354590= 1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel= 7.3.1483545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1= 483545313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.1483545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148= 3545901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483546244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14835= 46244", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83605920", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605= 920", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 159182365, + "name": "1483615264", + "date-sec": 1483615264, + "date-nsec": 325173000, + "vm-clock-sec": 8, + "id": "1", + "vm-state-size": 151985953 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 163266560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 605924", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148360592= 4", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 4132864, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148361= 5252", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14840718= 72", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block560", + "backing_file_depth": 9, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071872", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071876", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block430", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071876", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.q= cow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148= 3536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/image= s/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/rhe= l7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.14835= 45313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/= rhel7.3.1483536402", + "backing-filename": "/var/lib/libvirt/images/rhel7= .3.1483536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483545= 901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rh= el7.3.1483545313", + "backing-filename": "/var/lib/libvirt/images/rhel7.3= .1483545313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148354624= 4", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel= 7.3.1483545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1= 483545901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.1483546244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148= 3546244", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483605920", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14836= 05920", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 159182365, + "name": "1483615264", + "date-sec": 1483615264, + "date-nsec": 325173000, + "vm-clock-sec": 8, + "id": "1", + "vm-state-size": 151985953 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 163266560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83605924", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605= 924", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 4132864, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483= 615252", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148361525= 2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148407= 1872", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 2560000, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14840718= 76", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block316", + "backing_file_depth": 10, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071876", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071877", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 2621440, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", + "format": "file", + "actual-size": 2560000, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block248", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071877", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3= .qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 9665384448, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": true, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1= 483536402", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/ima= ges/rhel7.3.qcow2", + "backing-filename": "/var/lib/libvirt/images/r= hel7.3.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148= 3545313", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 33099776, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/image= s/rhel7.3.1483536402", + "backing-filename": "/var/lib/libvirt/images/rhe= l7.3.1483536402", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.14835= 45901", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/= rhel7.3.1483545313", + "backing-filename": "/var/lib/libvirt/images/rhel7= .3.1483545313", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483546= 244", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rh= el7.3.1483545901", + "backing-filename": "/var/lib/libvirt/images/rhel7.3= .1483545901", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.148360592= 0", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 19472384, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel= 7.3.1483546244", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1= 483546244", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 945245467, + "name": "1483615244", + "date-sec": 1483615244, + "date-nsec": 439285000, + "vm-clock-sec": 4, + "id": "1", + "vm-state-size": 7226413 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 7618560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.= 3.1483605920", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148= 3605920", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "snapshots": [ + { + "vm-clock-nsec": 159182365, + "name": "1483615264", + "date-sec": 1483615264, + "date-nsec": 325173000, + "vm-clock-sec": 8, + "id": "1", + "vm-state-size": 151985953 + } + ], + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 163266560, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.= 1483605924", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.14836= 05924", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 4132864, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14= 83615252", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615= 252", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484= 071872", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.148407187= 2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 2560000, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.148407= 1876", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 9663676416, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071880", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 17440768, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.14840718= 77", + "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071877", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block161", + "backing_file_depth": 11, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071877", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071880", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 17498112, + "filename": "/var/lib/libvirt/images/rhel7.3.1484071880", + "format": "file", + "actual-size": 17440768, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block013", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/rhel7.3.1484071880", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result b/= tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result new file mode 100644 index 000000000..b6e1e2916 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result @@ -0,0 +1,60 @@ +filename : '/var/lib/libvirt/images/rhel7.3.1484071880' +format node : '#block161' +storage node: '#block013' +backingfile : '/var/lib/libvirt/images/rhel7.3.1484071877' +backing ptr : '#block316' + filename : '/var/lib/libvirt/images/rhel7.3.1484071877' + format node : '#block316' + storage node: '#block248' + backingfile : '/var/lib/libvirt/images/rhel7.3.1484071876' + backing ptr : '#block560' + filename : '/var/lib/libvirt/images/rhel7.3.1484071876' + format node : '#block560' + storage node: '#block430' + backingfile : '/var/lib/libvirt/images/rhel7.3.1484071872' + backing ptr : '#block717' + filename : '/var/lib/libvirt/images/rhel7.3.1484071872' + format node : '#block717' + storage node: '#block612' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483615252' + backing ptr : '#block998' + filename : '/var/lib/libvirt/images/rhel7.3.1483615252' + format node : '#block998' + storage node: '#block843' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483605924' + backing ptr : '#block1119' + filename : '/var/lib/libvirt/images/rhel7.3.1483605924' + format node : '#block1119' + storage node: '#block1075' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483605920' + backing ptr : '#block1350' + filename : '/var/lib/libvirt/images/rhel7.3.1483605920' + format node : '#block1350' + storage node: '#block1204' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483546244' + backing ptr : '#block1528' + filename : '/var/lib/libvirt/images/rhel7.3.1483546244' + format node : '#block1528' + storage node: '#block1427' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483545901' + backing ptr : '#block1799' + filename : '/var/lib/libvirt/images/rhel7.3.1483545901' + format node : '#block1799' + storage node: '#block1690' + backingfile : '/var/lib/libvirt/images/rhel7.3.1483545313' + backing ptr : '#block1979' + filename : '/var/lib/libvirt/images/rhel7.3.148354531= 3' + format node : '#block1979' + storage node: '#block1814' + backingfile : '/var/lib/libvirt/images/rhel7.3.148353640= 2' + backing ptr : '#block2157' + filename : '/var/lib/libvirt/images/rhel7.3.1483536= 402' + format node : '#block2157' + storage node: '#block2008' + backingfile : '/var/lib/libvirt/images/rhel7.3.qcow2' + backing ptr : '#block2399' + filename : '/var/lib/libvirt/images/rhel7.3.qcow2' + format node : '#block2399' + storage node: '#block2281' + backingfile : '' + backing ptr : '' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index fcc1540a8..fd27df184 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2906,6 +2906,7 @@ mymain(void) } while (0) DO_TEST_BLOCK_NODE_DETECT("1", "#block118"); + DO_TEST_BLOCK_NODE_DETECT("2", "#block161"); #undef DO_TEST_BLOCK_NODE_DETECT --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 14895960321771011.21777421029; Wed, 15 Mar 2017 09:40:32 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb9CE005322; Wed, 15 Mar 2017 12:37:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb53H025054 for ; Wed, 15 Mar 2017 12:37:05 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIX000870; Wed, 15 Mar 2017 12:37:04 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:31 +0100 Message-Id: <9fb3ac0b4a8f66ab9d932df1cb508e82d44a953d.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 19/23] tests: qemumonitorjson: Add case for two disks sharing a backing image 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since we have to match the images by filename a common backing image will break the detection process. Add a test case to see that the code correctly did not continue the detection process. --- .../qemumonitorjson-nodename-same-backing.json | 316 +++++++++++++++++= ++++ .../qemumonitorjson-nodename-same-backing.result | 11 + tests/qemumonitorjsontest.c | 1 + 3 files changed, 328 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same= -backing.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same= -backing.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backin= g.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.js= on new file mode 100644 index 000000000..78954bb25 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.json @@ -0,0 +1,316 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block729", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/base.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block628", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/b.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/base.qcow2", + "backing-filename": "/var/lib/libvirt/images/base.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block574", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/base.qcow2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/b.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/b.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block405", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/b.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block399", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/base.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block257", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/base.qcow2", + "backing-filename": "/var/lib/libvirt/images/base.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block170", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/base.qcow2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/a.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/a.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block057", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/a.qcow2", + "encryption_key_missing": false + } + ] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backin= g.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.= result new file mode 100644 index 000000000..2c774be27 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result @@ -0,0 +1,11 @@ +filename : '/var/lib/libvirt/images/a.qcow2' +format node : '#block170' +storage node: '#block057' +backingfile : '/var/lib/libvirt/images/base.qcow2' +backing ptr : '' + +filename : '/var/lib/libvirt/images/b.qcow2' +format node : '#block574' +storage node: '#block405' +backingfile : '/var/lib/libvirt/images/base.qcow2' +backing ptr : '' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index fd27df184..7e3e7db27 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2907,6 +2907,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("1", "#block118"); DO_TEST_BLOCK_NODE_DETECT("2", "#block161"); + DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); #undef DO_TEST_BLOCK_NODE_DETECT --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1489596048981162.2036072799433; Wed, 15 Mar 2017 09:40:48 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb8tv005963; Wed, 15 Mar 2017 12:37:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb6hr025067 for ; Wed, 15 Mar 2017 12:37:06 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIY000870; Wed, 15 Mar 2017 12:37:05 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:32 +0100 Message-Id: <581966b6f882329a63e4175beaa3c2b3258422e5.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 20/23] tests: qemumonitorjson: Add relative image names for node name detection 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" oVirt uses relative names with directories in them. Test such configuration. Also tests a snapshot done with _REUSE_EXTERNAL and a relative backing file pre-specified in the qcow2 metadata. --- .../qemumonitorjson-nodename-relative.json | 554 +++++++++++++++++= ++++ .../qemumonitorjson-nodename-relative.result | 31 ++ tests/qemumonitorjsontest.c | 1 + 3 files changed, 586 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-rela= tive.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-rela= tive.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.js= on b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.json new file mode 100644 index 000000000..1fee149ac --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.json @@ -0,0 +1,554 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/relsnap.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/base.qcow2", + "backing-filename": "/var/lib/libvirt/images/base.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block1177", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/base.qcow2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/relsnap.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/relsnap.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block1027", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/relsnap.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/base.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block957", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/base.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block840", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/base.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img0", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block709", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img0", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/img0", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block665", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img0", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img0", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img0", + "backing-filename": "/var/lib/libvirt/images/img0", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block514", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/img0", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img1", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/img1", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block481", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img1", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img0", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img0", + "backing-filename": "/var/lib/libvirt/images/img0", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img1", + "backing-filename": "/var/lib/libvirt/images/img1", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block357", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/img1", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/img2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block290", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img0", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img0", + "backing-filename": "/var/lib/libvirt/images/img0", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img1", + "backing-filename": "/var/lib/libvirt/images/img1", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/img3", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/img2", + "backing-filename": "/var/lib/libvirt/images/img2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block153", + "backing_file_depth": 3, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/img2", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img3", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/img3", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block076", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/img3", + "encryption_key_missing": false + } + ] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.re= sult b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result new file mode 100644 index 000000000..2cd908786 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result @@ -0,0 +1,31 @@ +filename : '/var/lib/libvirt/images/img3' +format node : '#block153' +storage node: '#block076' +backingfile : '/var/lib/libvirt/images/img2' +backing ptr : '#block357' + filename : '/var/lib/libvirt/images/img2' + format node : '#block357' + storage node: '#block290' + backingfile : '/var/lib/libvirt/images/img1' + backing ptr : '#block514' + filename : '/var/lib/libvirt/images/img1' + format node : '#block514' + storage node: '#block481' + backingfile : '/var/lib/libvirt/images/img0' + backing ptr : '#block709' + filename : '/var/lib/libvirt/images/img0' + format node : '#block709' + storage node: '#block665' + backingfile : '' + backing ptr : '' + +filename : '/var/lib/libvirt/images/relsnap.qcow2' +format node : '#block1177' +storage node: '#block1027' +backingfile : '/var/lib/libvirt/images/base.qcow2' +backing ptr : '#block957' + filename : '/var/lib/libvirt/images/base.qcow2' + format node : '#block957' + storage node: '#block840' + backingfile : '' + backing ptr : '' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 7e3e7db27..5b9f24d24 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2908,6 +2908,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("1", "#block118"); DO_TEST_BLOCK_NODE_DETECT("2", "#block161"); DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); + DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); #undef DO_TEST_BLOCK_NODE_DETECT --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489596021030499.9463756370085; Wed, 15 Mar 2017 09:40:21 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGbAq8016535; Wed, 15 Mar 2017 12:37:10 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb7NC025077 for ; Wed, 15 Mar 2017 12:37:07 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIZ000870; Wed, 15 Mar 2017 12:37:07 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:33 +0100 Message-Id: <2c224cf07a659fbf1e18ac6997f50f400b14a589.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 21/23] tests: qemumonitorjson: Test node name detection on networked 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- .../qemumonitorjson-nodename-gluster.json | 135 +++++++++++++++++= ++++ .../qemumonitorjson-nodename-gluster.result | 10 ++ tests/qemumonitorjsontest.c | 1 + 3 files changed, 146 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-glus= ter.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-glus= ter.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.jso= n b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.json new file mode 100644 index 000000000..7ea5c5d54 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.json @@ -0,0 +1,135 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img0", + "format": "raw", + "actual-size": 197120 + }, + "backing-filename-format": "raw", + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 197120, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "gluster://gluster-host/vol0/img0", + "backing-filename": "gluster://gluster-host/vol0/img0", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block1008", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "gluster://gluster-host/vol0/img0", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": true, + "writeback": true + }, + "file": "gluster://gluster-host/vol0/img1", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img1", + "format": "gluster", + "actual-size": 197120 + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block981", + "backing_file_depth": 0, + "drv": "gluster", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": true, + "writeback": true + }, + "file": "gluster://gluster-host/vol0/img1", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img0", + "format": "raw", + "actual-size": 197120 + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block349", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": true, + "writeback": true + }, + "file": "gluster://gluster-host/vol0/img0", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img0", + "format": "gluster", + "actual-size": 197120 + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block269", + "backing_file_depth": 0, + "drv": "gluster", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": true, + "writeback": true + }, + "file": "gluster://gluster-host/vol0/img0", + "encryption_key_missing": false + } + ] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.res= ult b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result new file mode 100644 index 000000000..f38798d4b --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result @@ -0,0 +1,10 @@ +filename : 'gluster://gluster-host/vol0/img1' +format node : '#block1008' +storage node: '#block981' +backingfile : 'gluster://gluster-host/vol0/img0' +backing ptr : '#block349' + filename : 'gluster://gluster-host/vol0/img0' + format node : '#block349' + storage node: '#block269' + backingfile : '' + backing ptr : '' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 5b9f24d24..4925a00b7 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2909,6 +2909,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("2", "#block161"); DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); + DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); #undef DO_TEST_BLOCK_NODE_DETECT --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489596041430680.5014157836943; Wed, 15 Mar 2017 09:40:41 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGbB1e023664; Wed, 15 Mar 2017 12:37:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGb9di025085 for ; Wed, 15 Mar 2017 12:37:09 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIa000870; Wed, 15 Mar 2017 12:37:08 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:34 +0100 Message-Id: <275841c1ec3bb8c3baeb9b73fd83f8d43830d998.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 22/23] qemu: monitor: Extract the top level format node when querying disks 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To allow matching the node names gathered via 'query-named-block-nodes' we need to query and then use the top level nodes from 'query-block'. Add the data to the structure returned by qemuMonitorGetBlockInfo. --- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_monitor.c | 12 +++++++++++- src/qemu/qemu_monitor_json.c | 8 +++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3a7afdf45..0cbea95fc 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -356,6 +356,7 @@ struct qemuDomainDiskInfo { bool tray_open; bool empty; int io_status; + char *nodename; }; typedef struct _qemuDomainHostdevPrivate qemuDomainHostdevPrivate; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 36b8b5ea4..d958f6390 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2148,6 +2148,16 @@ qemuMonitorBlockIOStatusToError(const char *status) } +static void +qemuDomainDiskInfoFree(void *value, const void *name ATTRIBUTE_UNUSED) +{ + struct qemuDomainDiskInfo *info =3D value; + + VIR_FREE(info->nodename); + VIR_FREE(info); +} + + virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon) { @@ -2156,7 +2166,7 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon) QEMU_CHECK_MONITOR_NULL(mon); - if (!(table =3D virHashCreate(32, virHashValueFree))) + if (!(table =3D virHashCreate(32, qemuDomainDiskInfoFree))) return NULL; if (mon->json) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 141d56b3d..75af5cb93 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1868,9 +1868,11 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, for (i =3D 0; i < virJSONValueArraySize(devices); i++) { virJSONValuePtr dev; + virJSONValuePtr image; struct qemuDomainDiskInfo *info; const char *thisdev; const char *status; + const char *nodename; if (!(dev =3D qemuMonitorJSONGetBlockDev(devices, i))) goto cleanup; @@ -1907,8 +1909,12 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, info->tray =3D true; /* presence of 'inserted' notifies that a medium is in the device = */ - if (!virJSONValueObjectGetObject(dev, "inserted")) + if ((image =3D virJSONValueObjectGetObject(dev, "inserted"))) { + if ((nodename =3D virJSONValueObjectGetString(image, "node-nam= e"))) + ignore_value(VIR_STRDUP(info->nodename, nodename)); + } else { info->empty =3D true; + } /* Missing io-status indicates no error */ if ((status =3D virJSONValueObjectGetString(dev, "io-status"))) { --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 14:03:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489596039822451.94976541361586; Wed, 15 Mar 2017 09:40:39 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGbD2o023675; Wed, 15 Mar 2017 12:37:13 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGbAjd025101 for ; Wed, 15 Mar 2017 12:37:10 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIb000870; Wed, 15 Mar 2017 12:37:09 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:35 +0100 Message-Id: <441e75c3fc4a970902f2586fbe9519d487cac1ee.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 23/23] qemu: block: Add code to detect node names when necessary 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Detect the node names when setting block threshold and when reconnecting or when they are cleared when a block job finishes. This operation will become a no-op once we fully support node names. --- src/qemu/qemu_block.c | 98 ++++++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_block.h | 4 ++ src/qemu/qemu_blockjob.c | 2 + src/qemu/qemu_driver.c | 5 +++ src/qemu/qemu_process.c | 4 ++ 5 files changed, 113 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 91c04ab7f..ebf11ceb6 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -278,3 +278,101 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr json) return ret; } + + +static void +qemuBlockDiskClearDetectedNodes(virDomainDiskDefPtr disk) +{ + virStorageSourcePtr next =3D disk->src; + + while (next) { + VIR_FREE(next->nodeformat); + VIR_FREE(next->nodebacking); + + next =3D next->backingStore; + } +} + + +static int +qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, + const char *parentnode, + virHashTablePtr table) +{ + qemuBlockNodeNameBackingChainDataPtr entry =3D NULL; + virStorageSourcePtr src =3D disk->src; + + /* don't attempt the detection if the top level already has node names= */ + if (!parentnode || src->nodeformat || src->nodebacking) + return 0; + + while (src && parentnode) { + if (!(entry =3D virHashLookup(table, parentnode))) + break; + + if (src->nodeformat || src->nodebacking) { + if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || + STRNEQ_NULLABLE(src->nodebacking, entry->nodestorage)) + goto error; + + break; + } else { + if (VIR_STRDUP(src->nodeformat, entry->nodeformat) < 0 || + VIR_STRDUP(src->nodebacking, entry->nodestorage) < 0) + goto error; + } + + parentnode =3D entry->nodebacking; + src =3D src->backingStore; + } + + return 0; + + error: + qemuBlockDiskClearDetectedNodes(disk); + return -1; +} + + +int +qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, + virDomainObjPtr vm) +{ + virHashTablePtr disktable =3D NULL; + virHashTablePtr nodenametable =3D NULL; + virJSONValuePtr data =3D NULL; + virDomainDiskDefPtr disk; + struct qemuDomainDiskInfo *info; + size_t i; + int ret =3D -1; + + qemuDomainObjEnterMonitor(driver, vm); + + disktable =3D qemuMonitorGetBlockInfo(qemuDomainGetMonitor(vm)); + data =3D qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm)); + + if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !disktable) + goto cleanup; + + if (!(nodenametable =3D qemuBlockNodeNameGetBackingChain(data))) + goto cleanup; + + for (i =3D 0; i < vm->def->ndisks; i++) { + disk =3D vm->def->disks[i]; + + if (!(info =3D virHashLookup(disktable, disk->info.alias))) + continue; + + if (qemuBlockDiskDetectNodes(disk, info->nodename, nodenametable) = < 0) + goto cleanup; + } + + ret =3D 0; + + cleanup: + virJSONValueFree(data); + virHashFree(nodenametable); + virHashFree(disktable); + + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 26f5ae062..56f4a74dd 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -44,4 +44,8 @@ struct qemuBlockNodeNameBackingChainData { virHashTablePtr qemuBlockNodeNameGetBackingChain(virJSONValuePtr data); +int +qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, + virDomainObjPtr vm); + #endif /* __QEMU_BLOCK_H__ */ diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 985fae1e9..0601e68da 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -24,6 +24,7 @@ #include "internal.h" #include "qemu_blockjob.h" +#include "qemu_block.h" #include "qemu_domain.h" #include "conf/domain_conf.h" @@ -166,6 +167,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, disk->mirrorJob =3D VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN; ignore_value(qemuDomainDetermineDiskChain(driver, vm, disk, true, true)); + ignore_value(qemuBlockNodeNamesDetect(driver, vm)); diskPriv->blockjob =3D false; break; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d8e3ddf57..22cf866cd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -46,6 +46,7 @@ #include "qemu_driver.h" #include "qemu_agent.h" #include "qemu_alias.h" +#include "qemu_block.h" #include "qemu_conf.h" #include "qemu_capabilities.h" #include "qemu_command.h" @@ -20333,6 +20334,10 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (!(src =3D qemuDomainGetStorageSourceByDevstr(dev, vm->def))) goto endjob; + if (!src->nodebacking && + qemuBlockNodeNamesDetect(driver, vm) < 0) + goto endjob; + if (!src->nodebacking) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("threshold currently can't be set for block devic= e '%s'"), diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d40deea10..d8626d410 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -35,6 +35,7 @@ #include "qemu_process.h" #include "qemu_processpriv.h" #include "qemu_alias.h" +#include "qemu_block.h" #include "qemu_domain.h" #include "qemu_domain_address.h" #include "qemu_cgroup.h" @@ -3474,6 +3475,9 @@ qemuProcessReconnect(void *opaque) if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) goto error; + if (qemuBlockNodeNamesDetect(driver, obj) < 0) + goto error; + if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < = 0) goto error; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list