From nobody Sat Feb 7 15:14:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740088870346236.15678704825848; Thu, 20 Feb 2025 14:01:10 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 48B2396A; Thu, 20 Feb 2025 17:01:09 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 68A6A21AD; Thu, 20 Feb 2025 17:00:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7FDFC214D; Thu, 20 Feb 2025 17:00:30 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 79C851E40 for ; Thu, 20 Feb 2025 17:00:29 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-YR474qSEOa-Q80_b7PzIhw-1; Thu, 20 Feb 2025 17:00:26 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CBB5B1800876 for ; Thu, 20 Feb 2025 22:00:25 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D312B1800359 for ; Thu, 20 Feb 2025 22:00:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740088829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hGuYmdK2hBp6oWlZl86bf2vFo4qPSofY2P31ohW4mKA=; b=FmeQ8irkXQevXCkvKY0sAI8Y/CA9MGt8H0vFVwSXgNuyvUHiGbAK30T0Jk8k9V8zdQkY2s dHtxi6heka+v1P64sDB6vDZJs9FgejIe2/qcKBqIpVwjnjkmgYqAjDtsrfoTe9PMJZpRfl s5QHfyQGcGH1A+n/57cdipu1NgFQ/Gc= X-MC-Unique: YR474qSEOa-Q80_b7PzIhw-1 X-Mimecast-MFC-AGG-ID: YR474qSEOa-Q80_b7PzIhw_1740088825 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv1 1/4] conf: networkobj: fix indentation Date: Thu, 20 Feb 2025 22:59:23 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dLdrv0xA9w0XB65G6fjp0M2UG7MzSyRVlDXxPjQFNxY_1740088825 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SUUUVPLFF4KJWJ5RQGAFERLNN5DDNCZM X-Message-ID-Hash: SUUUVPLFF4KJWJ5RQGAFERLNN5DDNCZM X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740088872984019100 Content-Type: text/plain; charset="utf-8" 'Network' has one more letter than 'Domain' where these helpers were copied from. Shift the unaligned lines by one. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/conf/virnetworkobj.c | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 5abc295506..ded4c58b47 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1911,9 +1911,9 @@ virNetworkObjUpdateModificationImpact(virNetworkObj *= obj, */ static int virNetworkObjGetDefs(virNetworkObj *net, - unsigned int flags, - virNetworkDef **liveDef, - virNetworkDef **persDef) + unsigned int flags, + virNetworkDef **liveDef, + virNetworkDef **persDef) { if (liveDef) *liveDef =3D NULL; @@ -1957,8 +1957,8 @@ virNetworkObjGetDefs(virNetworkObj *net, */ static virNetworkDef * virNetworkObjGetOneDefState(virNetworkObj *net, - unsigned int flags, - bool *live) + unsigned int flags, + bool *live) { if (flags & VIR_NETWORK_UPDATE_AFFECT_LIVE && flags & VIR_NETWORK_UPDATE_AFFECT_CONFIG) { @@ -1996,7 +1996,7 @@ virNetworkObjGetOneDefState(virNetworkObj *net, */ static virNetworkDef * virNetworkObjGetOneDef(virNetworkObj *net, - unsigned int flags) + unsigned int flags) { return virNetworkObjGetOneDefState(net, flags, NULL); } @@ -2004,9 +2004,9 @@ virNetworkObjGetOneDef(virNetworkObj *net, =20 char * virNetworkObjGetMetadata(virNetworkObj *net, - int type, - const char *uri, - unsigned int flags) + int type, + const char *uri, + unsigned int flags) { virNetworkDef *def; char *ret =3D NULL; @@ -2054,10 +2054,10 @@ virNetworkObjGetMetadata(virNetworkObj *net, =20 static int virNetworkDefSetMetadata(virNetworkDef *def, - int type, - const char *metadata, - const char *key, - const char *uri) + int type, + const char *metadata, + const char *key, + const char *uri) { g_autoptr(xmlDoc) doc =3D NULL; xmlNodePtr old; @@ -2131,14 +2131,14 @@ virNetworkDefSetMetadata(virNetworkDef *def, =20 int virNetworkObjSetMetadata(virNetworkObj *net, - int type, - const char *metadata, - const char *key, - const char *uri, - virNetworkXMLOption *xmlopt, - const char *stateDir, - const char *configDir, - unsigned int flags) + int type, + const char *metadata, + const char *key, + const char *uri, + virNetworkXMLOption *xmlopt, + const char *stateDir, + const char *configDir, + unsigned int flags) { virNetworkDef *def; virNetworkDef *persistentDef; @@ -2159,7 +2159,7 @@ virNetworkObjSetMetadata(virNetworkObj *net, =20 if (persistentDef) { if (virNetworkDefSetMetadata(persistentDef, type, metadata, key, - uri) < 0) + uri) < 0) return -1; =20 if (virNetworkSaveConfig(configDir, persistentDef, xmlopt) < 0) --=20 2.48.1 From nobody Sat Feb 7 15:14:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740088886998845.5886667909652; Thu, 20 Feb 2025 14:01:26 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 591BD97D; Thu, 20 Feb 2025 17:01:26 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0534C2247; Thu, 20 Feb 2025 17:00:37 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D600821A5; Thu, 20 Feb 2025 17:00:30 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5B3C52145 for ; Thu, 20 Feb 2025 17:00:30 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-389-XQ3AB_OkMb-TS4pRQ_YQTA-1; Thu, 20 Feb 2025 17:00:28 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3C8EB190F9C8 for ; Thu, 20 Feb 2025 22:00:27 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4242D1800265 for ; Thu, 20 Feb 2025 22:00:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740088830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ua+8mMt2lqoP+bAIb1seuZye5lNmbLjxWvaGNv9OcVg=; b=RSUvJQ123JDywLu2NK67N1ICDSm7Ugt1H72vEONP6V7qxwUoz5R+62s3UbTCOnc9mVdN55 jDTQGLnCK11KunKNoPfJ3iYKxpy3oJOy6aIVOMSDolSM/InCZxt/HoCoe966FvJgZbRXik Viy9cFc82NlzpYYHK4wq0kBN9mn/7q4= X-MC-Unique: XQ3AB_OkMb-TS4pRQ_YQTA-1 X-Mimecast-MFC-AGG-ID: XQ3AB_OkMb-TS4pRQ_YQTA_1740088827 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv1 2/4] conf: obj: remove extra empty line Date: Thu, 20 Feb 2025 22:59:24 +0100 Message-ID: <0b0f9ddd4ac35bc43b4efeb17d70e5957933bce2.1740088765.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lVzDzMcEl6mj8-u3vT4wHG-RROxe9se4qGqoCIFAn1A_1740088827 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JLXB5GHH4CIKKXA3N4ZIH7VBWUTW2JJT X-Message-ID-Hash: JLXB5GHH4CIKKXA3N4ZIH7VBWUTW2JJT X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740088887821019000 Content-Type: text/plain; charset="utf-8" Originally present in virDomainDefSetMetadata it got copied to virNetworkDefSetMetadata too. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 1 - src/conf/virnetworkobj.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 49555efc56..878d1f68c1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30231,7 +30231,6 @@ virDomainDefSetMetadata(virDomainDef *def, =20 case VIR_DOMAIN_METADATA_ELEMENT: if (metadata) { - /* parse and modify the xml from the user */ if (!(doc =3D virXMLParseStringCtxt(metadata, _("(metadata_xml= )"), NULL))) return -1; diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index ded4c58b47..7d4566bdf1 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -2086,7 +2086,6 @@ virNetworkDefSetMetadata(virNetworkDef *def, =20 case VIR_NETWORK_METADATA_ELEMENT: if (metadata) { - /* parse and modify the xml from the user */ if (!(doc =3D virXMLParseStringCtxt(metadata, _("(metadata_xml= )"), NULL))) return -1; --=20 2.48.1 From nobody Sat Feb 7 15:14:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740088908850420.82370099698915; Thu, 20 Feb 2025 14:01:48 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E72A97D; Thu, 20 Feb 2025 17:01:48 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EFC232267; Thu, 20 Feb 2025 17:00:40 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A61E521D9; Thu, 20 Feb 2025 17:00:36 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2D67D21CD for ; Thu, 20 Feb 2025 17:00:31 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-501-dxDFvjmtMy2wUMzw-vcCUw-1; Thu, 20 Feb 2025 17:00:29 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 84BD419783BA for ; Thu, 20 Feb 2025 22:00:28 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A607C1800359 for ; Thu, 20 Feb 2025 22:00:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740088830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PReDI09E2CP+cuOflokbUylBDHRvXEnN+uXzmPKfYUA=; b=hK5gnMPaKAagYG4TrvmWi2+FGbnLg9VmP7k9n5YUucAJCzk1qGpx1ijV6saPpqRBBSfUjw 5+umK3gc4PR8fBaw6qdJDM49VBh6s2mNUEnIrJMbLAsSiXNr+x/jv4QwbjggDFV3El/foO JdZ7aW5zbqhNJF1qi0YhLK5N4sy9cs0= X-MC-Unique: dxDFvjmtMy2wUMzw-vcCUw-1 X-Mimecast-MFC-AGG-ID: dxDFvjmtMy2wUMzw-vcCUw_1740088828 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv1 3/4] conf: metadata: ignore empty metadata element Date: Thu, 20 Feb 2025 22:59:25 +0100 Message-ID: <207dd043b19a7a17cb68d6fa503005c9546c4f36.1740088765.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gJFDjDhXZlvp8nb9tvlmJlRhInUtS0X6I9XjTPMiqm4_1740088828 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 65QOJ343JFHWK5VMBWFIIHNUGETKUUQP X-Message-ID-Hash: 65QOJ343JFHWK5VMBWFIIHNUGETKUUQP X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740088909879019000 Content-Type: text/plain; charset="utf-8" Do not copy the node to domain/network definition if its empty. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 4 +++- src/conf/network_conf.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 878d1f68c1..6ca604a60b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19853,8 +19853,10 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt, return NULL; =20 /* Extract custom metadata */ - if ((node =3D virXPathNode("./metadata[1]", ctxt)) !=3D NULL) + if ((node =3D virXPathNode("./metadata[1]", ctxt)) !=3D NULL && + xmlFirstElementChild(node)) { def->metadata =3D xmlCopyNode(node, 1); + } =20 /* we have to make a copy of all of the callback pointers here since * we won't have the virCaps structure available during free diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 316a84502d..8cd26de72f 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1898,7 +1898,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt, } =20 /* Extract custom metadata */ - if ((metadataNode =3D virXPathNode("./metadata[1]", ctxt)) !=3D NULL) { + if ((metadataNode =3D virXPathNode("./metadata[1]", ctxt)) !=3D NULL && + xmlFirstElementChild(metadataNode)) { def->metadata =3D xmlCopyNode(metadataNode, 1); virXMLNodeSanitizeNamespaces(def->metadata); } --=20 2.48.1 From nobody Sat Feb 7 15:14:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1740088924108736.1462741080113; Thu, 20 Feb 2025 14:02:04 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7FD56930; Thu, 20 Feb 2025 17:02:03 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A59EA226F; Thu, 20 Feb 2025 17:00:46 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 558062223; Thu, 20 Feb 2025 17:00:42 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 959682184 for ; Thu, 20 Feb 2025 17:00:33 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-ezbIA0RENLiq8TtTRAthNA-1; Thu, 20 Feb 2025 17:00:30 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EDA7419560AF for ; Thu, 20 Feb 2025 22:00:29 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.8]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2019E1800D9F for ; Thu, 20 Feb 2025 22:00:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740088833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RKd5Xmegw3pgnkVOzSpuF3jlrbSVv6QYy7jZx/uY9gQ=; b=GZG/MRO+MLFZEQXN2256wnvzeeoFLJ3FFg6hN3rUm6Zd8kn+Dv+ofXWtkZK+tDaGm2D4Cs wgBE8XdN9g8vi7glag9w+9U8ttb4rUXAY6Y9AB3t7V0LHe+K8TIvTv3l0R/TJCEp4z9kYH hxBexm3mwyf1ThvWstBxPIpTpTL1mN8= X-MC-Unique: ezbIA0RENLiq8TtTRAthNA-1 X-Mimecast-MFC-AGG-ID: ezbIA0RENLiq8TtTRAthNA_1740088830 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCHv1 4/4] conf: metadata: remove metadata node if all metadata is removed Date: Thu, 20 Feb 2025 22:59:26 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: C3_6lc_x6sz-cjQua4sK_mmwhEiW0BHah983Zqfix4o_1740088830 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XBN4CNRWDHBNDTQE4MJWJNNR7VECGT4C X-Message-ID-Hash: XBN4CNRWDHBNDTQE4MJWJNNR7VECGT4C X-MailFrom: jtomko@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740088926169019000 Content-Type: text/plain; charset="utf-8" When removing the last child element from a network or domain metadata, free the metadata node itself as well, to prevent displaying an empty metadata element. https://issues.redhat.com/browse/RHEL-27172 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 3 +++ src/conf/virnetworkobj.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6ca604a60b..50763d9514 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30264,6 +30264,9 @@ virDomainDefSetMetadata(virDomainDef *def, return -1; } new =3D NULL; + } else if (!xmlFirstElementChild(def->metadata)) { + xmlFreeNode(def->metadata); + def->metadata =3D NULL; } break; =20 diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 7d4566bdf1..c908c61e67 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -2117,6 +2117,9 @@ virNetworkDefSetMetadata(virNetworkDef *def, return -1; } new =3D NULL; + } else if (!xmlFirstElementChild(def->metadata)) { + xmlFreeNode(def->metadata); + def->metadata =3D NULL; } break; =20 --=20 2.48.1