From nobody Mon Feb 9 22:39:31 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=1687867612; cv=none; d=zohomail.com; s=zohoarc; b=I8G86t47CkbMMy3FhudvQTfp9zWTn5uePLYUAR8inbn6DLm3OlS0cw3c9Cur8WmoLTfHDGf3UmAmqi51oh23n7Ugjcd414vY1SfJDYUf+hZFiqIeUM5vNoUEpbJwonPY8e+lVoMZ2u6ZANFwC2sibcMr4xbEtP5T9yIfs0EeZes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687867612; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=aHYyzpIJLNhJSYN57VMrjpRVKn0YwGPObQgOZmQkDag=; b=dzXaIxZQP3BtzdpN1kZ+DGlX55LnOaq2cXp3SB1NP9a3valhlY8YwxlacKzCf2rdaZxvUKsCCgdNsDXZjGV0e2Cbjrxzwm50KMAI2AJh6Ox7WuWbTEJ0Tukwns1hDxFlgecQ0znBkpzC7MzBCWDHdAagTVV6Lo/F2d7gFD5CW34= 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 1687867612760628.8146002304376; Tue, 27 Jun 2023 05:06:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-648-0pdEs4KZODe3lFVCyeLzjA-1; Tue, 27 Jun 2023 08:06:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 48F2C3813F21; Tue, 27 Jun 2023 12:06:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2D0B111F3B6; Tue, 27 Jun 2023 12:06:43 +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 903001946588; Tue, 27 Jun 2023 12:06:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54A991946587 for ; Tue, 27 Jun 2023 12:06:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3067940C2071; Tue, 27 Jun 2023 12:06:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28F9B40C2063 for ; Tue, 27 Jun 2023 12:06:27 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 0A31F185A7A4 for ; Tue, 27 Jun 2023 12:06:27 +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-634-nIMYXXiqNe6NXWAULj9ZXQ-1; Tue, 27 Jun 2023 08:06:25 -0400 Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (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 4Qr3My5kqNzDqBm for ; Tue, 27 Jun 2023 12:06:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4Qr3Mx4BzTzFqk0; Tue, 27 Jun 2023 12:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687867611; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aHYyzpIJLNhJSYN57VMrjpRVKn0YwGPObQgOZmQkDag=; b=c9BWi5weij1OkyLWnQWYiRy72h8iKsBMp09sGQW0rTfJYCoKAMlCn7dGophqidvThPaJB0 7NBbWWT3g2OWW5n/gt1iTkykCKU7ypnq3PF4n0XHppDhEYI3NknQ+ese+YbmCO70vtIOYZ 0P64l9lg/yrg15FDLV7koaXj/0evbts= X-MC-Unique: 0pdEs4KZODe3lFVCyeLzjA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: nIMYXXiqNe6NXWAULj9ZXQ-1 X-Riseup-User-ID: 3E183407C34A5BB61DDBF0B915ADC22393201314F5AACFFC119D5A4EE29285A4 From: K Shiva To: libvir-list@redhat.com Subject: [libvirt PATCH] Add and <description> for Network Objects Date: Tue, 27 Jun 2023 17:36:13 +0530 Message-ID: <20230627120613.47596-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.1 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 <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.3 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: 1687867613596100001 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 <metadata> have been moved from domaincommon.rng to basictypes.rng for use by network and future objects. Get/Set Public APIs for modifying these elements as well as=20 <metadata> will be added in a subsequent patch. Signed-off-by: K Shiva Kiran <shiva_kr@riseup.net> --- docs/formatnetwork.rst | 11 +++++++++++ src/conf/network_conf.c | 13 +++++++++++++ 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, 51 insertions(+), 15 deletions(-) diff --git a/docs/formatnetwork.rst b/docs/formatnetwork.rst index b5dc29db07..ee07f7d505 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.5.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.5.0` + =20 Connectivity ~~~~~~~~~~~~ diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 73788b6d87..1e5d45f23a 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. */ 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 fcf9e00600..a4360a4036 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