From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924550755350.70402809718655; Mon, 18 Mar 2019 08:55:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEA993082E46; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9597360C8A; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 54F1D181A13B; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtRuq022575 for ; Mon, 18 Mar 2019 11:55:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id A2B381001E7E; Mon, 18 Mar 2019 15:55:27 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BF4D1001E61 for ; Mon, 18 Mar 2019 15:55:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:50 +0100 Message-Id: <7ece6bdc8ca6ce9e0f22cf0ffacaddfa70c3af40.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/34] conf: Invert 'skipSeclabels' argument of virDomainDiskSourceFormatInternal 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 18 Mar 2019 15:55:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Rename it to 'seclabels' and invert the value. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 14 +++++++------- src/conf/domain_conf.h | 2 +- src/qemu/qemu_domain.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 504c24b545..97d56c0067 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23760,7 +23760,7 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags, - bool skipSeclabels) + bool seclabels) { switch ((virStorageType)src->type) { case VIR_STORAGE_TYPE_FILE: @@ -23800,7 +23800,7 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, return -1; } - if (!skipSeclabels && src->type !=3D VIR_STORAGE_TYPE_NETWORK) + if (seclabels && src->type !=3D VIR_STORAGE_TYPE_NETWORK) virDomainSourceDefFormatSeclabel(childBuf, src->nseclabels, src->seclabels, flags); @@ -23832,7 +23832,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, virStorageSourcePtr src, int policy, unsigned int flags, - bool skipSeclabels, + bool seclabels, bool attrIndex, virDomainXMLOptionPtr xmlopt) { @@ -23843,7 +23843,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - skipSeclabels) < 0) + seclabels) < 0) goto cleanup; if (policy && src->type !=3D VIR_STORAGE_TYPE_NETWORK) @@ -23873,7 +23873,7 @@ virDomainDiskSourceFormat(virBufferPtr buf, unsigned int flags, virDomainXMLOptionPtr xmlopt) { - return virDomainDiskSourceFormatInternal(buf, src, policy, flags, fals= e, + return virDomainDiskSourceFormatInternal(buf, src, policy, flags, true, false, xmlopt); } @@ -23916,7 +23916,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virBufferAsprintf(buf, "\n", format); /* We currently don't output seclabels for backing chain element */ - if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, tru= e, + if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, fal= se, false, xmlopt) < 0 || virDomainDiskBackingStoreFormat(buf, backingStore->backingStore, xmlopt, flags) < 0) @@ -24175,7 +24175,7 @@ virDomainDiskDefFormat(virBufferPtr buf, virStorageAuthDefFormat(buf, def->src->auth); if (virDomainDiskSourceFormatInternal(buf, def->src, def->startupPolic= y, - flags, false, true, xmlopt) < 0) + flags, true, true, xmlopt) < 0) return -1; /* Don't format backingStore to inactive XMLs until the code for diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 538fb50b9e..cad330715b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3461,7 +3461,7 @@ int virDomainStorageSourceFormat(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags, - bool skipSeclabels) + bool seclabels) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainStorageSourceParse(xmlNodePtr node, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 86e80391e1..341ea7d37c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2358,7 +2358,7 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBu= fferPtr buf, virStorageFileFormatTypeToString(src->format)); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, - VIR_DOMAIN_DEF_FORMAT_STATUS, false) = < 0) + VIR_DOMAIN_DEF_FORMAT_STATUS, true) <= 0) goto cleanup; if (qemuStorageSourcePrivateDataFormat(src, &privateDataBuf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924534166174.01643770173587; Mon, 18 Mar 2019 08:55:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EED9C057F31; Mon, 18 Mar 2019 15:55:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F156D17CFE; Mon, 18 Mar 2019 15:55:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C31093FA48; Mon, 18 Mar 2019 15:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtSmm022583 for ; Mon, 18 Mar 2019 11:55:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 753941001DC8; Mon, 18 Mar 2019 15:55:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0F7D1001E7B for ; Mon, 18 Mar 2019 15:55:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:51 +0100 Message-Id: <684bf4494acdccb3bf3463f765ca21c25022a7c0.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/34] conf: Move formatting of 'index' and 'startupPolicy' for 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 18 Mar 2019 15:55:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move the formatters from virDomainDiskSourceFormatInternal to virDomainStorageSourceFormat. While 'startupPolicy' is attribute of the disk, we can format it when formating generic virStorageSource into an element to allow simplifying the code. Since the arguments for virDomainStorageSourceFormat got complex this patch also documents them. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 44 ++++++++++++++++++++++++++++++------------ src/conf/domain_conf.h | 5 ++++- src/qemu/qemu_domain.c | 3 ++- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 97d56c0067..4083839fc8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23755,12 +23755,32 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr= buf, } +/** + * virDomainStorageSourceFormat: + * @attrBuf: buffer for containing attribute portion of @src + * @childBuf: buffer for subelements of the formatted element + * @src: storage source to format + * @flags: XML formatter flags + * @seclabels: security labels are formatted if true + * @attrIndex: the 'index' attribute is formatted if true + * @policy: startup policy, taken from disk (use 0 to omit) + * @xmlopt: XML options data (for private data formatters) + * + * Formats @src into the attributes (@attrBuf) and subelements (@childBuf)= ready + * for creating a full XML element representing @src. + * + * Note that this does _not_ format the 'type' and 'format' of @src due to + * differences in callers. + */ int virDomainStorageSourceFormat(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags, - bool seclabels) + bool seclabels, + bool attrIndex, + int policy, + virDomainXMLOptionPtr xmlopt) { switch ((virStorageType)src->type) { case VIR_STORAGE_TYPE_FILE: @@ -23823,6 +23843,16 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, virStoragePRDefFormat(childBuf, src->pr, flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE); + if (policy && src->type !=3D VIR_STORAGE_TYPE_NETWORK) + virBufferEscapeString(attrBuf, " startupPolicy=3D'%s'", + virDomainStartupPolicyTypeToString(policy)); + + if (attrIndex && src->id !=3D 0) + virBufferAsprintf(attrBuf, " index=3D'%u'", src->id); + + if (virDomainDiskSourceFormatPrivateData(childBuf, src, flags, xmlopt)= < 0) + return -1; + return 0; } @@ -23843,17 +23873,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - seclabels) < 0) - goto cleanup; - - if (policy && src->type !=3D VIR_STORAGE_TYPE_NETWORK) - virBufferEscapeString(&attrBuf, " startupPolicy=3D'%s'", - virDomainStartupPolicyTypeToString(policy)); - - if (attrIndex && src->id !=3D 0) - virBufferAsprintf(&attrBuf, " index=3D'%u'", src->id); - - if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt= ) < 0) + seclabels, attrIndex, policy, xmlopt)= < 0) goto cleanup; if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cad330715b..a6f8e13088 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3461,7 +3461,10 @@ int virDomainStorageSourceFormat(virBufferPtr attrBu= f, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags, - bool seclabels) + bool seclabels, + bool attrIndex, + int policy, + virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainStorageSourceParse(xmlNodePtr node, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 341ea7d37c..d25d9ab666 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2358,7 +2358,8 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBu= fferPtr buf, virStorageFileFormatTypeToString(src->format)); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, - VIR_DOMAIN_DEF_FORMAT_STATUS, true) <= 0) + VIR_DOMAIN_DEF_FORMAT_STATUS, true, + false, 0, NULL) < 0) goto cleanup; if (qemuStorageSourcePrivateDataFormat(src, &privateDataBuf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924534165204.26363512841738; Mon, 18 Mar 2019 08:55:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02AF43086208; Mon, 18 Mar 2019 15:55:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66AC4600C5; Mon, 18 Mar 2019 15:55:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A22E13FA46; Mon, 18 Mar 2019 15:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtTZL022590 for ; Mon, 18 Mar 2019 11:55:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 491841001DC8; Mon, 18 Mar 2019 15:55:29 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id C38D91001E61 for ; Mon, 18 Mar 2019 15:55:28 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:52 +0100 Message-Id: <875c92fe77443c40f3061d86a2937a253bd7e9f6.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/34] conf: Introduce virDomainStorageSourceFormatFull 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 18 Mar 2019 15:55:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The new function formats a virStorageSource into an XML element which already contains type and format for simpler handling. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 8 ++++++++ src/libvirt_private.syms | 1 + 3 files changed, 48 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4083839fc8..9f1f46c905 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23857,6 +23857,45 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, } +/** + * virDomainStorageSourceFormatFull: + * @buf: output buffer + * @src: storage source to format + * @elemname: name of the top level element to use + * @status: output status-XML style private data + * @xmlopt: formatter callback data structure + * + * Formats @src into a XML element called @elemname. The element has both = 'type' + * and 'format' attributes and thus is fully standalone. + */ +int +virDomainStorageSourceFormatFull(virBufferPtr buf, + virStorageSourcePtr src, + const char *elemname, + bool status, + virDomainXMLOptionPtr xmlopt) +{ + VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; + unsigned int flags =3D 0; + + if (status) + flags |=3D VIR_DOMAIN_DEF_FORMAT_STATUS; + + virBufferSetChildIndent(&childBuf, buf); + + virBufferAsprintf(&attrBuf, " type=3D'%s' format=3D'%s'", + virStorageTypeToString(src->type), + virStorageFileFormatTypeToString(src->format)); + + if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, + true, true, 0, xmlopt) < 0) + return -1; + + return virXMLFormatElement(buf, elemname, &attrBuf, &childBuf); +} + + static int virDomainDiskSourceFormatInternal(virBufferPtr buf, virStorageSourcePtr src, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a6f8e13088..547ce8c5b9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3467,6 +3467,14 @@ int virDomainStorageSourceFormat(virBufferPtr attrBu= f, virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int +virDomainStorageSourceFormatFull(virBufferPtr buf, + virStorageSourcePtr src, + const char *elemname, + bool status, + virDomainXMLOptionPtr xmlopt) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + int virDomainStorageSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virStorageSourcePtr src, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d9494a04bb..5b031ff877 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -564,6 +564,7 @@ virDomainStateTypeFromString; virDomainStateTypeToString; virDomainStorageNetworkParseHost; virDomainStorageSourceFormat; +virDomainStorageSourceFormatFull; virDomainStorageSourceParse; virDomainTaintTypeFromString; virDomainTaintTypeToString; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924556106201.93287621717093; Mon, 18 Mar 2019 08:55:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1737830789BE; Mon, 18 Mar 2019 15:55:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEF271001E7E; Mon, 18 Mar 2019 15:55:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9AD22181A13E; Mon, 18 Mar 2019 15:55:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtUti022596 for ; Mon, 18 Mar 2019 11:55:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1A5081001E61; Mon, 18 Mar 2019 15:55:30 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 975F71001DC8 for ; Mon, 18 Mar 2019 15:55:29 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:53 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/34] qemu: domain: Replace qemuDomainObjPrivateXMLFormatNBDMigrationSource 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Mar 2019 15:55:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use virDomainStorageSourceFormatFull which has the same functionality. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 43 ++++-------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d25d9ab666..78287b4d3e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2341,47 +2341,11 @@ qemuDomainObjPrivateXMLFormatPR(virBufferPtr buf, } -static int -qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf, - virStorageSourcePtr src) -{ - VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; - VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; - VIR_AUTOCLEAN(virBuffer) privateDataBuf =3D VIR_BUFFER_INITIALIZER; - int ret =3D -1; - - virBufferSetChildIndent(&childBuf, buf); - virBufferSetChildIndent(&privateDataBuf, &childBuf); - - virBufferAsprintf(&attrBuf, " type=3D'%s' format=3D'%s'", - virStorageTypeToString(src->type), - virStorageFileFormatTypeToString(src->format)); - - if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, - VIR_DOMAIN_DEF_FORMAT_STATUS, true, - false, 0, NULL) < 0) - goto cleanup; - - if (qemuStorageSourcePrivateDataFormat(src, &privateDataBuf) < 0) - goto cleanup; - - if (virXMLFormatElement(&childBuf, "privateData", NULL, &privateDataBu= f) < 0) - goto cleanup; - - if (virXMLFormatElement(buf, "migrationSource", &attrBuf, &childBuf) <= 0) - goto cleanup; - - ret =3D 0; - - cleanup: - return ret; -} - - static int qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf, virDomainObjPtr vm) { + qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; size_t i; @@ -2399,8 +2363,9 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPt= r buf, disk->dst, diskPriv->migrating ? "yes" : "no"); if (diskPriv->migrSource && - qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf, - diskPriv->migr= Source) < 0) + virDomainStorageSourceFormatFull(&childBuf, diskPriv->migrSour= ce, + "migrationSource", true, + priv->driver->xmlopt) < 0) goto cleanup; if (virXMLFormatElement(buf, "disk", &attrBuf, &childBuf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924559613366.7856077893191; Mon, 18 Mar 2019 08:55:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB9DD308219E; Mon, 18 Mar 2019 15:55:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 974DF1724A; Mon, 18 Mar 2019 15:55:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5618F181A268; Mon, 18 Mar 2019 15:55:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtUdB022608 for ; Mon, 18 Mar 2019 11:55:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6E8C1001F5E; Mon, 18 Mar 2019 15:55:30 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 683901001E61 for ; Mon, 18 Mar 2019 15:55:30 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:54 +0100 Message-Id: <4a6369bfe4fdf0dd0fb76092d3e923b57886656e.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/34] conf: Unexport virDomainStorageSourceFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 18 Mar 2019 15:55:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It's not used outside of src/conf/domain_conf.c Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 10 ---------- src/libvirt_private.syms | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9f1f46c905..32f6d88596 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23772,7 +23772,7 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr b= uf, * Note that this does _not_ format the 'type' and 'format' of @src due to * differences in callers. */ -int +static int virDomainStorageSourceFormat(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 547ce8c5b9..51e0757f5c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3457,16 +3457,6 @@ int virDomainDiskDefCheckDuplicateInfo(const virDoma= inDiskDef *a, const virDomainDiskDef *b) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int virDomainStorageSourceFormat(virBufferPtr attrBuf, - virBufferPtr childBuf, - virStorageSourcePtr src, - unsigned int flags, - bool seclabels, - bool attrIndex, - int policy, - virDomainXMLOptionPtr xmlopt) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); - int virDomainStorageSourceFormatFull(virBufferPtr buf, virStorageSourcePtr src, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5b031ff877..010c8ac481 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -563,7 +563,6 @@ virDomainStateReasonToString; virDomainStateTypeFromString; virDomainStateTypeToString; virDomainStorageNetworkParseHost; -virDomainStorageSourceFormat; virDomainStorageSourceFormatFull; virDomainStorageSourceParse; virDomainTaintTypeFromString; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924555048131.86616137200895; Mon, 18 Mar 2019 08:55:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C89A93091782; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BC322B9F5; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5D7183FA4B; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtVC7022618 for ; Mon, 18 Mar 2019 11:55:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6D6F1001DC8; Mon, 18 Mar 2019 15:55:31 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 400A31018A00 for ; Mon, 18 Mar 2019 15:55:31 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/34] conf: domain: Merge virDomainDiskSourceFormatInternal into the wrapper 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 18 Mar 2019 15:55:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virDomainDiskSourceFormat would call virDomainDiskSourceFormatInternal with a limited set of parameters. Remove the 'Internal' variant by squishing into virDomainDiskSourceFormat and fix the callers. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 38 +++++++++++++------------------------- src/conf/domain_conf.h | 2 ++ src/conf/snapshot_conf.c | 2 +- tests/qemublocktest.c | 2 +- tests/virstoragetest.c | 2 +- 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 32f6d88596..79e15c9886 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23896,14 +23896,14 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, } -static int -virDomainDiskSourceFormatInternal(virBufferPtr buf, - virStorageSourcePtr src, - int policy, - unsigned int flags, - bool seclabels, - bool attrIndex, - virDomainXMLOptionPtr xmlopt) +int +virDomainDiskSourceFormat(virBufferPtr buf, + virStorageSourcePtr src, + int policy, + unsigned int flags, + bool seclabels, + bool attrIndex, + virDomainXMLOptionPtr xmlopt) { VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; @@ -23925,18 +23925,6 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, } -int -virDomainDiskSourceFormat(virBufferPtr buf, - virStorageSourcePtr src, - int policy, - unsigned int flags, - virDomainXMLOptionPtr xmlopt) -{ - return virDomainDiskSourceFormatInternal(buf, src, policy, flags, true, - false, xmlopt); -} - - static int virDomainDiskBackingStoreFormat(virBufferPtr buf, virStorageSourcePtr backingStore, @@ -23975,8 +23963,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virBufferAsprintf(buf, "\n", format); /* We currently don't output seclabels for backing chain element */ - if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, fal= se, - false, xmlopt) < 0 || + if (virDomainDiskSourceFormat(buf, backingStore, 0, flags, false, + false, xmlopt) < 0 || virDomainDiskBackingStoreFormat(buf, backingStore->backingStore, xmlopt, flags) < 0) return -1; @@ -24137,7 +24125,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "\n", formatStr); - if (virDomainDiskSourceFormat(buf, disk->mirror, 0, 0, xmlopt) < 0) + if (virDomainDiskSourceFormat(buf, disk->mirror, 0, 0, true, false, xm= lopt) < 0) return -1; virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -24233,8 +24221,8 @@ virDomainDiskDefFormat(virBufferPtr buf, if (def->src->auth && !def->src->authInherited) virStorageAuthDefFormat(buf, def->src->auth); - if (virDomainDiskSourceFormatInternal(buf, def->src, def->startupPolic= y, - flags, true, true, xmlopt) < 0) + if (virDomainDiskSourceFormat(buf, def->src, def->startupPolicy, + flags, true, true, xmlopt) < 0) return -1; /* Don't format backingStore to inactive XMLs until the code for diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 51e0757f5c..7ea9822fe4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3016,6 +3016,8 @@ int virDomainDiskSourceFormat(virBufferPtr buf, virStorageSourcePtr src, int policy, unsigned int flags, + bool seclabels, + bool attrIndex, virDomainXMLOptionPtr xmlopt); int virDomainNetDefFormat(virBufferPtr buf, diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index ffb1313c89..a849a58da3 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -768,7 +768,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, if (disk->src->format > 0) virBufferEscapeString(buf, "\n", virStorageFileFormatTypeToString(disk->src->= format)); - if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, xmlopt) < 0) + if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, true, false, xmlop= t) < 0) return -1; virBufferAdjustIndent(buf, -2); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 4cd15a1dff..6b5571b7cb 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -87,7 +87,7 @@ testBackingXMLjsonXML(const void *args) goto cleanup; } - if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, NULL) < 0 || + if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, true, false, NULL) = < 0 || !(actualxml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); goto cleanup; diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index fb98903f02..75c60da537 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -657,7 +657,7 @@ testBackingParse(const void *args) goto cleanup; } - if (virDomainDiskSourceFormat(&buf, src, 0, 0, NULL) < 0 || + if (virDomainDiskSourceFormat(&buf, src, 0, 0, true, false, NULL) < 0 = || !(xml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924551281689.2535849772277; Mon, 18 Mar 2019 08:55:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0E913082E55; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 973836090C; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 59132181A13D; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtWAQ022626 for ; Mon, 18 Mar 2019 11:55:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 881A91001DC8; Mon, 18 Mar 2019 15:55:32 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FE301001E61 for ; Mon, 18 Mar 2019 15:55:31 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:56 +0100 Message-Id: <2d8ea476cf53f1d355d560bd42c2dafdc9178df6.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/34] conf: Simplify control flow in virDomainDiskSourceFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 18 Mar 2019 15:55:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that the cleanup section is handled automatically it can be removed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 79e15c9886..b78481c280 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23907,21 +23907,14 @@ virDomainDiskSourceFormat(virBufferPtr buf, { VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; - int ret =3D -1; virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, seclabels, attrIndex, policy, xmlopt)= < 0) - goto cleanup; - - if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - return ret; + return virXMLFormatElement(buf, "source", &attrBuf, &childBuf); } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924558229814.3003814667524; Mon, 18 Mar 2019 08:55:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6579F3082AC3; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38DBB17AA9; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EBC07181A264; Mon, 18 Mar 2019 15:55:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtXkF022631 for ; Mon, 18 Mar 2019 11:55:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 58DDE1001DC8; Mon, 18 Mar 2019 15:55:33 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D61241001E61 for ; Mon, 18 Mar 2019 15:55:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:57 +0100 Message-Id: <8c583b185ef04193c7f67c9d6df5db691152039b.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/34] conf: Avoid temporary variable in virDomainDiskBackingStoreFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Modify the check that the format is in range to be standalone and use the convertor function directly. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b78481c280..ae17992b83 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23924,7 +23924,6 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virDomainXMLOptionPtr xmlopt, unsigned int flags) { - const char *format; bool inactive =3D flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE; if (!backingStore) @@ -23939,8 +23938,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, return 0; } - if (backingStore->format <=3D 0 || - !(format =3D virStorageFileFormatTypeToString(backingStore->format= ))) { + if (backingStore->format <=3D 0 || backingStore->format >=3D VIR_STORA= GE_FILE_LAST) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected disk backing store format %d"), backingStore->format); @@ -23954,7 +23952,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - virBufferAsprintf(buf, "\n", format); + virBufferAsprintf(buf, "\n", + virStorageFileFormatTypeToString(backingStore->forma= t)); /* We currently don't output seclabels for backing chain element */ if (virDomainDiskSourceFormat(buf, backingStore, 0, flags, false, false, xmlopt) < 0 || --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924554695955.4111652455243; Mon, 18 Mar 2019 08:55:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D170B8667D; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5E9D5D70D; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6225D3FA4C; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtYwV022640 for ; Mon, 18 Mar 2019 11:55:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C9711001E6A; Mon, 18 Mar 2019 15:55:34 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7A571001E61 for ; Mon, 18 Mar 2019 15:55:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:58 +0100 Message-Id: <07146e590f95327210b27ed08498e9964cc81806.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/34] conf: Use virXMLFormatElement in virDomainDiskBackingStoreFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 18 Mar 2019 15:55:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ae17992b83..2b6a2b7ee8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23924,8 +23924,12 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virDomainXMLOptionPtr xmlopt, unsigned int flags) { + VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; bool inactive =3D flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE; + virBufferSetChildIndent(&childBuf, buf); + if (!backingStore) return 0; @@ -23945,25 +23949,23 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, return -1; } - virBufferAsprintf(buf, "type)); if (backingStore->id !=3D 0) - virBufferAsprintf(buf, " index=3D'%u'", backingStore->id); - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); + virBufferAsprintf(&attrBuf, " index=3D'%u'", backingStore->id); - virBufferAsprintf(buf, "\n", + virBufferAsprintf(&childBuf, "\n", virStorageFileFormatTypeToString(backingStore->forma= t)); /* We currently don't output seclabels for backing chain element */ - if (virDomainDiskSourceFormat(buf, backingStore, 0, flags, false, - false, xmlopt) < 0 || - virDomainDiskBackingStoreFormat(buf, backingStore->backingStore, + if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, + false, xmlopt) < 0) + return -1; + + if (virDomainDiskBackingStoreFormat(&childBuf, backingStore->backingSt= ore, xmlopt, flags) < 0) return -1; - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); - return 0; + return virXMLFormatElement(buf, "backingStore", &attrBuf, &childBuf); } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924561829639.2194142211783; Mon, 18 Mar 2019 08:56:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12A5C3091755; Mon, 18 Mar 2019 15:56:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1D456063B; Mon, 18 Mar 2019 15:55:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7948C3F5CD; Mon, 18 Mar 2019 15:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtZnU022650 for ; Mon, 18 Mar 2019 11:55:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id F2B561001E6A; Mon, 18 Mar 2019 15:55:34 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A6EE1001E61 for ; Mon, 18 Mar 2019 15:55:34 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:54:59 +0100 Message-Id: <97389eaae77af6e891a98d07895ece4e57b56472.1552924269.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/34] conf: Move virDomainDiskBackingStoreFormat up to avoid forward declarations 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 18 Mar 2019 15:56:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Upcoming commits will reorganize control flow leading to calling the function to virDomainDiskSourceFormat thus it needs to be moved slightly up. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 102 ++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2b6a2b7ee8..9d738f06cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23857,6 +23857,57 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, } +static int +virDomainDiskBackingStoreFormat(virBufferPtr buf, + virStorageSourcePtr backingStore, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; + bool inactive =3D flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE; + + virBufferSetChildIndent(&childBuf, buf); + + if (!backingStore) + return 0; + + /* don't write detected backing chain members to inactive xml */ + if (inactive && backingStore->detected) + return 0; + + if (backingStore->type =3D=3D VIR_STORAGE_TYPE_NONE) { + virBufferAddLit(buf, "\n"); + return 0; + } + + if (backingStore->format <=3D 0 || backingStore->format >=3D VIR_STORA= GE_FILE_LAST) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk backing store format %d"), + backingStore->format); + return -1; + } + + virBufferAsprintf(&attrBuf, " type=3D'%s'", + virStorageTypeToString(backingStore->type)); + if (backingStore->id !=3D 0) + virBufferAsprintf(&attrBuf, " index=3D'%u'", backingStore->id); + + virBufferAsprintf(&childBuf, "\n", + virStorageFileFormatTypeToString(backingStore->forma= t)); + /* We currently don't output seclabels for backing chain element */ + if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, + false, xmlopt) < 0) + return -1; + + if (virDomainDiskBackingStoreFormat(&childBuf, backingStore->backingSt= ore, + xmlopt, flags) < 0) + return -1; + + return virXMLFormatElement(buf, "backingStore", &attrBuf, &childBuf); +} + + /** * virDomainStorageSourceFormatFull: * @buf: output buffer @@ -23918,57 +23969,6 @@ virDomainDiskSourceFormat(virBufferPtr buf, } -static int -virDomainDiskBackingStoreFormat(virBufferPtr buf, - virStorageSourcePtr backingStore, - virDomainXMLOptionPtr xmlopt, - unsigned int flags) -{ - VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; - VIR_AUTOCLEAN(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; - bool inactive =3D flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE; - - virBufferSetChildIndent(&childBuf, buf); - - if (!backingStore) - return 0; - - /* don't write detected backing chain members to inactive xml */ - if (inactive && backingStore->detected) - return 0; - - if (backingStore->type =3D=3D VIR_STORAGE_TYPE_NONE) { - virBufferAddLit(buf, "\n"); - return 0; - } - - if (backingStore->format <=3D 0 || backingStore->format >=3D VIR_STORA= GE_FILE_LAST) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk backing store format %d"), - backingStore->format); - return -1; - } - - virBufferAsprintf(&attrBuf, " type=3D'%s'", - virStorageTypeToString(backingStore->type)); - if (backingStore->id !=3D 0) - virBufferAsprintf(&attrBuf, " index=3D'%u'", backingStore->id); - - virBufferAsprintf(&childBuf, "\n", - virStorageFileFormatTypeToString(backingStore->forma= t)); - /* We currently don't output seclabels for backing chain element */ - if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, - false, xmlopt) < 0) - return -1; - - if (virDomainDiskBackingStoreFormat(&childBuf, backingStore->backingSt= ore, - xmlopt, flags) < 0) - return -1; - - return virXMLFormatElement(buf, "backingStore", &attrBuf, &childBuf); -} - - #define FORMAT_IOTUNE(val) \ if (disk->blkdeviotune.val) { \ virBufferAsprintf(&childBuf, "<" #val ">%llu\n", \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924558320367.88447346573867; Mon, 18 Mar 2019 08:55:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E0553086218; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55CC826FA6; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 143D03FA4D; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtZde022660 for ; Mon, 18 Mar 2019 11:55:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id C41FC1001E7E; Mon, 18 Mar 2019 15:55:35 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C8671001E61 for ; Mon, 18 Mar 2019 15:55:35 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/34] conf: Move backingStore formating into virDomainDiskSourceFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 18 Mar 2019 15:55:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move the recursion to format the full backing store into virDomainDiskSourceFormat controlled by a new argument so that it's simpler to reuse in other places. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 30 +++++++++++++++--------------- src/conf/domain_conf.h | 1 + src/conf/snapshot_conf.c | 2 +- tests/qemublocktest.c | 2 +- tests/virstoragetest.c | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9d738f06cd..b67f9bbd2c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23897,11 +23897,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virStorageFileFormatTypeToString(backingStore->forma= t)); /* We currently don't output seclabels for backing chain element */ if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, - false, xmlopt) < 0) - return -1; - - if (virDomainDiskBackingStoreFormat(&childBuf, backingStore->backingSt= ore, - xmlopt, flags) < 0) + false, true, xmlopt) < 0) return -1; return virXMLFormatElement(buf, "backingStore", &attrBuf, &childBuf); @@ -23954,6 +23950,7 @@ virDomainDiskSourceFormat(virBufferPtr buf, unsigned int flags, bool seclabels, bool attrIndex, + bool backingStore, virDomainXMLOptionPtr xmlopt) { VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; @@ -23962,10 +23959,18 @@ virDomainDiskSourceFormat(virBufferPtr buf, virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - seclabels, attrIndex, policy, xmlopt)= < 0) + seclabels, attrIndex, + policy, xmlopt) < 0) return -1; - return virXMLFormatElement(buf, "source", &attrBuf, &childBuf); + if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0) + return -1; + + if (backingStore && src->backingStore && + virDomainDiskBackingStoreFormat(buf, src->backingStore, xmlopt, fl= ags) < 0) + return -1; + + return 0; } @@ -24119,7 +24124,8 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "\n", formatStr); - if (virDomainDiskSourceFormat(buf, disk->mirror, 0, 0, true, false, xm= lopt) < 0) + if (virDomainDiskSourceFormat(buf, disk->mirror, 0, 0, true, false, fa= lse, + xmlopt) < 0) return -1; virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -24216,13 +24222,7 @@ virDomainDiskDefFormat(virBufferPtr buf, virStorageAuthDefFormat(buf, def->src->auth); if (virDomainDiskSourceFormat(buf, def->src, def->startupPolicy, - flags, true, true, xmlopt) < 0) - return -1; - - /* Don't format backingStore to inactive XMLs until the code for - * persistent storage of backing chains is ready. */ - if (virDomainDiskBackingStoreFormat(buf, def->src->backingStore, - xmlopt, flags) < 0) + flags, true, true, true, xmlopt) < 0) return -1; virBufferEscapeString(buf, "\n", def->doma= in_name); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7ea9822fe4..b373dbf939 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3018,6 +3018,7 @@ int virDomainDiskSourceFormat(virBufferPtr buf, unsigned int flags, bool seclabels, bool attrIndex, + bool backingStore, virDomainXMLOptionPtr xmlopt); int virDomainNetDefFormat(virBufferPtr buf, diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index a849a58da3..bc4b9c8f11 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -768,7 +768,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, if (disk->src->format > 0) virBufferEscapeString(buf, "\n", virStorageFileFormatTypeToString(disk->src->= format)); - if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, true, false, xmlop= t) < 0) + if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, true, false, false= , xmlopt) < 0) return -1; virBufferAdjustIndent(buf, -2); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 6b5571b7cb..f40cba36cd 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -87,7 +87,7 @@ testBackingXMLjsonXML(const void *args) goto cleanup; } - if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, true, false, NULL) = < 0 || + if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, true, false, false,= NULL) < 0 || !(actualxml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); goto cleanup; diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 75c60da537..9a11f5bfe8 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -657,7 +657,7 @@ testBackingParse(const void *args) goto cleanup; } - if (virDomainDiskSourceFormat(&buf, src, 0, 0, true, false, NULL) < 0 = || + if (virDomainDiskSourceFormat(&buf, src, 0, 0, true, false, false, NUL= L) < 0 || !(xml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15529245624641003.0619825917661; Mon, 18 Mar 2019 08:56:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1220381DE3; Mon, 18 Mar 2019 15:56:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD26D619F9; Mon, 18 Mar 2019 15:55:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8BF163F5A0; Mon, 18 Mar 2019 15:55:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtaCF022670 for ; Mon, 18 Mar 2019 11:55:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 98AFD1001DC8; Mon, 18 Mar 2019 15:55:36 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FC061001E6A for ; Mon, 18 Mar 2019 15:55:35 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:01 +0100 Message-Id: <1a99c5f9e5152179c92266da673823cd91703680.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/34] conf: Add possibility to format full chain with virDomainStorageSourceFormatFull 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Mar 2019 15:56:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add switch which will allow formating full chain. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 11 ++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_domain.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b67f9bbd2c..fb98629c77 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23910,6 +23910,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, * @src: storage source to format * @elemname: name of the top level element to use * @status: output status-XML style private data + * @backingStore: output full backing chain of @src * @xmlopt: formatter callback data structure * * Formats @src into a XML element called @elemname. The element has both = 'type' @@ -23920,6 +23921,7 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, virStorageSourcePtr src, const char *elemname, bool status, + bool backingStore, virDomainXMLOptionPtr xmlopt) { VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; @@ -23939,7 +23941,14 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, true, true, 0, xmlopt) < 0) return -1; - return virXMLFormatElement(buf, elemname, &attrBuf, &childBuf); + if (virXMLFormatElement(buf, elemname, &attrBuf, &childBuf) < 0) + return -1; + + if (backingStore && src->backingStore && + virDomainDiskBackingStoreFormat(buf, src->backingStore, xmlopt, fl= ags) < 0) + return -1; + + return 0; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b373dbf939..0bdd6c0f55 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3465,6 +3465,7 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, virStorageSourcePtr src, const char *elemname, bool status, + bool backingStore, virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 78287b4d3e..ea70979f8b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2364,7 +2364,7 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPt= r buf, if (diskPriv->migrSource && virDomainStorageSourceFormatFull(&childBuf, diskPriv->migrSour= ce, - "migrationSource", true, + "migrationSource", true, fals= e, priv->driver->xmlopt) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924567781558.9158358082651; Mon, 18 Mar 2019 08:56:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E445181DF2; Mon, 18 Mar 2019 15:56:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD5195ED37; Mon, 18 Mar 2019 15:56:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5FD1B3D389; Mon, 18 Mar 2019 15:56:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtbnl022677 for ; Mon, 18 Mar 2019 11:55:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A2A41001DC8; Mon, 18 Mar 2019 15:55:37 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id E61011001E6A for ; Mon, 18 Mar 2019 15:55:36 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:02 +0100 Message-Id: <5a020e840617c99d99e60021413a1e4667e19a59.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 13/34] conf: Simplify error paths in storage source component parsers 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Mar 2019 15:56:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virDomainDiskSourcePrivateDataParse and virDomainDiskSourcePRParse don't need the 'cleanup' label any more thanks to VIR_XPATH_NODE_AUTORESTORE. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fb98629c77..0c650ffc2c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9028,7 +9028,6 @@ virDomainDiskSourcePrivateDataParse(xmlNodePtr node, virDomainXMLOptionPtr xmlopt) { VIR_XPATH_NODE_AUTORESTORE(ctxt); - int ret =3D -1; if (!(flags & VIR_DOMAIN_DEF_PARSE_STATUS) || !xmlopt || !xmlopt->privateData.storageParse) @@ -9036,18 +9035,13 @@ virDomainDiskSourcePrivateDataParse(xmlNodePtr node, ctxt->node =3D node; - if (!(ctxt->node =3D virXPathNode("./privateData", ctxt))) { - ret =3D 0; - goto cleanup; - } + if (!(ctxt->node =3D virXPathNode("./privateData", ctxt))) + return 0; if (xmlopt->privateData.storageParse(ctxt, src) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - return ret; + return 0; } @@ -9057,21 +9051,16 @@ virDomainDiskSourcePRParse(xmlNodePtr node, virStoragePRDefPtr *pr) { VIR_XPATH_NODE_AUTORESTORE(ctxt); - int ret =3D -1; ctxt->node =3D node; - if (!(ctxt->node =3D virXPathNode("./reservations", ctxt))) { - ret =3D 0; - goto cleanup; - } + if (!(ctxt->node =3D virXPathNode("./reservations", ctxt))) + return 0; if (!(*pr =3D virStoragePRDefParseXML(ctxt))) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - return ret; + return 0; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924563477935.0027420625172; Mon, 18 Mar 2019 08:56:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD9418F872; Mon, 18 Mar 2019 15:56:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79807605C9; Mon, 18 Mar 2019 15:56:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3123E181A26B; Mon, 18 Mar 2019 15:56:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtcYE022685 for ; Mon, 18 Mar 2019 11:55:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B15E1001DC8; Mon, 18 Mar 2019 15:55:38 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B78881001E6A for ; Mon, 18 Mar 2019 15:55:37 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:03 +0100 Message-Id: <0f493eab21f19802027de319e48ea7b4d89b1d74.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 14/34] cleanup error path in virDomainStorageSourceParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 18 Mar 2019 15:56:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0c650ffc2c..ef164f3375 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9070,7 +9070,6 @@ virDomainStorageSourceParse(xmlNodePtr node, virStorageSourcePtr src, unsigned int flags) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt); xmlNodePtr tmp; @@ -9088,34 +9087,34 @@ virDomainStorageSourceParse(xmlNodePtr node, break; case VIR_STORAGE_TYPE_NETWORK: if (virDomainDiskSourceNetworkParse(node, ctxt, src, flags) < 0) - goto cleanup; + return -1; break; case VIR_STORAGE_TYPE_VOLUME: if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0) - goto cleanup; + return -1; break; case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected disk type %s"), virStorageTypeToString(src->type)); - goto cleanup; + return -1; } if ((tmp =3D virXPathNode("./auth", ctxt)) && !(src->auth =3D virStorageAuthDefParse(tmp, ctxt))) - goto cleanup; + return -1; if ((tmp =3D virXPathNode("./encryption", ctxt)) && !(src->encryption =3D virStorageEncryptionParseNode(tmp, ctxt))) - goto cleanup; + return -1; if (virDomainDiskSourcePRParse(node, ctxt, &src->pr) < 0) - goto cleanup; + return -1; if (virSecurityDeviceLabelDefParseXML(&src->seclabels, &src->nseclabel= s, ctxt, flags) < 0) - goto cleanup; + return -1; /* People sometimes pass a bogus '' source path when they mean to omit= the * source element completely (e.g. CDROM without media). This is just a @@ -9123,10 +9122,7 @@ virDomainStorageSourceParse(xmlNodePtr node, if (src->path && !*src->path) VIR_FREE(src->path); - ret =3D 0; - - cleanup: - return ret; + return 0; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924567428861.6449087421715; Mon, 18 Mar 2019 08:56:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8B00308FED2; Mon, 18 Mar 2019 15:56:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 912EE5C646; Mon, 18 Mar 2019 15:56:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C98B181A26D; Mon, 18 Mar 2019 15:56:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtdh5022695 for ; Mon, 18 Mar 2019 11:55:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C5681001E6A; Mon, 18 Mar 2019 15:55:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 888DC1001E61 for ; Mon, 18 Mar 2019 15:55:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 15/34] util: xml: Introduce VIR_AUTOPTR functions for xmlDoc and xmlXPathContext 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Mar 2019 15:56:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We can use our VIR_AUTOPTR machinery also for libxml2's xmlDoc and xmlXPathContext. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virxml.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virxml.h b/src/util/virxml.h index b91fedde82..4875e88f2e 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -244,4 +244,7 @@ VIR_DEFINE_AUTOCLEAN_FUNC(virXPathContextNodeSave, virX= PathContextNodeRestore); .node =3D= _ctxt->node}; \ ignore_value(&_ctxt ## CtxtSave) +VIR_DEFINE_AUTOPTR_FUNC(xmlDoc, xmlFreeDoc); +VIR_DEFINE_AUTOPTR_FUNC(xmlXPathContext, xmlXPathFreeContext); + #endif /* LIBVIRT_VIRXML_H */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924567761160.2102825262607; Mon, 18 Mar 2019 08:56:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AECC0308FEC2; Mon, 18 Mar 2019 15:56:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78378605C9; Mon, 18 Mar 2019 15:56:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 296B53D38B; Mon, 18 Mar 2019 15:56:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtdvX022705 for ; Mon, 18 Mar 2019 11:55:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0CF51001E6A; Mon, 18 Mar 2019 15:55:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 596BE1001E61 for ; Mon, 18 Mar 2019 15:55:39 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/34] tests: Use full force of our VIR_AUTO* machinery in testBackingXMLjsonXML 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Mar 2019 15:56:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemublocktest.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index f40cba36cd..b1d1ed943c 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -43,14 +43,14 @@ static int testBackingXMLjsonXML(const void *args) { const struct testBackingXMLjsonXMLdata *data =3D args; - xmlDocPtr xml =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - virBuffer buf =3D VIR_BUFFER_INITIALIZER; - virJSONValuePtr backendprops =3D NULL; - virJSONValuePtr wrapper =3D NULL; - char *propsstr =3D NULL; - char *protocolwrapper =3D NULL; - char *actualxml =3D NULL; + VIR_AUTOPTR(xmlDoc) xml =3D NULL; + VIR_AUTOPTR(xmlXPathContext) ctxt =3D NULL; + VIR_AUTOCLEAN(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOPTR(virJSONValue) backendprops =3D NULL; + VIR_AUTOPTR(virJSONValue) wrapper =3D NULL; + VIR_AUTOFREE(char *) propsstr =3D NULL; + VIR_AUTOFREE(char *) protocolwrapper =3D NULL; + VIR_AUTOFREE(char *) actualxml =3D NULL; int ret =3D -1; VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc =3D NULL; VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc =3D NULL; @@ -104,15 +104,6 @@ testBackingXMLjsonXML(const void *args) ret =3D 0; cleanup: - VIR_FREE(propsstr); - VIR_FREE(protocolwrapper); - VIR_FREE(actualxml); - virJSONValueFree(backendprops); - virJSONValueFree(wrapper); - virBufferFreeAndReset(&buf); - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924571437356.6600258238433; Mon, 18 Mar 2019 08:56:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DF2180B2C; Mon, 18 Mar 2019 15:56:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E6C660634; Mon, 18 Mar 2019 15:56:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E6CCE3D38F; Mon, 18 Mar 2019 15:56:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFteUR022712 for ; Mon, 18 Mar 2019 11:55:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id A288C1001DC8; Mon, 18 Mar 2019 15:55:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B86C1001E61 for ; Mon, 18 Mar 2019 15:55:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/34] tests: Refactor control flow in testBackingXMLjsonXML 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 18 Mar 2019 15:56:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Get rid of the 'cleanup' label. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemublocktest.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index b1d1ed943c..96c70e381a 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -51,7 +51,6 @@ testBackingXMLjsonXML(const void *args) VIR_AUTOFREE(char *) propsstr =3D NULL; VIR_AUTOFREE(char *) protocolwrapper =3D NULL; VIR_AUTOFREE(char *) actualxml =3D NULL; - int ret =3D -1; VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc =3D NULL; VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc =3D NULL; @@ -61,36 +60,36 @@ testBackingXMLjsonXML(const void *args) xmlsrc->type =3D data->type; if (!(xml =3D virXMLParseStringCtxt(data->xml, "(test storage source X= ML)", &ctxt))) - goto cleanup; + return -1; if (virDomainDiskSourceParse(ctxt->node, ctxt, xmlsrc, 0, NULL) < 0) { fprintf(stderr, "failed to parse disk source xml\n"); - goto cleanup; + return -1; } if (!(backendprops =3D qemuBlockStorageSourceGetBackendProps(xmlsrc, t= rue))) { fprintf(stderr, "failed to format disk source json\n"); - goto cleanup; + return -1; } if (virJSONValueObjectCreate(&wrapper, "a:file", &backendprops, NULL) = < 0) - goto cleanup; + return -1; if (!(propsstr =3D virJSONValueToString(wrapper, false))) - goto cleanup; + return -1; if (virAsprintf(&protocolwrapper, "json:%s", propsstr) < 0) - goto cleanup; + return -1; if (!(jsonsrc =3D virStorageSourceNewFromBackingAbsolute(protocolwrapp= er))) { fprintf(stderr, "failed to parse disk json\n"); - goto cleanup; + return -1; } if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, true, false, false,= NULL) < 0 || !(actualxml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); - goto cleanup; + return -1; } if (STRNEQ(actualxml, data->xml)) { @@ -98,13 +97,10 @@ testBackingXMLjsonXML(const void *args) "actual storage source xml:\n%s\n" "intermediate json:\n%s\n", data->xml, actualxml, protocolwrapper); - goto cleanup; + return -1; } - ret =3D 0; - - cleanup: - return ret; + return 0; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924569809261.93098041308065; Mon, 18 Mar 2019 08:56:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27F948F874; Mon, 18 Mar 2019 15:56:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0508D17CFE; Mon, 18 Mar 2019 15:56:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 84B6B181A272; Mon, 18 Mar 2019 15:56:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtfxN022727 for ; Mon, 18 Mar 2019 11:55:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73E931001E81; Mon, 18 Mar 2019 15:55:41 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0BF71001DC8 for ; Mon, 18 Mar 2019 15:55:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:07 +0100 Message-Id: <43a6d4c082eb019463080981d1cd780ded2cea5f.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 18/34] conf: Refactor control flow in virDomainDiskBackingStoreParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 18 Mar 2019 15:56:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The function does not have any code in the 'cleanup' label so we can simplify the control flow. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ef164f3375..d74ac2f1fb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9151,19 +9151,16 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr c= txt, { VIR_XPATH_NODE_AUTORESTORE(ctxt); xmlNodePtr source; - int ret =3D -1; VIR_AUTOUNREF(virStorageSourcePtr) backingStore =3D NULL; VIR_AUTOFREE(char *) type =3D NULL; VIR_AUTOFREE(char *) format =3D NULL; VIR_AUTOFREE(char *) idx =3D NULL; - if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) { - ret =3D 0; - goto cleanup; - } + if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) + return 0; if (!(backingStore =3D virStorageSourceNew())) - goto cleanup; + return -1; /* backing store is always read-only */ backingStore->readonly =3D true; @@ -9171,52 +9168,49 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr c= txt, /* terminator does not have a type */ if (!(type =3D virXMLPropString(ctxt->node, "type"))) { VIR_STEAL_PTR(src->backingStore, backingStore); - ret =3D 0; - goto cleanup; + return 0; } if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && (idx =3D virXMLPropString(ctxt->node, "index")) && virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid disk index '%s'"), id= x); - goto cleanup; + return -1; } backingStore->type =3D virStorageTypeFromString(type); if (backingStore->type <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk backing store type '%s'"), type); - goto cleanup; + return -1; } if (!(format =3D virXPathString("string(./format/@type)", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing disk backing store format")); - goto cleanup; + return -1; } backingStore->format =3D virStorageFileFormatTypeFromString(format); if (backingStore->format <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk backing store format '%s'"), format= ); - goto cleanup; + return -1; } if (!(source =3D virXPathNode("./source", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing disk backing store source")); - goto cleanup; + return -1; } if (virDomainDiskSourceParse(source, ctxt, backingStore, flags, xmlopt= ) < 0 || virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) = < 0) - goto cleanup; + return -1; VIR_STEAL_PTR(src->backingStore, backingStore); - ret =3D 0; - cleanup: - return ret; + return 0; } #define PARSE_IOTUNE(val) \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924574984220.21038475906084; Mon, 18 Mar 2019 08:56:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E0FA30832CF; Mon, 18 Mar 2019 15:56:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2567C5D705; Mon, 18 Mar 2019 15:56:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D2298181A279; Mon, 18 Mar 2019 15:56:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtgvB022737 for ; Mon, 18 Mar 2019 11:55:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 43E4F1001DC8; Mon, 18 Mar 2019 15:55:42 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0DBF1001E82 for ; Mon, 18 Mar 2019 15:55:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:08 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 19/34] conf: Fold private data parsing into virDomainStorageSourceParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 18 Mar 2019 15:56:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Storage source private data can be parsed along with other components of private data rather than a separate function which is called from multiple places. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 42 ++++++++++++------------------------------ src/conf/domain_conf.h | 3 ++- src/qemu/qemu_domain.c | 2 +- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d74ac2f1fb..bf3ad45397 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9020,31 +9020,6 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, } -static int -virDomainDiskSourcePrivateDataParse(xmlNodePtr node, - xmlXPathContextPtr ctxt, - virStorageSourcePtr src, - unsigned int flags, - virDomainXMLOptionPtr xmlopt) -{ - VIR_XPATH_NODE_AUTORESTORE(ctxt); - - if (!(flags & VIR_DOMAIN_DEF_PARSE_STATUS) || - !xmlopt || !xmlopt->privateData.storageParse) - return 0; - - ctxt->node =3D node; - - if (!(ctxt->node =3D virXPathNode("./privateData", ctxt))) - return 0; - - if (xmlopt->privateData.storageParse(ctxt, src) < 0) - return -1; - - return 0; -} - - static int virDomainDiskSourcePRParse(xmlNodePtr node, xmlXPathContextPtr ctxt, @@ -9068,7 +9043,8 @@ int virDomainStorageSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virStorageSourcePtr src, - unsigned int flags) + unsigned int flags, + virDomainXMLOptionPtr xmlopt) { VIR_XPATH_NODE_AUTORESTORE(ctxt); xmlNodePtr tmp; @@ -9122,6 +9098,15 @@ virDomainStorageSourceParse(xmlNodePtr node, if (src->path && !*src->path) VIR_FREE(src->path); + if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && + xmlopt && xmlopt->privateData.storageParse && + (tmp =3D virXPathNode("./privateData", ctxt))) { + ctxt->node =3D tmp; + + if (xmlopt->privateData.storageParse(ctxt, src) < 0) + return -1; + } + return 0; } @@ -9133,10 +9118,7 @@ virDomainDiskSourceParse(xmlNodePtr node, unsigned int flags, virDomainXMLOptionPtr xmlopt) { - if (virDomainStorageSourceParse(node, ctxt, src, flags) < 0) - return -1; - - if (virDomainDiskSourcePrivateDataParse(node, ctxt, src, flags, xmlopt= ) < 0) + if (virDomainStorageSourceParse(node, ctxt, src, flags, xmlopt) < 0) return -1; return 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0bdd6c0f55..0b6d432871 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3472,7 +3472,8 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, int virDomainStorageSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virStorageSourcePtr src, - unsigned int flags) + unsigned int flags, + virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ea70979f8b..0a0a464dd2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2726,7 +2726,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr n= ode, } if (virDomainStorageSourceParse(ctxt->node, ctxt, migrSource, - VIR_DOMAIN_DEF_PARSE_STATUS) < 0) + VIR_DOMAIN_DEF_PARSE_STATUS, NULL) < 0) goto cleanup; if ((ctxt->node =3D virXPathNode("./privateData", ctxt)) && --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924570993862.3736217546935; Mon, 18 Mar 2019 08:56:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 482D781114; Mon, 18 Mar 2019 15:56:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1988619C7A; Mon, 18 Mar 2019 15:56:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C63463D390; Mon, 18 Mar 2019 15:56:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtjs1022760 for ; Mon, 18 Mar 2019 11:55:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AF5C1001E6A; Mon, 18 Mar 2019 15:55:45 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B82991001E61 for ; Mon, 18 Mar 2019 15:55:42 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:09 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/34] conf: Introduce modular parser for 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 18 Mar 2019 15:56:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduce a helper which parses XML into virStorageSource according to XPath queries passed in for the various bits. The new parser will allow to unify the parsing of the various XML formats we use in different parts without the need to do custom parsers. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 94 ++++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 12 +++++ src/libvirt_private.syms | 1 + 3 files changed, 107 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bf3ad45397..d2cc199ed5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9111,6 +9111,100 @@ virDomainStorageSourceParse(xmlNodePtr node, } +/** + * virDomainStorageSourceParseFull + * @typeXPath: XPath query string for the 'type' of virStorageSource + * @formatXPath: XPath query for the image format (may be NULL if caller w= ishes to parse it) + * @sourceXPath: XPath query for the subelement + * @indexXPath: XPath query for 'id' in virStorageSource (may be NULL if s= kipped) + * @allowMissing: if true no errors are reported if the above fields are m= issing + * @ctxt: XPath context + * @flags: XML parser flags + * @xmlopt: XML parser callbacks + * + * Uses the XPath queries provided as arguments to parse a storage source = XML + * into virStorageSource. If allowMissing is false the function reports er= ror if + * any of the XML parts described by @typeXPath, @formatXPath or @sourceXP= ath + * are missing. @formatXPath and @indexXpath may be NULL if they should be= omitted + * or if the caller parses the value separately. + * + * Returns the parsed source or NULL on error. + */ +virStorageSourcePtr +virDomainStorageSourceParseFull(const char *typeXPath, + const char *formatXPath, + const char *sourceXPath, + const char *indexXPath, + bool allowMissing, + xmlXPathContextPtr ctxt, + unsigned int flags, + virDomainXMLOptionPtr xmlopt) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt); + VIR_AUTOFREE(char *) type =3D NULL; + VIR_AUTOFREE(char *) format =3D NULL; + VIR_AUTOFREE(char *) idx =3D NULL; + xmlNodePtr sourceNode =3D NULL; + VIR_AUTOUNREF(virStorageSourcePtr) src =3D NULL; + virStorageSourcePtr ret =3D NULL; + + if (!(type =3D virXPathString(typeXPath, ctxt)) && + !allowMissing) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("missing storage source = type")); + return NULL; + } + + if (formatXPath && + !(format =3D virXPathString(formatXPath, ctxt)) && + !allowMissing) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("missing storage source = format")); + return NULL; + } + + if (!(sourceNode =3D virXPathNode(sourceXPath, ctxt)) && + !allowMissing) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("missing storage source = data")); + return NULL; + } + + if (!(src =3D virStorageSourceNew())) + return NULL; + + if (type) { + if ((src->type =3D virStorageTypeFromString(type)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown storage source type '%s'"), type); + return NULL; + } + } else { + src->type =3D VIR_STORAGE_TYPE_FILE; + } + + if (format && + (src->format =3D virStorageFileFormatTypeFromString(format)) <=3D = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown storage source format '%s'"), format); + return NULL; + } + + if (indexXPath && + !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && + (idx =3D virXPathString(indexXPath, ctxt)) && + virStrToLong_uip(idx, NULL, 10, &src->id) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("invalid storage source index '%s'"), idx); + return NULL; + } + + if (sourceNode && + virDomainStorageSourceParse(sourceNode, ctxt, src, flags, xmlopt) = < 0) + return NULL; + + VIR_STEAL_PTR(ret, src); + return ret; +} + + int virDomainDiskSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0b6d432871..a87e1b30b9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3476,6 +3476,18 @@ int virDomainStorageSourceParse(xmlNodePtr node, virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +virStorageSourcePtr +virDomainStorageSourceParseFull(const char *typeXPath, + const char *formatXPath, + const char *sourceXPath, + const char *indexXPath, + bool allowMissing, + xmlXPathContextPtr ctxt, + unsigned int flags, + virDomainXMLOptionPtr xmlopt) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) + ATTRIBUTE_NONNULL(6); + int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, int maplen, int ncpumaps, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 010c8ac481..e4a695de9f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -565,6 +565,7 @@ virDomainStateTypeToString; virDomainStorageNetworkParseHost; virDomainStorageSourceFormatFull; virDomainStorageSourceParse; +virDomainStorageSourceParseFull; virDomainTaintTypeFromString; virDomainTaintTypeToString; virDomainTimerModeTypeFromString; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924579166146.28645857368986; Mon, 18 Mar 2019 08:56:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73CC6307CDC7; Mon, 18 Mar 2019 15:56:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09CD95C641; Mon, 18 Mar 2019 15:56:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BD22F181A268; Mon, 18 Mar 2019 15:56:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtkxn022772 for ; Mon, 18 Mar 2019 11:55:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C5AB1001E6A; Mon, 18 Mar 2019 15:55:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 895261001E61 for ; Mon, 18 Mar 2019 15:55:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:10 +0100 Message-Id: <2b8152d9a84152bbbcb9e6021693cdb82025b4bb.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 21/34] qemu: Use virDomainStorageSourceParseFull when parsing NBD migration data X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Mar 2019 15:56:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The new helper allows to avoid hand-rolled code to parse a storage source. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 62 ++++++++---------------------------------- 1 file changed, 12 insertions(+), 50 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0a0a464dd2..e406647d8f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2681,65 +2681,27 @@ qemuDomainObjPrivateXMLParsePR(xmlXPathContextPtr c= txt, static int qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node, + qemuDomainObjPrivatePtr priv, xmlXPathContextPtr ctxt, virDomainDiskDefPtr disk) { VIR_XPATH_NODE_AUTORESTORE(ctxt); qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - char *format =3D NULL; - char *type =3D NULL; - int ret =3D -1; - VIR_AUTOUNREF(virStorageSourcePtr) migrSource =3D NULL; ctxt->node =3D node; - if (!(ctxt->node =3D virXPathNode("./migrationSource", ctxt))) { - ret =3D 0; - goto cleanup; - } - - if (!(migrSource =3D virStorageSourceNew())) - goto cleanup; - - if (!(type =3D virXMLPropString(ctxt->node, "type"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing storage source type")); - goto cleanup; - } - - if (!(format =3D virXMLPropString(ctxt->node, "format"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing storage source format")); - goto cleanup; - } - - if ((migrSource->type =3D virStorageTypeFromString(type)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown storage source type '%s'"), type); - goto cleanup; - } - - if ((migrSource->format =3D virStorageFileFormatTypeFromString(format)= ) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown storage source format '%s'"), format); - goto cleanup; - } - - if (virDomainStorageSourceParse(ctxt->node, ctxt, migrSource, - VIR_DOMAIN_DEF_PARSE_STATUS, NULL) < 0) - goto cleanup; - - if ((ctxt->node =3D virXPathNode("./privateData", ctxt)) && - qemuStorageSourcePrivateDataParse(ctxt, migrSource) < 0) - goto cleanup; + if (!(ctxt->node =3D virXPathNode("./migrationSource", ctxt))) + return 0; - VIR_STEAL_PTR(diskPriv->migrSource, migrSource); - ret =3D 0; + if (!(diskPriv->migrSource =3D virDomainStorageSourceParseFull("string= (@type)", + "string(@= format)", + ".", NULL, + false, ct= xt, + VIR_DOMAI= N_DEF_PARSE_STATUS, + priv->dri= ver->xmlopt))) + return -1; - cleanup: - VIR_FREE(format); - VIR_FREE(type); - return ret; + return 0; } @@ -2770,7 +2732,7 @@ qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr vm, (disk =3D virDomainDiskByName(vm->def, dst, false))) { QEMU_DOMAIN_DISK_PRIVATE(disk)->migrating =3D true; - if (qemuDomainObjPrivateXMLParseJobNBDSource(nodes[i], ctx= t, + if (qemuDomainObjPrivateXMLParseJobNBDSource(nodes[i], pri= v, ctxt, disk) < 0) goto cleanup; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924573759561.9950939759906; Mon, 18 Mar 2019 08:56:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03D7D3082B59; Mon, 18 Mar 2019 15:56:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D26D517CFF; Mon, 18 Mar 2019 15:56:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8F53C181A275; Mon, 18 Mar 2019 15:56:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtk0s022785 for ; Mon, 18 Mar 2019 11:55:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2FD31001E6A; Mon, 18 Mar 2019 15:55:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B9261001E61 for ; Mon, 18 Mar 2019 15:55:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:11 +0100 Message-Id: <9b6b32446f7cc143de7cf9b7e5fb7c2fd1c61d5a.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 22/34] conf: Unexport virDomainStorageSourceParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 18 Mar 2019 15:56:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that all external callers were changed we can stop exporting this func. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 7 ------- src/libvirt_private.syms | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d2cc199ed5..e7f3bcf114 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9039,7 +9039,7 @@ virDomainDiskSourcePRParse(xmlNodePtr node, } -int +static int virDomainStorageSourceParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virStorageSourcePtr src, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a87e1b30b9..ad288d702b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3469,13 +3469,6 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); -int virDomainStorageSourceParse(xmlNodePtr node, - xmlXPathContextPtr ctxt, - virStorageSourcePtr src, - unsigned int flags, - virDomainXMLOptionPtr xmlopt) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); - virStorageSourcePtr virDomainStorageSourceParseFull(const char *typeXPath, const char *formatXPath, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index e4a695de9f..4bdea3b58f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -564,7 +564,6 @@ virDomainStateTypeFromString; virDomainStateTypeToString; virDomainStorageNetworkParseHost; virDomainStorageSourceFormatFull; -virDomainStorageSourceParse; virDomainStorageSourceParseFull; virDomainTaintTypeFromString; virDomainTaintTypeToString; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924574829834.9880944185588; Mon, 18 Mar 2019 08:56:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 266C4308425B; Mon, 18 Mar 2019 15:56:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0C7660C4C; Mon, 18 Mar 2019 15:56:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A9FAC181A278; Mon, 18 Mar 2019 15:56:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtljG022795 for ; Mon, 18 Mar 2019 11:55:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id A66151001E6A; Mon, 18 Mar 2019 15:55:47 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D46B1001E61 for ; Mon, 18 Mar 2019 15:55:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:12 +0100 Message-Id: <793dcd29907d231dde8477c4be26aa7e52db3c73.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 23/34] tests: qemublock: Use new source formatter and parser in testBackingXMLjsonXML 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 18 Mar 2019 15:56:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This is part of the effort to minimize use of virDomainDiskSourceParse. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemublocktest.c | 130 ++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 69 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 96c70e381a..48cec2869b 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -34,15 +34,10 @@ VIR_LOG_INIT("tests.storagetest"); -struct testBackingXMLjsonXMLdata { - int type; - const char *xml; -}; - static int testBackingXMLjsonXML(const void *args) { - const struct testBackingXMLjsonXMLdata *data =3D args; + const char *xmlstr =3D args; VIR_AUTOPTR(xmlDoc) xml =3D NULL; VIR_AUTOPTR(xmlXPathContext) ctxt =3D NULL; VIR_AUTOCLEAN(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; @@ -57,12 +52,13 @@ testBackingXMLjsonXML(const void *args) if (!(xmlsrc =3D virStorageSourceNew())) return -1; - xmlsrc->type =3D data->type; - - if (!(xml =3D virXMLParseStringCtxt(data->xml, "(test storage source X= ML)", &ctxt))) + if (!(xml =3D virXMLParseStringCtxt(xmlstr, "(test storage source XML)= ", &ctxt))) return -1; - if (virDomainDiskSourceParse(ctxt->node, ctxt, xmlsrc, 0, NULL) < 0) { + if (!(xmlsrc =3D virDomainStorageSourceParseFull("string(./@type)", + "string(./@format)", + ".", NULL, false, + ctxt, 0, NULL))) { fprintf(stderr, "failed to parse disk source xml\n"); return -1; } @@ -86,17 +82,19 @@ testBackingXMLjsonXML(const void *args) return -1; } - if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, true, false, false,= NULL) < 0 || + jsonsrc->format =3D VIR_STORAGE_FILE_RAW; + + if (virDomainStorageSourceFormatFull(&buf, jsonsrc, "source", false, f= alse, NULL) < 0 || !(actualxml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); return -1; } - if (STRNEQ(actualxml, data->xml)) { + if (STRNEQ(actualxml, xmlstr)) { fprintf(stderr, "\n expected storage source xml:\n'%s'\n" "actual storage source xml:\n%s\n" "intermediate json:\n%s\n", - data->xml, actualxml, protocolwrapper); + xmlstr, actualxml, protocolwrapper); return -1; } @@ -317,7 +315,6 @@ mymain(void) { int ret =3D 0; virQEMUDriver driver; - struct testBackingXMLjsonXMLdata xmljsonxmldata; struct testQemuDiskXMLToJSONData diskxmljsondata; char *capslatest_x86_64 =3D NULL; virQEMUCapsPtr caps_x86_64 =3D NULL; @@ -341,70 +338,65 @@ mymain(void) virTestCounterReset("qemu storage source xml->json->xml "); -# define TEST_JSON_FORMAT(tpe, xmlstr) \ +# define TEST_JSON_FORMAT(xmlstr) \ do { \ - xmljsonxmldata.type =3D tpe; \ - xmljsonxmldata.xml =3D xmlstr; \ if (virTestRun(virTestCounterNext(), testBackingXMLjsonXML, \ - &xmljsonxmldata) < 0) \ + xmlstr) < 0) \ ret =3D -1; \ } while (0) -# define TEST_JSON_FORMAT_NET(xmlstr) \ - TEST_JSON_FORMAT(VIR_STORAGE_TYPE_NETWORK, xmlstr) - - TEST_JSON_FORMAT(VIR_STORAGE_TYPE_FILE, "\n"); + TEST_JSON_FORMAT("\n"); /* type VIR_STORAGE_TYPE_BLOCK is not tested since it parses back to '= file' */ /* type VIR_STORAGE_TYPE_DIR it is a 'format' driver in qemu */ - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\= n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - " \n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\= n" - " \n" - " \n" - " \n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); - TEST_JSON_FORMAT_NET("\n" - " \n" - "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + " = \n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + " \n" + " \n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); + TEST_JSON_FORMAT("\n" + " \n" + "\n"); # define TEST_DISK_TO_JSON_FULL(nme, fl) \ do { \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924577441131.27793757816812; Mon, 18 Mar 2019 08:56:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C78F33082B66; Mon, 18 Mar 2019 15:56:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99F4560C8A; Mon, 18 Mar 2019 15:56:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4C64F3D399; Mon, 18 Mar 2019 15:56:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtmUc022805 for ; Mon, 18 Mar 2019 11:55:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 75D8C1001E7B; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2F6A1001E61 for ; Mon, 18 Mar 2019 15:55:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:13 +0100 Message-Id: <65ae1fae24764e0d522292d3f31414b7327d352a.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 24/34] conf: snapshot: Use virDomainStorageSourceParseFull for snapshots 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 18 Mar 2019 15:56:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use the new parser instead of virDomainDiskSourceParse. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/snapshot_conf.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index bc4b9c8f11..5dad2c3c51 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -108,16 +108,10 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, { int ret =3D -1; char *snapshot =3D NULL; - char *type =3D NULL; - char *driver =3D NULL; - xmlNodePtr cur; xmlNodePtr saved =3D ctxt->node; ctxt->node =3D node; - if (!(def->src =3D virStorageSourceNew())) - goto cleanup; - def->name =3D virXMLPropString(node, "name"); if (!def->name) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -136,27 +130,19 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, } } - if ((type =3D virXMLPropString(node, "type"))) { - if ((def->src->type =3D virStorageTypeFromString(type)) <=3D 0 || - def->src->type =3D=3D VIR_STORAGE_TYPE_VOLUME || - def->src->type =3D=3D VIR_STORAGE_TYPE_DIR) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown disk snapshot type '%s'"), type); - goto cleanup; - } - } else { - def->src->type =3D VIR_STORAGE_TYPE_FILE; - } - - if ((cur =3D virXPathNode("./source", ctxt)) && - virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlopt) < 0) + if (!(def->src =3D virDomainStorageSourceParseFull("string(@type)", + "string(./driver/@typ= e)", + "./source", + NULL, true, + ctxt, flags, xmlopt))) goto cleanup; - if ((driver =3D virXPathString("string(./driver/@type)", ctxt)) && - (def->src->format =3D virStorageFileFormatTypeFromString(driver)) = <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk snapshot driver '%s'"), driver); - goto cleanup; + if (def->src->type =3D=3D VIR_STORAGE_TYPE_VOLUME || + def->src->type =3D=3D VIR_STORAGE_TYPE_DIR) { + virReportError(VIR_ERR_XML_ERROR, + _("unsupported disk snapshot type '%s'"), + virStorageTypeToString(def->src->type)); + goto cleanup; } /* validate that the passed path is absolute */ @@ -174,9 +160,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, cleanup: ctxt->node =3D saved; - VIR_FREE(driver); VIR_FREE(snapshot); - VIR_FREE(type); if (ret < 0) virDomainSnapshotDiskDefClear(def); return ret; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924580938783.4632775649187; Mon, 18 Mar 2019 08:56:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C06D3092644; Mon, 18 Mar 2019 15:56:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D86057983; Mon, 18 Mar 2019 15:56:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C8624181A27D; Mon, 18 Mar 2019 15:56:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtnaj022815 for ; Mon, 18 Mar 2019 11:55:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 484391001E7E; Mon, 18 Mar 2019 15:55:49 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id C403B1001E61 for ; Mon, 18 Mar 2019 15:55:48 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:14 +0100 Message-Id: <464d7094960a111ab9c53d112900fad548d3845b.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 25/34] conf: Replace virDomainDiskSourceParse by virDomainStorageSourceParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 18 Mar 2019 15:56:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virDomainDiskSourceParse was now just a thin wrapper without any extra value. Replace all usage of it by the function it calls and remove the function. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 22 ++++------------------ src/conf/domain_conf.h | 5 ----- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e7f3bcf114..3de72fd807 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9205,20 +9205,6 @@ virDomainStorageSourceParseFull(const char *typeXPat= h, } -int -virDomainDiskSourceParse(xmlNodePtr node, - xmlXPathContextPtr ctxt, - virStorageSourcePtr src, - unsigned int flags, - virDomainXMLOptionPtr xmlopt) -{ - if (virDomainStorageSourceParse(node, ctxt, src, flags, xmlopt) < 0) - return -1; - - return 0; -} - - static int virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src, @@ -9280,7 +9266,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctx= t, return -1; } - if (virDomainDiskSourceParse(source, ctxt, backingStore, flags, xmlopt= ) < 0 || + if (virDomainStorageSourceParse(source, ctxt, backingStore, flags, xml= opt) < 0 || virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) = < 0) return -1; @@ -9414,8 +9400,8 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, return -1; } - if (virDomainDiskSourceParse(mirrorNode, ctxt, def->mirror, - flags, xmlopt) < 0) + if (virDomainStorageSourceParse(mirrorNode, ctxt, def->mirror, + flags, xmlopt) < 0) return -1; } else { /* For back-compat reasons, we handle a file name @@ -9865,7 +9851,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, continue; if (!source && virXMLNodeNameEqual(cur, "source")) { - if (virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlop= t) < 0) + if (virDomainStorageSourceParse(cur, ctxt, def->src, flags, xm= lopt) < 0) goto error; /* If we've already found an as a child of and diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ad288d702b..72272965ae 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3070,11 +3070,6 @@ virDomainDiskDefPtr virDomainDiskRemove(virDomainDefPtr def, size_t i); virDomainDiskDefPtr virDomainDiskRemoveByName(virDomainDefPtr def, const char *name); -int virDomainDiskSourceParse(xmlNodePtr node, - xmlXPathContextPtr ctxt, - virStorageSourcePtr src, - unsigned int flags, - virDomainXMLOptionPtr xmlopt); int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net); virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *devic= e); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924582706531.2168020153752; Mon, 18 Mar 2019 08:56:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0AAC6308792D; Mon, 18 Mar 2019 15:56:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9AA45C646; Mon, 18 Mar 2019 15:56:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 85F6F181A282; Mon, 18 Mar 2019 15:56:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFto0M022822 for ; Mon, 18 Mar 2019 11:55:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1B45E1001E84; Mon, 18 Mar 2019 15:55:50 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 957881001E61 for ; Mon, 18 Mar 2019 15:55:49 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:15 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 26/34] conf: Use virDomainStorageSourceParseFull in virDomainDiskBackingStoreParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 18 Mar 2019 15:56:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Replace most of the function by using the existing parsing helper. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 53 +++++++++--------------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3de72fd807..d77d3befd3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9212,62 +9212,31 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr c= txt, virDomainXMLOptionPtr xmlopt) { VIR_XPATH_NODE_AUTORESTORE(ctxt); - xmlNodePtr source; VIR_AUTOUNREF(virStorageSourcePtr) backingStore =3D NULL; VIR_AUTOFREE(char *) type =3D NULL; - VIR_AUTOFREE(char *) format =3D NULL; - VIR_AUTOFREE(char *) idx =3D NULL; if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) return 0; - if (!(backingStore =3D virStorageSourceNew())) - return -1; - - /* backing store is always read-only */ - backingStore->readonly =3D true; - /* terminator does not have a type */ if (!(type =3D virXMLPropString(ctxt->node, "type"))) { - VIR_STEAL_PTR(src->backingStore, backingStore); - return 0; - } - - if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && - (idx =3D virXMLPropString(ctxt->node, "index")) && - virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) { - virReportError(VIR_ERR_XML_ERROR, _("invalid disk index '%s'"), id= x); - return -1; - } - - backingStore->type =3D virStorageTypeFromString(type); - if (backingStore->type <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk backing store type '%s'"), type); - return -1; - } + if (!(src->backingStore =3D virStorageSourceNew())) + return -1; - if (!(format =3D virXPathString("string(./format/@type)", ctxt))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing disk backing store format")); - return -1; + return 0; } - backingStore->format =3D virStorageFileFormatTypeFromString(format); - if (backingStore->format <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk backing store format '%s'"), format= ); + if (!(backingStore =3D virDomainStorageSourceParseFull("string(@type)", + "string(./format/= @type)", + "./source", + "string(@index)", + false, ctxt, flag= s, xmlopt))) return -1; - } - if (!(source =3D virXPathNode("./source", ctxt))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing disk backing store source")); - return -1; - } + /* backing store is always read-only */ + backingStore->readonly =3D true; - if (virDomainStorageSourceParse(source, ctxt, backingStore, flags, xml= opt) < 0 || - virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) = < 0) + if (virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) = < 0) return -1; VIR_STEAL_PTR(src->backingStore, backingStore); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924586429490.1146633518074; Mon, 18 Mar 2019 08:56:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8ACF13082200; Mon, 18 Mar 2019 15:56:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65FD060FAB; Mon, 18 Mar 2019 15:56:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1DA5324C12; Mon, 18 Mar 2019 15:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtoVb022827 for ; Mon, 18 Mar 2019 11:55:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE4701001E6A; Mon, 18 Mar 2019 15:55:50 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 678491001E61 for ; Mon, 18 Mar 2019 15:55:50 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:16 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 27/34] conf: Use virDomainStorageSourceParseFull to parse disk source in virDomainDiskDefParseXML 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 18 Mar 2019 15:56:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use the new parser function for disk source. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d77d3befd3..ec666d8d8c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9783,17 +9783,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlop= t, ctxt->node =3D node; /* defaults */ - def->src->type =3D VIR_STORAGE_TYPE_FILE; def->device =3D VIR_DOMAIN_DISK_DEVICE_DISK; - if ((tmp =3D virXMLPropString(node, "type")) && - (def->src->type =3D virStorageTypeFromString(tmp)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown disk type '%s'"), tmp); - goto error; - } - VIR_FREE(tmp); - if ((tmp =3D virXMLPropString(node, "device")) && (def->device =3D virDomainDiskDeviceTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -9815,14 +9806,18 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlo= pt, rawio =3D virXMLPropString(node, "rawio"); sgio =3D virXMLPropString(node, "sgio"); + virObjectUnref(def->src); + if (!(def->src =3D virDomainStorageSourceParseFull("string(@type)", NU= LL, + "./source", + "string(./source/@ind= ex)", + true, ctxt, flags, xm= lopt))) + goto error; + for (cur =3D node->children; cur !=3D NULL; cur =3D cur->next) { if (cur->type !=3D XML_ELEMENT_NODE) continue; if (!source && virXMLNodeNameEqual(cur, "source")) { - if (virDomainStorageSourceParse(cur, ctxt, def->src, flags, xm= lopt) < 0) - goto error; - /* If we've already found an as a child of and * we find one as a child of , then force an error to * avoid ambiguity */ @@ -9851,14 +9846,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlop= t, source =3D true; startupPolicy =3D virXMLPropString(cur, "startupPolicy"); - - if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && - (tmp =3D virXMLPropString(cur, "index")) && - virStrToLong_uip(tmp, NULL, 10, &def->src->id) < 0) { - virReportError(VIR_ERR_XML_ERROR, _("invalid disk index '%= s'"), tmp); - goto error; - } - VIR_FREE(tmp); } else if (!target && virXMLNodeNameEqual(cur, "target")) { target =3D virXMLPropString(cur, "dev"); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155292458697686.23370626360418; Mon, 18 Mar 2019 08:56:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DEC5C057E7F; Mon, 18 Mar 2019 15:56:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31CDA60BEE; Mon, 18 Mar 2019 15:56:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DE192181A26B; Mon, 18 Mar 2019 15:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtpJT022832 for ; Mon, 18 Mar 2019 11:55:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id B13751001E7B; Mon, 18 Mar 2019 15:55:51 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 385EF1001E61 for ; Mon, 18 Mar 2019 15:55:51 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:17 +0100 Message-Id: <863aab76cb1332c0630b7875f129269e5e81b055.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 28/34] conf: Use virDomainStorageSourceParseFull in virDomainDiskDefMirrorParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 18 Mar 2019 15:56:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ec666d8d8c..5790b19315 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9334,15 +9334,11 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, unsigned int flags, virDomainXMLOptionPtr xmlopt) { - xmlNodePtr mirrorNode; VIR_AUTOFREE(char *) mirrorFormat =3D NULL; VIR_AUTOFREE(char *) mirrorType =3D NULL; VIR_AUTOFREE(char *) ready =3D NULL; VIR_AUTOFREE(char *) blockJob =3D NULL; - if (!(def->mirror =3D virStorageSourceNew())) - return -1; - if ((blockJob =3D virXMLPropString(cur, "job"))) { if ((def->mirrorJob =3D virDomainBlockJobTypeFromString(blockJob))= <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -9354,25 +9350,18 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, } if ((mirrorType =3D virXMLPropString(cur, "type"))) { - if ((def->mirror->type =3D virStorageTypeFromString(mirrorType)) <= =3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown mirror backing store type '%s'"), - mirrorType); + if (!(def->mirror =3D virDomainStorageSourceParseFull("string(./mi= rror/@type)", + NULL, + "./mirror/sour= ce", + NULL, + false, ctxt, f= lags, xmlopt))) return -1; - } mirrorFormat =3D virXPathString("string(./mirror/format/@type)", c= txt); - - if (!(mirrorNode =3D virXPathNode("./mirror/source", ctxt))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("mirror requires source element")); + } else { + if (!(def->mirror =3D virStorageSourceNew())) return -1; - } - if (virDomainStorageSourceParse(mirrorNode, ctxt, def->mirror, - flags, xmlopt) < 0) - return -1; - } else { /* For back-compat reasons, we handle a file name * encoded as attributes, even though we prefer * modern output in the style of backingStore */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924590615945.9900516684582; Mon, 18 Mar 2019 08:56:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 017898F863; Mon, 18 Mar 2019 15:56:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8CCC19C78; Mon, 18 Mar 2019 15:56:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8731724C19; Mon, 18 Mar 2019 15:56:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtqnB022840 for ; Mon, 18 Mar 2019 11:55:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83AF91001E82; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BAC51001E61 for ; Mon, 18 Mar 2019 15:55:51 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:18 +0100 Message-Id: <5a36bcb3f5148835903822423a4cab58195113fb.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 29/34] conf: Parse in virDomainStorageSourceParseFull 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 18 Mar 2019 15:56:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move parsing of into virDomainStorageSourceParseFull so that it can be reused easily. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 100 +++++++++++++++++++++------------------ src/conf/domain_conf.h | 3 +- src/conf/snapshot_conf.c | 2 +- src/qemu/qemu_domain.c | 2 +- tests/qemublocktest.c | 2 +- 5 files changed, 59 insertions(+), 50 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5790b19315..5b13402154 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9111,6 +9111,43 @@ virDomainStorageSourceParse(xmlNodePtr node, } +static int +virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, + virStorageSourcePtr src, + unsigned int flags, + virDomainXMLOptionPtr xmlopt) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt); + VIR_AUTOUNREF(virStorageSourcePtr) backingStore =3D NULL; + VIR_AUTOFREE(char *) type =3D NULL; + + if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) + return 0; + + /* terminator does not have a type */ + if (!(type =3D virXMLPropString(ctxt->node, "type"))) { + if (!(src->backingStore =3D virStorageSourceNew())) + return -1; + + return 0; + } + + if (!(backingStore =3D virDomainStorageSourceParseFull("string(@type)", + "string(./format/= @type)", + "./source", + "string(@index)", + false, true, ctxt= , flags, xmlopt))) + return -1; + + /* backing store is always read-only */ + backingStore->readonly =3D true; + + VIR_STEAL_PTR(src->backingStore, backingStore); + + return 0; +} + + /** * virDomainStorageSourceParseFull * @typeXPath: XPath query string for the 'type' of virStorageSource @@ -9118,6 +9155,7 @@ virDomainStorageSourceParse(xmlNodePtr node, * @sourceXPath: XPath query for the subelement * @indexXPath: XPath query for 'id' in virStorageSource (may be NULL if s= kipped) * @allowMissing: if true no errors are reported if the above fields are m= issing + * @backingStore: Full backing chain is parsed if true * @ctxt: XPath context * @flags: XML parser flags * @xmlopt: XML parser callbacks @@ -9128,6 +9166,10 @@ virDomainStorageSourceParse(xmlNodePtr node, * are missing. @formatXPath and @indexXpath may be NULL if they should be= omitted * or if the caller parses the value separately. * + * @backingStore controls whether the full backing chain should be parsed. + * Backing chain is parsed from elements named relative to + * the node of @ctxt when called. + * * Returns the parsed source or NULL on error. */ virStorageSourcePtr @@ -9136,6 +9178,7 @@ virDomainStorageSourceParseFull(const char *typeXPath, const char *sourceXPath, const char *indexXPath, bool allowMissing, + bool backingStore, xmlXPathContextPtr ctxt, unsigned int flags, virDomainXMLOptionPtr xmlopt) @@ -9200,50 +9243,15 @@ virDomainStorageSourceParseFull(const char *typeXPa= th, virDomainStorageSourceParse(sourceNode, ctxt, src, flags, xmlopt) = < 0) return NULL; + if (backingStore && + virDomainDiskBackingStoreParse(ctxt, src, flags, xmlopt) < 0) + return NULL; + VIR_STEAL_PTR(ret, src); return ret; } -static int -virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, - virStorageSourcePtr src, - unsigned int flags, - virDomainXMLOptionPtr xmlopt) -{ - VIR_XPATH_NODE_AUTORESTORE(ctxt); - VIR_AUTOUNREF(virStorageSourcePtr) backingStore =3D NULL; - VIR_AUTOFREE(char *) type =3D NULL; - - if (!(ctxt->node =3D virXPathNode("./backingStore", ctxt))) - return 0; - - /* terminator does not have a type */ - if (!(type =3D virXMLPropString(ctxt->node, "type"))) { - if (!(src->backingStore =3D virStorageSourceNew())) - return -1; - - return 0; - } - - if (!(backingStore =3D virDomainStorageSourceParseFull("string(@type)", - "string(./format/= @type)", - "./source", - "string(@index)", - false, ctxt, flag= s, xmlopt))) - return -1; - - /* backing store is always read-only */ - backingStore->readonly =3D true; - - if (virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) = < 0) - return -1; - - VIR_STEAL_PTR(src->backingStore, backingStore); - - return 0; -} - #define PARSE_IOTUNE(val) \ if (virXPathULongLong("string(./iotune/" #val ")", \ ctxt, &def->blkdeviotune.val) =3D=3D -2) { \ @@ -9354,7 +9362,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, NULL, "./mirror/sour= ce", NULL, - false, ctxt, f= lags, xmlopt))) + false, false, = ctxt, flags, xmlopt))) return -1; mirrorFormat =3D virXPathString("string(./mirror/format/@type)", c= txt); @@ -9765,6 +9773,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_AUTOFREE(char *) vendor =3D NULL; VIR_AUTOFREE(char *) product =3D NULL; VIR_AUTOFREE(char *) domain_name =3D NULL; + bool backingStore =3D true; if (!(def =3D virDomainDiskDefNew(xmlopt))) return NULL; @@ -9774,6 +9783,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, /* defaults */ def->device =3D VIR_DOMAIN_DISK_DEVICE_DISK; + if ((flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) + backingStore =3D false; + if ((tmp =3D virXMLPropString(node, "device")) && (def->device =3D virDomainDiskDeviceTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -9799,7 +9811,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, if (!(def->src =3D virDomainStorageSourceParseFull("string(@type)", NU= LL, "./source", "string(./source/@ind= ex)", - true, ctxt, flags, xm= lopt))) + true, backingStore, + ctxt, flags, xmlopt))) goto error; for (cur =3D node->children; cur !=3D NULL; cur =3D cur->next) { @@ -10134,11 +10147,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xml= opt, VIR_STEAL_PTR(def->vendor, vendor); VIR_STEAL_PTR(def->product, product); - if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) { - if (virDomainDiskBackingStoreParse(ctxt, def->src, flags, xmlopt) = < 0) - goto error; - } - if (flags & VIR_DOMAIN_DEF_PARSE_STATUS && virDomainDiskDefParsePrivateData(ctxt, def, xmlopt) < 0) goto error; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 72272965ae..7ab7b28e4f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3470,11 +3470,12 @@ virDomainStorageSourceParseFull(const char *typeXPa= th, const char *sourceXPath, const char *indexXPath, bool allowMissing, + bool backingStore, xmlXPathContextPtr ctxt, unsigned int flags, virDomainXMLOptionPtr xmlopt) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) - ATTRIBUTE_NONNULL(6); + ATTRIBUTE_NONNULL(7); int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, int maplen, diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 5dad2c3c51..4cc4795cf4 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -133,7 +133,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, if (!(def->src =3D virDomainStorageSourceParseFull("string(@type)", "string(./driver/@typ= e)", "./source", - NULL, true, + NULL, true, false, ctxt, flags, xmlopt))) goto cleanup; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e406647d8f..3ae9bdad1a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2696,7 +2696,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr n= ode, if (!(diskPriv->migrSource =3D virDomainStorageSourceParseFull("string= (@type)", "string(@= format)", ".", NULL, - false, ct= xt, + false, fa= lse, ctxt, VIR_DOMAI= N_DEF_PARSE_STATUS, priv->dri= ver->xmlopt))) return -1; diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 48cec2869b..09eaf155e9 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -57,7 +57,7 @@ testBackingXMLjsonXML(const void *args) if (!(xmlsrc =3D virDomainStorageSourceParseFull("string(./@type)", "string(./@format)", - ".", NULL, false, + ".", NULL, false, false, ctxt, 0, NULL))) { fprintf(stderr, "failed to parse disk source xml\n"); return -1; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924589636229.425338477526; Mon, 18 Mar 2019 08:56:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10564C0495B8; Mon, 18 Mar 2019 15:56:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA4725D75C; Mon, 18 Mar 2019 15:56:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A065424C17; Mon, 18 Mar 2019 15:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtr6w022850 for ; Mon, 18 Mar 2019 11:55:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 551681001DC8; Mon, 18 Mar 2019 15:55:53 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D22DA1001E84 for ; Mon, 18 Mar 2019 15:55:52 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:19 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 30/34] conf: Parse and format 'backingStore' for disk 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Mar 2019 15:56:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When the block copy operation is started with a reused external file in incremental mode libvirt will need to open and insert the backing chain for that file into qemu (in -blockdev mode). This means that we'll need to track the backing chain and metadata such as node names for the full chain of . This patch invokes the full backing chain formatter and parser for so that the chain can be kept with . Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 13 ++++++++----- tests/qemustatusxml2xmldata/blockjob-mirror-in.xml | 13 +++++++++++++ tests/qemuxml2argvdata/disk-mirror.xml | 6 ++++++ tests/qemuxml2xmloutdata/disk-mirror-active.xml | 6 ++++++ 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1828e0795b..623ef28719 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5676,6 +5676,7 @@ + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5b13402154..585b5515f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9342,6 +9342,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, unsigned int flags, virDomainXMLOptionPtr xmlopt) { + VIR_XPATH_NODE_AUTORESTORE(ctxt); VIR_AUTOFREE(char *) mirrorFormat =3D NULL; VIR_AUTOFREE(char *) mirrorType =3D NULL; VIR_AUTOFREE(char *) ready =3D NULL; @@ -9358,14 +9359,16 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, } if ((mirrorType =3D virXMLPropString(cur, "type"))) { - if (!(def->mirror =3D virDomainStorageSourceParseFull("string(./mi= rror/@type)", + ctxt->node =3D cur; + + if (!(def->mirror =3D virDomainStorageSourceParseFull("string(./@t= ype)", NULL, - "./mirror/sour= ce", + "./source", NULL, - false, false, = ctxt, flags, xmlopt))) + false, true, c= txt, flags, xmlopt))) return -1; - mirrorFormat =3D virXPathString("string(./mirror/format/@type)", c= txt); + mirrorFormat =3D virXPathString("string(./format/@type)", ctxt); } else { if (!(def->mirror =3D virStorageSourceNew())) return -1; @@ -24127,7 +24130,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "\n", formatStr); - if (virDomainDiskSourceFormat(buf, disk->mirror, 0, 0, true, false, fa= lse, + if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, false= , true, xmlopt) < 0) return -1; virBufferAdjustIndent(buf, -2); diff --git a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml b/tests/qem= ustatusxml2xmldata/blockjob-mirror-in.xml index 32bde1ba66..df23ac00aa 100644 --- a/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-mirror-in.xml @@ -65,6 +65,7 @@ +
@@ -76,6 +77,18 @@ + + + + + + + + + + + +
diff --git a/tests/qemuxml2argvdata/disk-mirror.xml b/tests/qemuxml2argvdat= a/disk-mirror.xml index e89eee47ed..c1e6e94e33 100644 --- a/tests/qemuxml2argvdata/disk-mirror.xml +++ b/tests/qemuxml2argvdata/disk-mirror.xml @@ -36,6 +36,7 @@ + @@ -45,6 +46,11 @@ + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-mirror-active.xml b/tests/qemuxm= l2xmloutdata/disk-mirror-active.xml index d689eac6b8..32ffc647be 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-active.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-active.xml @@ -40,6 +40,7 @@ +
@@ -51,6 +52,11 @@ + + + + +
--=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924593580281.8208095775061; Mon, 18 Mar 2019 08:56:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA8153081244; Mon, 18 Mar 2019 15:56:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ACF3119C78; Mon, 18 Mar 2019 15:56:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 64CA724C21; Mon, 18 Mar 2019 15:56:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtsFD022861 for ; Mon, 18 Mar 2019 11:55:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2687A1001DC8; Mon, 18 Mar 2019 15:55:54 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B021001E7B for ; Mon, 18 Mar 2019 15:55:53 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:20 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 31/34] conf: Add 'index' attribute for 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Mar 2019 15:56:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Similarly to the disk source we need to keep the disk index (which is in the qemu driver used for identification of the source for block jobs) for the element so that when it's replaced as a disk source after pivoting all the allocated data is present. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 4 ++-- tests/qemuxml2argvdata/disk-mirror.xml | 4 ++-- tests/qemuxml2xmloutdata/disk-mirror-active.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 585b5515f9..2bb4d6eafc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9364,7 +9364,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, if (!(def->mirror =3D virDomainStorageSourceParseFull("string(./@t= ype)", NULL, "./source", - NULL, + "string(./sour= ce/@index)", false, true, c= txt, flags, xmlopt))) return -1; @@ -24130,7 +24130,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "\n", formatStr); - if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, false= , true, + if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, true,= true, xmlopt) < 0) return -1; virBufferAdjustIndent(buf, -2); diff --git a/tests/qemuxml2argvdata/disk-mirror.xml b/tests/qemuxml2argvdat= a/disk-mirror.xml index c1e6e94e33..5a825c54ac 100644 --- a/tests/qemuxml2argvdata/disk-mirror.xml +++ b/tests/qemuxml2argvdata/disk-mirror.xml @@ -45,8 +45,8 @@ - - + + diff --git a/tests/qemuxml2xmloutdata/disk-mirror-active.xml b/tests/qemuxm= l2xmloutdata/disk-mirror-active.xml index 32ffc647be..bebdb849c2 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-active.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-active.xml @@ -51,8 +51,8 @@ - - + + --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924578712956.3215265606408; Mon, 18 Mar 2019 08:56:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6AF230917EE; Mon, 18 Mar 2019 15:56:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C36F1001E82; Mon, 18 Mar 2019 15:56:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 655DD3D39F; Mon, 18 Mar 2019 15:56:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtsEE022871 for ; Mon, 18 Mar 2019 11:55:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECAB61001E7E; Mon, 18 Mar 2019 15:55:54 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75CC01001E7B for ; Mon, 18 Mar 2019 15:55:54 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:21 +0100 Message-Id: <969631ff5a4563dfb86cc4c556384ef5e536e795.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 32/34] conf: Format seclabels for 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 18 Mar 2019 15:56:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We parse the seclabels and use them internally so omitting them when formatting would be misleading. Additionally our schema actually allows them. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 3 +-- tests/qemuxml2argvdata/disk-backing-chains.xml | 6 +++++- tests/qemuxml2xmloutdata/disk-backing-chains-active.xml | 6 +++++- tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml | 6 +++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2bb4d6eafc..105ece2b7c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23892,8 +23892,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, "\n", virStorageFileFormatTypeToString(backingStore->forma= t)); - /* We currently don't output seclabels for backing chain element */ - if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, + if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, true, false, true, xmlopt) < 0) return -1; diff --git a/tests/qemuxml2argvdata/disk-backing-chains.xml b/tests/qemuxml= 2argvdata/disk-backing-chains.xml index 703c60c439..2eaafb34e7 100644 --- a/tests/qemuxml2argvdata/disk-backing-chains.xml +++ b/tests/qemuxml2argvdata/disk-backing-chains.xml @@ -38,7 +38,11 @@ - + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml b/test= s/qemuxml2xmloutdata/disk-backing-chains-active.xml index d1fd2442c3..e24956f106 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-active.xml @@ -39,7 +39,11 @@ - + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml b/te= sts/qemuxml2xmloutdata/disk-backing-chains-inactive.xml index c1af58ff6f..e39e218873 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml @@ -39,7 +39,11 @@ - + + + + + --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924597201259.6202700688573; Mon, 18 Mar 2019 08:56:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7005730917AB; Mon, 18 Mar 2019 15:56:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46C575D705; Mon, 18 Mar 2019 15:56:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F2051181A26F; Mon, 18 Mar 2019 15:56:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtt4v022881 for ; Mon, 18 Mar 2019 11:55:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE7921001DC8; Mon, 18 Mar 2019 15:55:55 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 470271001E7E for ; Mon, 18 Mar 2019 15:55:55 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:22 +0100 Message-Id: <17549af0a1d6185658f45375baa2c1413c226d1d.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 33/34] conf: Remove @seclabels from virDomainDiskSourceFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 18 Mar 2019 15:56:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" All callers pass in 'true' so we can remove the parameter. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 9 ++++----- src/conf/domain_conf.h | 1 - src/conf/snapshot_conf.c | 2 +- tests/virstoragetest.c | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 105ece2b7c..d12a8dcaf9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23892,7 +23892,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, "\n", virStorageFileFormatTypeToString(backingStore->forma= t)); - if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, true, + if (virDomainDiskSourceFormat(&childBuf, backingStore, 0, flags, false, true, xmlopt) < 0) return -1; @@ -23953,7 +23953,6 @@ virDomainDiskSourceFormat(virBufferPtr buf, virStorageSourcePtr src, int policy, unsigned int flags, - bool seclabels, bool attrIndex, bool backingStore, virDomainXMLOptionPtr xmlopt) @@ -23964,7 +23963,7 @@ virDomainDiskSourceFormat(virBufferPtr buf, virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - seclabels, attrIndex, + true, attrIndex, policy, xmlopt) < 0) return -1; @@ -24129,7 +24128,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "\n", formatStr); - if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, true,= true, + if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, true, xmlopt) < 0) return -1; virBufferAdjustIndent(buf, -2); @@ -24227,7 +24226,7 @@ virDomainDiskDefFormat(virBufferPtr buf, virStorageAuthDefFormat(buf, def->src->auth); if (virDomainDiskSourceFormat(buf, def->src, def->startupPolicy, - flags, true, true, true, xmlopt) < 0) + flags, true, true, xmlopt) < 0) return -1; virBufferEscapeString(buf, "\n", def->doma= in_name); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7ab7b28e4f..26c6f45685 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3016,7 +3016,6 @@ int virDomainDiskSourceFormat(virBufferPtr buf, virStorageSourcePtr src, int policy, unsigned int flags, - bool seclabels, bool attrIndex, bool backingStore, virDomainXMLOptionPtr xmlopt); diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 4cc4795cf4..da27dcc1a1 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -752,7 +752,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, if (disk->src->format > 0) virBufferEscapeString(buf, "\n", virStorageFileFormatTypeToString(disk->src->= format)); - if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, true, false, false= , xmlopt) < 0) + if (virDomainDiskSourceFormat(buf, disk->src, 0, 0, false, false, xmlo= pt) < 0) return -1; virBufferAdjustIndent(buf, -2); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 9a11f5bfe8..ba97a80d45 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -657,7 +657,7 @@ testBackingParse(const void *args) goto cleanup; } - if (virDomainDiskSourceFormat(&buf, src, 0, 0, true, false, false, NUL= L) < 0 || + if (virDomainDiskSourceFormat(&buf, src, 0, 0, false, false, NULL) < 0= || !(xml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 03:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552924594635853.6227501278577; Mon, 18 Mar 2019 08:56:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C566AC04BD54; Mon, 18 Mar 2019 15:56:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DF586013A; Mon, 18 Mar 2019 15:56:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4C029181A26E; Mon, 18 Mar 2019 15:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2IFtuBV022893 for ; Mon, 18 Mar 2019 11:55:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 954E4101960C; Mon, 18 Mar 2019 15:55:56 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19B471001E84 for ; Mon, 18 Mar 2019 15:55:55 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 18 Mar 2019 16:55:23 +0100 Message-Id: <4f1df1d3ba7260b673c487d1d86e229191c148b2.1552924270.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 34/34] conf: Remove @seclabels from virDomainStorageSourceFormat 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Mar 2019 15:56:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" All callers now pass true so we can remove the argument. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d12a8dcaf9..51bacfdd82 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23758,7 +23758,6 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr b= uf, * @childBuf: buffer for subelements of the formatted element * @src: storage source to format * @flags: XML formatter flags - * @seclabels: security labels are formatted if true * @attrIndex: the 'index' attribute is formatted if true * @policy: startup policy, taken from disk (use 0 to omit) * @xmlopt: XML options data (for private data formatters) @@ -23774,7 +23773,6 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags, - bool seclabels, bool attrIndex, int policy, virDomainXMLOptionPtr xmlopt) @@ -23817,7 +23815,7 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf, return -1; } - if (seclabels && src->type !=3D VIR_STORAGE_TYPE_NETWORK) + if (src->type !=3D VIR_STORAGE_TYPE_NETWORK) virDomainSourceDefFormatSeclabel(childBuf, src->nseclabels, src->seclabels, flags); @@ -23934,7 +23932,7 @@ virDomainStorageSourceFormatFull(virBufferPtr buf, virStorageFileFormatTypeToString(src->format)); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - true, true, 0, xmlopt) < 0) + true, 0, xmlopt) < 0) return -1; if (virXMLFormatElement(buf, elemname, &attrBuf, &childBuf) < 0) @@ -23963,8 +23961,7 @@ virDomainDiskSourceFormat(virBufferPtr buf, virBufferSetChildIndent(&childBuf, buf); if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags, - true, attrIndex, - policy, xmlopt) < 0) + attrIndex, policy, xmlopt) < 0) return -1; if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list