From nobody Sat May 18 08:14:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.124 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=1673237525; cv=none; d=zohomail.com; s=zohoarc; b=PSNUw6WWEMbtNqEaKRDes4VJs5ckJrzLiMlZJES5lUSF+BdSLg1zwyXY+QWgF38ksmVswLAMQvrjwU396cvtsPhLxyRY5It6MQHF509qJKG6FVLc8CqjI3c3GrzP/iar5nVOAebhGunzD7uMhNZwkabtxjWbA26JKdY8AzB0tsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673237525; 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=3dNPnz4WIETZj3V/4yJIIHXObcS68i0G5QW/xMlEk4w=; b=QB69a0mRpdDVF0uPRjPHje790YSnEnAPtjlMPs4AQm1wNIHrdRrlFnrZ8jP/72XVjfd1EuPlsIWmrTW71dPc+UAS++o7WzS/4MP7QkXaTHdtjMgpWSyM1B+bxll4XJ4z014x/9O34r1K7DWNP4zWCas5x/Ita5RogPLr//aJJvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1673237525622675.0598226914766; Sun, 8 Jan 2023 20:12:05 -0800 (PST) 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-479-PkiB8OX3PGeEgijqL-sPfw-1; Sun, 08 Jan 2023 23:11:23 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EFFC810BCD; Mon, 9 Jan 2023 04:11:19 +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 739482166B31; Mon, 9 Jan 2023 04:11:19 +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 1DA37194974B; Mon, 9 Jan 2023 04:11:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A56011946586 for ; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9744D1121318; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 740F41121314; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673237524; 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=3dNPnz4WIETZj3V/4yJIIHXObcS68i0G5QW/xMlEk4w=; b=KEJ7FxyupKozrygbClZfiQ2EPnqXie+TfUxpI5oXVED6QmWWVdnqaR234wJPgQYGK1POd9 piiJTDdjbm/70A29aGDm7a0CfdOQLHzUdaQ3Z63eAJPDGP5qxn6zJx5Bz2HtES4nXvpIa7 wasCyVmiNE/0RxRrtwXLRmUib6X7EjE= X-MC-Unique: PkiB8OX3PGeEgijqL-sPfw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 1/9] conf: rename virDomainNetBackend* to virDomainNetDriver* Date: Sun, 8 Jan 2023 23:11:04 -0500 Message-Id: <20230109041112.368790-2-laine@redhat.com> In-Reply-To: <20230109041112.368790-1-laine@redhat.com> References: <20230109041112.368790-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673237527489100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This fits better with the element containing the value (), and allows us to use virDomainNetBackend* for things in the element. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 8 ++++---- src/conf/domain_conf.h | 14 +++++++------- src/qemu/qemu_interface.c | 8 ++++---- src/security/virt-aa-helper.c | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a180398b14..30b0cef131 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -604,8 +604,8 @@ VIR_ENUM_IMPL(virDomainNetModel, "82543GC", ); =20 -VIR_ENUM_IMPL(virDomainNetBackend, - VIR_DOMAIN_NET_BACKEND_TYPE_LAST, +VIR_ENUM_IMPL(virDomainNetDriver, + VIR_DOMAIN_NET_DRIVER_TYPE_LAST, "default", "qemu", "vhost", @@ -8862,7 +8862,7 @@ virDomainNetDefParseXMLDriver(virDomainNetDef *def, xmlNodePtr guestNode; =20 if (virXMLPropEnum(driver_node, "name", - virDomainNetBackendTypeFromString, + virDomainNetDriverTypeFromString, VIR_XML_PROP_NONZERO, &def->driver.virtio.name) < 0) return -1; @@ -23190,7 +23190,7 @@ virDomainVirtioNetDriverFormat(virBuffer *buf, { if (def->driver.virtio.name) { virBufferAsprintf(buf, " name=3D'%s'", - virDomainNetBackendTypeToString(def->driver.virt= io.name)); + virDomainNetDriverTypeToString(def->driver.virti= o.name)); } if (def->driver.virtio.txmode) { virBufferAsprintf(buf, " txmode=3D'%s'", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c19dfc5470..61d2ee819b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -975,12 +975,12 @@ typedef enum { =20 /* the backend driver used for virtio interfaces */ typedef enum { - VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT =3D 0, /* prefer kernel, fall back= to user */ - VIR_DOMAIN_NET_BACKEND_TYPE_QEMU, /* userland */ - VIR_DOMAIN_NET_BACKEND_TYPE_VHOST, /* kernel */ + VIR_DOMAIN_NET_DRIVER_TYPE_DEFAULT =3D 0, /* prefer kernel, fall back = to user */ + VIR_DOMAIN_NET_DRIVER_TYPE_QEMU, /* userland */ + VIR_DOMAIN_NET_DRIVER_TYPE_VHOST, /* kernel */ =20 - VIR_DOMAIN_NET_BACKEND_TYPE_LAST -} virDomainNetBackendType; + VIR_DOMAIN_NET_DRIVER_TYPE_LAST +} virDomainNetDriverType; =20 /* the TX algorithm used for virtio interfaces */ typedef enum { @@ -1062,7 +1062,7 @@ struct _virDomainNetDef { char *modelstr; union { struct { - virDomainNetBackendType name; /* which driver backend to use */ + virDomainNetDriverType name; /* which driver backend to use */ virDomainNetVirtioTxModeType txmode; virTristateSwitch ioeventfd; virTristateSwitch event_idx; @@ -4020,7 +4020,7 @@ VIR_ENUM_DECL(virDomainFSModel); VIR_ENUM_DECL(virDomainFSCacheMode); VIR_ENUM_DECL(virDomainFSSandboxMode); VIR_ENUM_DECL(virDomainNet); -VIR_ENUM_DECL(virDomainNetBackend); +VIR_ENUM_DECL(virDomainNetDriver); VIR_ENUM_DECL(virDomainNetVirtioTxMode); VIR_ENUM_DECL(virDomainNetMacType); VIR_ENUM_DECL(virDomainNetTeaming); diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 264d5e060c..b6895cedde 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -719,14 +719,14 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm, /* If running a plain QEMU guest, or * if the config says explicitly to not use vhost, return now */ if (vm->def->virtType !=3D VIR_DOMAIN_VIRT_KVM || - net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) + net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_DRIVER_TYPE_QEMU) return 0; =20 /* If qemu doesn't support vhost-net mode (including the -netdev and * -device command options), don't try to open the device. */ if (!qemuDomainSupportsNicdev(vm->def, net)) { - if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_VHO= ST) { + if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_DRIVER_TYPE_VHOS= T) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net is not supported with this QEMU bi= nary")); return -1; @@ -736,7 +736,7 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm, =20 /* If the nic model isn't virtio, don't try to open. */ if (!virDomainNetIsVirtioModel(net)) { - if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_VHO= ST) { + if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_DRIVER_TYPE_VHOS= T) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net is only supported for virtio netwo= rk interfaces")); return -1; @@ -753,7 +753,7 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm, */ if (fd < 0) { virDomainAuditNetDevice(vm->def, net, vhostnet_path, false); - if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE= _VHOST) { + if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_DRIVER_TYPE_= VHOST) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net was requested for an interface= , but is unavailable")); return -1; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 53a1cd1048..62a20ba0e8 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1282,7 +1282,7 @@ get_files(vahControl * ctl) for (i =3D 0; i < ctl->def->nnets; i++) { virDomainNetDef *net =3D ctl->def->nets[i]; if (net && virDomainNetGetModelString(net)) { - if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_= TYPE_QEMU) + if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_DRIVER_T= YPE_QEMU) continue; if (!virDomainNetIsVirtioModel(net)) continue; --=20 2.38.1 From nobody Sat May 18 08:14:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.124 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=1673237487; cv=none; d=zohomail.com; s=zohoarc; b=A2U3gUIhkS+ASChzPsi58JZQQBatPCoH6UTMntrW1bZ6mnwar/2WOlUbw+n4KJv9otlhroBbeWP/urIOLImsLRLYnmivp16GP3yA0yCEc+DlES4/0sGZmiTZImdESzogvZBrFSnxE8PwAh/RDio3WuIuADuTLuYZDMrTgAzueY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673237487; 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=h9E5hMt15yuyoza7gDxp/hbn87hzqBGQ2PtidmLsVLw=; b=Wci1nR3nVr6fgHqLOGn3N/yPlll3o5/9EB3rpw6BvrarxP3DfDnBa1LVKv7J4Tb2y1WbM5+HyJllvBpNiaH7ikmLfXcsOyWdlB0YN24S6hftBmsmHGVoqhN18aKJnRZnqpHDwZFM+HcKjFeBBmsF0e4HeOSkv/En6joquifSOj4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1673237487240173.33100491456912; Sun, 8 Jan 2023 20:11:27 -0800 (PST) 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-321-SgKvZU4TMJWeNh3QZ0RK-Q-1; Sun, 08 Jan 2023 23:11:23 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F3A203C0D1A2; Mon, 9 Jan 2023 04:11:16 +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 DC1482026D37; Mon, 9 Jan 2023 04:11:16 +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 EB1351947B95; Mon, 9 Jan 2023 04:11:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D46571946586 for ; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C56A31121319; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id A20F91121314; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673237486; 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=h9E5hMt15yuyoza7gDxp/hbn87hzqBGQ2PtidmLsVLw=; b=hoZZ5e/XaIBu06eiUBWP9v/CZeTrrsWWRfxmuyPMV5Tljhzlmyr4A/LAfso36Ed2u0Y9J3 N36LqLJYemxO8nlB1+FFBoFLr5Q1HgzXaYzXWkrWPuys7RpohwwDqWWlZfVCIMCmm9hkZ1 yqJqSatHGE0eBv8q3zgZO1xgQPUAk5I= X-MC-Unique: SgKvZU4TMJWeNh3QZ0RK-Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 2/9] conf: move anonymous backend struct from virDomainNetDef into its own struct Date: Sun, 8 Jan 2023 23:11:05 -0500 Message-Id: <20230109041112.368790-3-laine@redhat.com> In-Reply-To: <20230109041112.368790-1-laine@redhat.com> References: <20230109041112.368790-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673237489321100009 Content-Type: text/plain; charset="utf-8"; x-default="true" This will allow us to call parser/formatter functions with a pointer to just the backend part. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.h | 10 ++++++---- src/conf/virconftypes.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 61d2ee819b..e57e70866a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1051,6 +1051,11 @@ struct _virDomainActualNetDef { unsigned int class_id; /* class ID for bandwidth 'floor' */ }; =20 +struct _virDomainNetBackend { + char *tap; + char *vhost; +}; + /* Stores the virtual network interface configuration */ struct _virDomainNetDef { virDomainNetType type; @@ -1089,10 +1094,7 @@ struct _virDomainNetDef { virTristateSwitch rss_hash_report; } virtio; } driver; - struct { - char *tap; - char *vhost; - } backend; + virDomainNetBackend backend; virDomainNetTeamingInfo *teaming; union { virDomainChrSourceDef *vhostuser; diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index 154805091a..7bd9aa8e0a 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -172,6 +172,8 @@ typedef struct _virDomainMomentObjList virDomainMomentO= bjList; =20 typedef struct _virDomainNVRAMDef virDomainNVRAMDef; =20 +typedef struct _virDomainNetBackend virDomainNetBackend; + typedef struct _virDomainNetDef virDomainNetDef; =20 typedef struct _virDomainNetTeamingInfo virDomainNetTeamingInfo; --=20 2.38.1 From nobody Sat May 18 08:14:18 2024 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673237484; cv=none; d=zohomail.com; s=zohoarc; b=SzHhaOyH5J5OTrISKZaevm67FRMwhBDrDTbf9LMR9fyq2BkLbqi4OWZxYilCQbopk1rwo7aT+ASLr1W9KEYGrabHAG3JOOiFzJ4n1x0Yd/9R+JfSZjr3Jmj7Trm9atF3SJshKKdv81GZa8XBodm1ZxhgGZvWcRHt21BXj7Z4U1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673237484; 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=PJoRiSfzuahMEnDd3Q+aykjkflKgpDkriR8u+v0Dqao=; b=Xw9329crlYHtnKlIBhLiikdEAq5BBX4AnMaxi0ZB/yUPvlsdB9Nik7KlYS+p4pOeYNVTn9OlR1kPbw4tmJdBqkK9M6veswkE0GJNTqH5VwdeL5KIrD1IiXUlz3RmGb7t1GLh7IeUN21xJlvrYcRSGj5fyzLTd/DL5uB9BCIMJZY= 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=pass 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 1673237484690980.478326512882; Sun, 8 Jan 2023 20:11:24 -0800 (PST) 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-590-kvZZvSGQOOeXdNKG4wPv1Q-1; Sun, 08 Jan 2023 23:11:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CBCD1C05ED0; Mon, 9 Jan 2023 04:11:16 +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 3358C14152F6; Mon, 9 Jan 2023 04:11:16 +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 E734819459E5; Mon, 9 Jan 2023 04:11:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A97D1946586 for ; Mon, 9 Jan 2023 04:11:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F25FE1121319; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF7901121314; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673237483; 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=PJoRiSfzuahMEnDd3Q+aykjkflKgpDkriR8u+v0Dqao=; b=eKT29+0PsZW9fa84z9CEea6khFJG/kp1ra4TivZF6EHaHkd1BP+lL/l7+iT556Ci7lDY08 rNojUUrivkTKJQ5kEsWmsIWggKF47qRP/kU2DA3UIz4WD1+f632Tiw4my47QxnxmGDRJwl 4eDQ+/WSDmxFICoXh8cDmhrFFCq/tiM= X-MC-Unique: kvZZvSGQOOeXdNKG4wPv1Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 3/9] conf: put interface parsing/formatting separate functions Date: Sun, 8 Jan 2023 23:11:06 -0500 Message-Id: <20230109041112.368790-4-laine@redhat.com> In-Reply-To: <20230109041112.368790-1-laine@redhat.com> References: <20230109041112.368790-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673237485288100003 Content-Type: text/plain; charset="utf-8"; x-default="true" In preparation for adding more stuff to . Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- I wanted virDomainNetBackendParseXML to simply take a virDomainNetBackend*, but there is a test case specifically checking to be sure that backend/vhost isn't parsed if the interface isn't virtio. Silently Ignoring+stripping this during parse is arguably the wrong thing to do - either we should log an error on validation, or we should just leave it in (it's only ever used if the interface is virtio), but that's a problem for another day. (Opinions on the proper thing to do are welcome - since it's currently always stripped out on parse, I *think* I could begin checking for it during validation - there is no way that old code could leave the backend/vhost for a non-virtio interface in any domain xml written to disk. Alternately would could just allow it to be parsed and faithfully format it even when the interface isn't virtio, and not log any error.) src/conf/domain_conf.c | 57 +++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 30b0cef131..9502f2ebab 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8970,6 +8970,26 @@ virDomainNetDefParseXMLDriver(virDomainNetDef *def, } =20 =20 +static int +virDomainNetBackendParseXML(xmlNodePtr node, + virDomainNetDef *def) +{ + g_autofree char *tap =3D virXMLPropString(node, "tap"); + g_autofree char *vhost =3D virXMLPropString(node, "vhost"); + + if (tap) + def->backend.tap =3D virFileSanitizePath(tap); + + if (vhost && + def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && + virDomainNetIsVirtioModel(def)) { + def->backend.vhost =3D virFileSanitizePath(vhost); + } + + return 0; +} + + static int virDomainNetDefParseXMLRequireSource(virDomainNetDef *def, xmlNodePtr source_node) @@ -9016,6 +9036,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, xmlNodePtr mac_node =3D NULL; xmlNodePtr target_node =3D NULL; xmlNodePtr coalesce_node =3D NULL; + xmlNodePtr backend_node =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) int rv; g_autofree char *macaddr =3D NULL; @@ -9319,9 +9340,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, (virNetDevVlanParse(vlan_node, ctxt, &def->vlan) < 0)) return NULL; =20 - if ((tap =3D virXPathString("string(./backend/@tap)", ctxt))) - def->backend.tap =3D virFileSanitizePath(tap); - if ((mac_node =3D virXPathNode("./mac", ctxt))) { if ((macaddr =3D virXMLPropString(mac_node, "address"))) { if (virMacAddrParse((const char *)macaddr, &def->mac) < 0) { @@ -9376,12 +9394,9 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, if (virDomainNetDefParseXMLDriver(def, ctxt) < 0) return NULL; =20 - if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && - virDomainNetIsVirtioModel(def)) { - g_autofree char *vhost =3D virXPathString("string(./backend/@vhost= )", ctxt); - - if (vhost) - def->backend.vhost =3D virFileSanitizePath(vhost); + if ((backend_node =3D virXPathNode("./backend", ctxt)) && + virDomainNetBackendParseXML(backend_node, def) < 0) { + return NULL; } =20 def->linkstate =3D VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; @@ -23255,6 +23270,21 @@ virDomainNetTeamingInfoFormat(virDomainNetTeamingI= nfo *teaming, } =20 =20 +static void +virDomainNetBackendFormat(virBuffer *buf, + virDomainNetBackend *backend) +{ + + if (!(backend->tap || backend->vhost)) + return; + + virBufferAddLit(buf, "tap); + virBufferEscapeString(buf, " vhost=3D'%s'", backend->vhost); + virBufferAddLit(buf, "/>\n"); +} + + int virDomainNetDefFormat(virBuffer *buf, virDomainNetDef *def, @@ -23555,12 +23585,9 @@ virDomainNetDefFormat(virBuffer *buf, virXMLFormatElement(buf, "driver", &driverAttrBuf, &driverChil= dBuf); } } - if (def->backend.tap || def->backend.vhost) { - virBufferAddLit(buf, "backend.tap); - virBufferEscapeString(buf, " vhost=3D'%s'", def->backend.vhost); - virBufferAddLit(buf, "/>\n"); - } + + virDomainNetBackendFormat(buf, &def->backend); + if (def->filter) { if (virNWFilterFormatParamAttributes(buf, def->filterparams, def->filter) < 0) --=20 2.38.1 From nobody Sat May 18 08:14:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.124 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=1673237488; cv=none; d=zohomail.com; s=zohoarc; b=E52Ql6MjLxXiUZ4vku1ASfMDH0NIppF+mKiKYz6GU6Rqks2Fm4BmBDvzBDilDZI9F5FudifFQB7/RIo0Q2HBN9brhtffe07HjGNCnKyl9kozWxcCdJz/bLSGq74LwboC4n5MVmjAm3MleMlmfNvLjEKTAllr8x7PbiYS45sjIaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673237488; 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=kK3cBGX5ws5Y38pt63lw79fm9Ho3n2sWMSiotci/IBg=; b=hkE4TAEQ+s2ot4408DGL485i28+8MuJGRxW2+GgDjsnFQ54pFJCfb5xJBGwwWNZ2Ix+ofk+tr2fgW5/YiIsjG/WrHYKBgZq/M8cJtKpW/lP3OVs/q5tvkjeKwdBha9DJMXSdTuh6AK8X/MGO3VUKTLTt98fG4oaieCsQlgL+b94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1673237488393799.7169319686078; Sun, 8 Jan 2023 20:11:28 -0800 (PST) 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-317-tLO5XSgzMHGmqYDhCLcYHQ-1; Sun, 08 Jan 2023 23:11:23 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8ED29100F90E; Mon, 9 Jan 2023 04:11:16 +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 769CA492B08; Mon, 9 Jan 2023 04:11:16 +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 2C3FC1947B8F; Mon, 9 Jan 2023 04:11:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 35ADC1946586 for ; Mon, 9 Jan 2023 04:11:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2B2EF1121318; Mon, 9 Jan 2023 04:11:14 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0839D1121314; Mon, 9 Jan 2023 04:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673237487; 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=kK3cBGX5ws5Y38pt63lw79fm9Ho3n2sWMSiotci/IBg=; b=Grjkd7VSmQszWP/ljbcNeTWj5nRJFzbgR8CT5z7jqv7YtMGWH/l43fx7UG0kwRgqQsAgXK eZeFO53LYddBODOYIkJOk+oAGTcacLeIH6tO/5VaIa0D/l2P06sthQfEjpG0OJnFr3rEP4 2i7zQUYHSlGI2iwxSeMNuvT38FT753s= X-MC-Unique: tLO5XSgzMHGmqYDhCLcYHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 4/9] conf: add passt XML additions to schema Date: Sun, 8 Jan 2023 23:11:07 -0500 Message-Id: <20230109041112.368790-5-laine@redhat.com> In-Reply-To: <20230109041112.368790-1-laine@redhat.com> References: <20230109041112.368790-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673237489336100011 Content-Type: text/plain; charset="utf-8"; x-default="true" Initial support for network devices using passt (https://passt.top) for the backend connection will require: * new attributes of the subelement: * "type" that can have the value "passt" (to differentiate from slirp, because both slirp and passt will use ) * "logFile" (a path to a file that passt should use for its logging) * "upstream" (a netdev name, e.g. "eth0"). * a new subelement (described in more detail later) Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/conf/schemas/domaincommon.rng | 65 +++++++++++++++++++++++ tests/qemuxml2argvdata/net-user-passt.xml | 57 ++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 tests/qemuxml2argvdata/net-user-passt.xml diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 8bc627d114..0e66b84576 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -3581,6 +3581,7 @@ + @@ -3617,6 +3618,13 @@ + + + + passt + + + @@ -3627,6 +3635,16 @@ + + + + + + + + + + @@ -3843,6 +3861,53 @@ =20 + + + + + + tcp + udp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/net-user-passt.xml b/tests/qemuxml2argv= data/net-user-passt.xml new file mode 100644 index 0000000000..b82eebd089 --- /dev/null +++ b/tests/qemuxml2argvdata/net-user-passt.xml @@ -0,0 +1,57 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +