From nobody Sun Feb 8 10:50:35 2026
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
ARC-Seal: i=1; a=rsa-sha256; t=1555521664; cv=none;
d=zoho.com; s=zohoarc;
b=C/jA/+usV26ynpI9iYAOKeaHsMRe7Hf7mqRDYGXbE1/HTfcMUV629p2Ol4yNieknevxuu+9lxwT91v4m/W10sGapyzit/bnZZCqk3WcZ8Pmr0IH/oFfTHe4CIonB61HW4zi4PrjyBecIV/Z+/uiQha4cqshY7g4R/9dkJ0tV2rU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1555521664;
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:ARC-Authentication-Results;
bh=vOr23rBN+hh6G7zvaLk0XFNIaVZQt1RwYJDzW+UHBxk=;
b=Hme0cZZSnfsNmXa1Ft7mbMVBddIdp2LE8xy7pBeAcL92lWDOoUwEcxIN2tVBGtE7dnX7Dp/tA6C1GcXgBldiLw7l0Vkm+tNV85MU51BSOsgVrdJVfGnoCF3TcdzexQoKrbbKk8uB15VanGoQiJ7E4h+m7i0YKq41Q04rBKWDGkE=
ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1555521664190751.2188172552916;
Wed, 17 Apr 2019 10:21:04 -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 7B1B5C057E32;
Wed, 17 Apr 2019 17:21:02 +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 54F241992A;
Wed, 17 Apr 2019 17:21:02 +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 12B16181BA09;
Wed, 17 Apr 2019 17:21:02 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x3HHL0me031015 for ;
Wed, 17 Apr 2019 13:21:00 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 580B25D71A; Wed, 17 Apr 2019 17:21:00 +0000 (UTC)
Received: from localhost.localdomain.com (ovpn-112-35.ams2.redhat.com
[10.36.112.35])
by smtp.corp.redhat.com (Postfix) with ESMTP id DF4245D6A6;
Wed, 17 Apr 2019 17:20:58 +0000 (UTC)
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?=
To: libvir-list@redhat.com
Date: Wed, 17 Apr 2019 18:19:28 +0100
Message-Id: <20190417171929.9399-29-berrange@redhat.com>
In-Reply-To: <20190417171929.9399-1-berrange@redhat.com>
References: <20190417171929.9399-1-berrange@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-loop: libvir-list@redhat.com
Cc: Laine Stump
Subject: [libvirt] [PATCH v4 28/29] conf: record a portid against the domain
conf
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-Type: text/plain; charset="utf-8"
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.31]);
Wed, 17 Apr 2019 17:21:03 +0000 (UTC)
The portid will be the UUID of the virNetworkPort object associated
with the network interface when a guest is running.
Signed-off-by: Daniel P. Berrang=C3=A9
---
docs/formatdomain.html.in | 8 +++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 21 +++++++++++++++++++
src/conf/domain_conf.h | 4 ++++
.../net-virtio-network-portgroup.xml | 6 +++---
5 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d27ab07cbb..5e35d57665 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5309,6 +5309,14 @@
information for different classes of network
connections. Since 0.9.4.
+
+ When a guest is running and interface of type network
+ may include a portid attribute. This provides the UUID
+ of an associated virNetworkPortPtr object that records the associati=
on
+ between the domain interface and the network. This attribute is
+ read-only since port objects are create and deleted automatically
+ during startup and shutdown. Since 5.1.0/
+
Also, similar to direct network connections
(described below), a connection of type network may
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 111b85c36f..ecdde43c3a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2591,6 +2591,11 @@
+
+
+
+
+
=20
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1be78e1e26..2b199b6325 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11406,6 +11406,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
VIR_AUTOFREE(char *) type =3D NULL;
VIR_AUTOFREE(char *) network =3D NULL;
VIR_AUTOFREE(char *) portgroup =3D NULL;
+ VIR_AUTOFREE(char *) portid =3D NULL;
VIR_AUTOFREE(char *) bridge =3D NULL;
VIR_AUTOFREE(char *) dev =3D NULL;
VIR_AUTOFREE(char *) ifname =3D NULL;
@@ -11483,6 +11484,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
virXMLNodeNameEqual(cur, "source")) {
network =3D virXMLPropString(cur, "network");
portgroup =3D virXMLPropString(cur, "portgroup");
+ if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE))
+ portid =3D virXMLPropString(cur, "portid");
} else if (!internal &&
def->type =3D=3D VIR_DOMAIN_NET_TYPE_INTERNAL &&
virXMLNodeNameEqual(cur, "source")) {
@@ -11695,6 +11698,13 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
"specified with =
"));
goto error;
}
+ if (portid &&
+ virUUIDParse(portid, def->data.network.portid) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to parse port id '%s'"), portid);
+ goto error;
+ }
+
VIR_STEAL_PTR(def->data.network.name, network);
VIR_STEAL_PTR(def->data.network.portgroup, portgroup);
VIR_STEAL_PTR(def->data.network.actual, actual);
@@ -24979,6 +24989,11 @@ virDomainActualNetDefContentsFormat(virBufferPtr b=
uf,
def->data.network.name);
virBufferEscapeString(buf, " portgroup=3D'%s'",
def->data.network.portgroup);
+ if (virUUIDIsValid(def->data.network.portid)) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(def->data.network.portid, uuidstr);
+ virBufferAsprintf(buf, " portid=3D'%s'", uuidstr);
+ }
}
if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE ||
actualType =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK) {
@@ -25282,6 +25297,12 @@ virDomainNetDefFormat(virBufferPtr buf,
def->data.network.name);
virBufferEscapeString(buf, " portgroup=3D'%s'",
def->data.network.portgroup);
+ if (virUUIDIsValid(def->data.network.portid) &&
+ !(flags & (VIR_DOMAIN_DEF_FORMAT_INACTIVE))) {
+ char portidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(def->data.network.portid, portidstr);
+ virBufferEscapeString(buf, " portid=3D'%s'", portidstr);
+ }
sourceLines++;
break;
=20
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index be43b31123..8d4c753a3f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -969,6 +969,7 @@ struct _virDomainNetDef {
struct {
char *name;
char *portgroup;
+ unsigned char portid[VIR_UUID_BUFLEN];
/* actual has info about the currently used physical
* device (if the network is of type
* bridge/private/vepa/passthrough). This is saved in the
@@ -976,6 +977,9 @@ struct _virDomainNetDef {
* since it needs to be re-allocated whenever the domain
* is restarted. It is also never shown to the user, and
* the user cannot specify it in XML documents.
+ *
+ * This information is populated from the virNetworkPort
+ * object associated with the portid UUID above.
*/
virDomainActualNetDefPtr actual;
} network;
diff --git a/tests/qemuxml2argvdata/net-virtio-network-portgroup.xml b/test=
s/qemuxml2argvdata/net-virtio-network-portgroup.xml
index 54a0eb7229..3d6cd02a73 100644
--- a/tests/qemuxml2argvdata/net-virtio-network-portgroup.xml
+++ b/tests/qemuxml2argvdata/net-virtio-network-portgroup.xml
@@ -24,7 +24,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -43,7 +43,7 @@
-
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list