From nobody Tue Feb 10 11:16:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=riseup.net ARC-Seal: i=1; a=rsa-sha256; t=1692211697; cv=none; d=zohomail.com; s=zohoarc; b=ntxATeiBWhoJh6DhYdYYquQOTHgX2juiz6B8S6dovIcsSKPiU/Lyhj+8U14TjLh3cN9bNSJLcr7HCAy0f7cjdSTq6QDGDEx3Ur1XIiJaPvPCS9Xsd14YD3sqeyjLAGOBVnNXSzs05tD7MBP0RRhabI4qi71NgM532FjLgqo9ghg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692211697; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8BviNIy9GjBuF/xCdYXjX8VtIY9ucgJCxD6el8Rzp2g=; b=ZxcDh0me0rK0kWHBsc3jDEPvmVVVZdAvMY0uiv+dPCTyLuNQTQ5eEilLJtgE/M12BTWxCThUBxCM4/LNztQYLSLe3cgrexBhbCtIPXCmG4pUkJzhfg5MhRUdhlDZi6eTdJMKuSZzogjKuidHTBTRZ5gtOvKoCoMBhqI16A2Is4s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1692211697711637.4908795393656; Wed, 16 Aug 2023 11:48:17 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-112-U59yUkjJP12uPq2tjEN9Hg-1; Wed, 16 Aug 2023 14:48:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F31E80557A; Wed, 16 Aug 2023 18:48:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C7FD6403D; Wed, 16 Aug 2023 18:48:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2891F1946A62; Wed, 16 Aug 2023 18:47:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6EE32194658C for ; Wed, 16 Aug 2023 18:47:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AD7EE2026D76; Wed, 16 Aug 2023 18:47:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A599B2026D2A for ; Wed, 16 Aug 2023 18:47:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 847E680CC4A for ; Wed, 16 Aug 2023 18:47:37 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-vF3aosyHPkK2DT5dUO6bIQ-1; Wed, 16 Aug 2023 14:47:35 -0400 Received: from fews01-sea.riseup.net (fews01-sea-pn.riseup.net [10.0.1.109]) (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 mx1.riseup.net (Postfix) with ESMTPS id 4RQxvn6dyXzDqfk for ; Wed, 16 Aug 2023 18:47:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews01-sea.riseup.net (Postfix) with ESMTPSA id 4RQxvm5ZgrzJnDN; Wed, 16 Aug 2023 18:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692211696; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8BviNIy9GjBuF/xCdYXjX8VtIY9ucgJCxD6el8Rzp2g=; b=UnQh/Ylo/J+w5pjm2U88pfhcftztYP2F3fDWiRwOb+mRFtPMVWZ9E1yTtgb4oyQzYKhm8E hQblHGEW2v9Z48bT0MT1BWyuZ/VEhZXYO+syH8hlrPQ0YsYhJE5hfOySBXwXZFPylPJHMa oQIT45Wz4hOTuY2KDGz2LnRc8X+7pHk= X-MC-Unique: U59yUkjJP12uPq2tjEN9Hg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: vF3aosyHPkK2DT5dUO6bIQ-1 X-Riseup-User-ID: 7B99EEC3BB529A63299C3C95D2B360AD11FAF18612ED43AE902AA9EC1A9E32B5 From: K Shiva Kiran To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/7] Add and <description> for Network Objects Date: Thu, 17 Aug 2023 00:17:09 +0530 Message-ID: <20230816184715.101243-2-shiva_kr@riseup.net> In-Reply-To: <20230816184715.101243-1-shiva_kr@riseup.net> References: <20230816184715.101243-1-shiva_kr@riseup.net> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools <libvir-list.redhat.com> List-Unsubscribe: <https://listman.redhat.com/mailman/options/libvir-list>, <mailto:libvir-list-request@redhat.com?subject=unsubscribe> List-Archive: <http://listman.redhat.com/archives/libvir-list/> List-Post: <mailto:libvir-list@redhat.com> List-Help: <mailto:libvir-list-request@redhat.com?subject=help> List-Subscribe: <https://listman.redhat.com/mailman/listinfo/libvir-list>, <mailto:libvir-list-request@redhat.com?subject=subscribe> Cc: K Shiva Kiran <shiva_kr@riseup.net> Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" <libvir-list-bounces@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: riseup.net Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692211699607100009 Content-Type: text/plain; charset="utf-8"; x-default="true" This patch adds new elements <title> and <description> to the Network XML. - The <title> attribute holds a short title defined by the user and cannot contain newlines. - The <description> attribute holds any documentation that the user wants to store. - Schema definitions of <title> and <description> have been moved from domaincommon.rng to basictypes.rng for use by network and future objects. - Added Network XML parser logic for the above. Signed-off-by: K Shiva Kiran <shiva_kr@riseup.net> --- docs/formatnetwork.rst | 11 +++++++++++ src/conf/network_conf.c | 18 ++++++++++++++++++ src/conf/network_conf.h | 2 ++ src/conf/schemas/basictypes.rng | 15 +++++++++++++++ src/conf/schemas/domaincommon.rng | 15 --------------- src/conf/schemas/network.rng | 10 ++++++++++ 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/docs/formatnetwork.rst b/docs/formatnetwork.rst index b5dc29db07..c54d53070a 100644 --- a/docs/formatnetwork.rst +++ b/docs/formatnetwork.rst @@ -30,6 +30,8 @@ The first elements provide basic metadata about the virtu= al network. <network ipv6=3D'yes' trustGuestRxFilters=3D'no'> <name>default</name> <uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid> + <title>A short description - title - of the network + Some human readable description .. .. @@ -47,6 +49,7 @@ The first elements provide basic metadata about the virtu= al network. the virtual network. The format must be RFC 4122 compliant, eg ``3e3fce45-4f53-4fa7-bb32-11f34168b82b``. If omitted when defining/crea= ting a new network, a random UUID is generated. :since:`Since 0.3.0` +``metadata`` The ``metadata`` node can be used by applications to store custom metad= ata in the form of XML nodes/trees. Applications must use custom namespaces on= their XML nodes/trees, with only one top-level element per namespace (if the @@ -65,6 +68,14 @@ The first elements provide basic metadata about the virt= ual network. documentation for more details. Note that an explicit setting of this attribute in a portgroup or the individual domain interface will overri= de the setting in the network. +``title`` + The optional element ``title`` provides space for a short description o= f the + network. The title should not contain any newlines. :since:`Since 9.7.0= ` . +``description`` + The content of the ``description`` element provides a human readable + description of the network. This data is not used by libvirt in any + way, it can contain any information the user wants. :since:`Since 9.7.0` + =20 Connectivity ~~~~~~~~~~~~ diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 3e137cb562..262e9a9fc7 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -281,6 +281,8 @@ virNetworkDefFree(virNetworkDef *def) virNetDevBandwidthFree(def->bandwidth); virNetDevVlanClear(&def->vlan); =20 + g_free(def->title); + g_free(def->description); xmlFreeNode(def->metadata); =20 if (def->namespaceData && def->ns.free) @@ -1599,6 +1601,17 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt, def->uuid_specified =3D true; } =20 + /* Extract short description of network (title) */ + def->title =3D virXPathString("string(./title[1])", ctxt); + if (def->title && strchr(def->title, '\n')) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Network title can't contain newlines")); + return NULL; + } + + /* Extract documentation if present */ + def->description =3D virXPathString("string(./description[1])", ctxt); + /* check if definitions with no IPv6 gateway addresses is to * allow guest-to-guest communications. */ @@ -2311,6 +2324,11 @@ virNetworkDefFormatBuf(virBuffer *buf, virUUIDFormat(uuid, uuidstr); virBufferAsprintf(buf, "%s\n", uuidstr); =20 + virBufferEscapeString(buf, "%s\n", def->title); + + virBufferEscapeString(buf, "%s\n", + def->description); + if (virXMLFormatMetadata(buf, def->metadata) < 0) return -1; =20 diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 2b2e9d15f0..5a1bdb1284 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -249,6 +249,8 @@ struct _virNetworkDef { unsigned char uuid[VIR_UUID_BUFLEN]; bool uuid_specified; char *name; + char *title; + char *description; int connections; /* # of guest interfaces connected to this network = */ =20 char *bridge; /* Name of bridge device */ diff --git a/src/conf/schemas/basictypes.rng b/src/conf/schemas/basictypes.= rng index 2d6f1a2c84..26eb538077 100644 --- a/src/conf/schemas/basictypes.rng +++ b/src/conf/schemas/basictypes.rng @@ -610,6 +610,21 @@ =20 + + + + + + + + + + + + + diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index c2f56b0490..2556ac01ed 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -8,21 +8,6 @@ =20 - - - - - - - - - - - - - 0[0-7]{3}|[0-7]{1,3} diff --git a/src/conf/schemas/network.rng b/src/conf/schemas/network.rng index 4317572208..cda174ab4b 100644 --- a/src/conf/schemas/network.rng +++ b/src/conf/schemas/network.rng @@ -37,6 +37,16 @@ =20 + + + + + + + + + + --=20 2.41.0