From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1613030344; cv=none; d=zohomail.com; s=zohoarc; b=YohfK9IqOZWxtPmUsgCTGDbrzc6GG2cPC3hUejJ2ezz2xqYlMk4/ZJa4Ldet4u8iBdusumygIxBd6Kr96DvNDxVEtbuxgwOPC/XwwUVUUqHrmiG7eLpuqf1AwrU1U8RzI2OGjGPyXpyUGDGjEsOpJDdo7Kkd9NpAIUnxweBuY38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030344; h=Content-Type:Content-Transfer-Encoding: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=w2DWrxZIxRDSXsetxxq7atpWNxzkWtBJ67+ja/eo0AQ=; b=UlDeTJAiw4gHCMF0UFSDpwQ3gJreYZgt/AsiO2Cgz2t1Z/diUfZvE+Yr0LTrvV1ic81ucxpXw4Wj2fmsGv6VEUSk2SQRVXIdYa7+fC45CkPEhlwi42et9yaCd1yRVxoFMQL/MKQxzNc89+Cg6ss8r9l7QdNLuHf2eGR6PqQTiyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613030343790315.7329461019359; Wed, 10 Feb 2021 23:59:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-sv836NDBOKW9xOXysQvY2A-1; Thu, 11 Feb 2021 02:58:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23CEB100A628; Thu, 11 Feb 2021 07:58:11 +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 F221B7095D; Thu, 11 Feb 2021 07:58:10 +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 BA00D18095CE; Thu, 11 Feb 2021 07:58:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7veoc022712 for ; Thu, 11 Feb 2021 02:57:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1EDB65D9E3; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE0641B479 for ; Thu, 11 Feb 2021 07:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030342; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=w2DWrxZIxRDSXsetxxq7atpWNxzkWtBJ67+ja/eo0AQ=; b=I69gQ9b7bHZab3fNm4RrkH1JveP9EUzOkpDCbXNTmX0XS7ysIu5hGo0fzOLx7Q8lS6Kay8 2WyVsYToI92KNxrBeboGuQyJA/ICLLJO2on5/YPPFTaiFbyyppTw9+dJulzSTRrPGlz06W sJQK7pepWXC2uAJt3Fl68JKIQOgackQ= X-MC-Unique: sv836NDBOKW9xOXysQvY2A-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 1/7] conf: make teaming info an official type Date: Thu, 11 Feb 2021 02:57:28 -0500 Message-Id: <20210211075734.340526-2-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This struct was previously defined only within virDomainNetDef where it was used, but I need to also use it in virDomainHostdevDef, so move the internal struct out to its own "official" struct and give it the standard typedef duo and *Free() function. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 11 +++++++++++ src/conf/domain_conf.h | 12 ++++++++---- src/conf/virconftypes.h | 3 +++ src/libvirt_private.syms | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8f2207bdf6..7d7acb940a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2476,6 +2476,17 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock) } =20 =20 +void +virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming) +{ + if (!teaming) + return; + + g_free(teaming->persistent); + g_free(teaming); +} + + void virDomainNetDefFree(virDomainNetDefPtr def) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8b1c8643be..92fe588b3f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -956,6 +956,11 @@ typedef enum { VIR_DOMAIN_NET_TEAMING_TYPE_LAST } virDomainNetTeamingType; =20 +struct _virDomainNetTeamingInfo { + virDomainNetTeamingType type; + char *persistent; /* alias name of persistent device */ +}; + /* link interface states */ typedef enum { VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT =3D 0, /* Default link= state (up) */ @@ -1033,10 +1038,7 @@ struct _virDomainNetDef { char *tap; char *vhost; } backend; - struct { - virDomainNetTeamingType type; - char *persistent; /* alias name of persistent device */ - } teaming; + virDomainNetTeamingInfo teaming; union { virDomainChrSourceDefPtr vhostuser; struct { @@ -3100,6 +3102,8 @@ void virDomainActualNetDefFree(virDomainActualNetDefP= tr def); virDomainVsockDefPtr virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt); void virDomainVsockDefFree(virDomainVsockDefPtr vsock); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree); +void virDomainNetTeamingInfoFree(virDomainNetTeamingInfoPtr teaming); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetTeamingInfo, virDomainNetTeaming= InfoFree); void virDomainNetDefFree(virDomainNetDefPtr def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetDef, virDomainNetDefFree); void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def); diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index 9042a2b34f..c51241cfa5 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -246,6 +246,9 @@ typedef virDomainNVRAMDef *virDomainNVRAMDefPtr; typedef struct _virDomainNetDef virDomainNetDef; typedef virDomainNetDef *virDomainNetDefPtr; =20 +typedef struct _virDomainNetTeamingInfo virDomainNetTeamingInfo; +typedef virDomainNetTeamingInfo *virDomainNetTeamingInfoPtr; + typedef struct _virDomainOSDef virDomainOSDef; typedef virDomainOSDef *virDomainOSDefPtr; =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 837986845f..affa2df323 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -537,6 +537,7 @@ virDomainNetRemove; virDomainNetRemoveHostdev; virDomainNetResolveActualType; virDomainNetSetModelString; +virDomainNetTeamingInfoFree; virDomainNetTypeFromString; virDomainNetTypeSharesHostView; virDomainNetTypeToString; --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1613030277; cv=none; d=zohomail.com; s=zohoarc; b=TRU6DYOrntBjhU8Coanz1Yb5nNA3RawU13DOxWo0Jow/gS8FGUXqJsubj7N19scWZclpal2sDwJyxCNdJWy6Ee5h4MEeby9b/7i5vfuawm4J6/5xoPHKZgRwsSOJRb5WICnFzk0FeFcslYjm97VXytYv9rWx8KRyhTiVFIoHc60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030277; h=Content-Type:Content-Transfer-Encoding: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=+Ce7r4AY8qvEDMR6ZeK2T1F5S+xR9xMj+jk3cuTJ9OY=; b=ZO1XCnV2cmesQ9BtrF/kisrFm/mEHQS/mUsBgc05yAvn6P/Fh8qpPVBcfKe8sxg7ukFdjKa4vdkU/DcM0oZgdWRY0gg2UqSw09RXjMtdsTyYKwEI2DUU4Htvbkpk4l8DpCbi4XJqPLunaWtI5Dtc5Yn7rLLrG+xpJ4zU7HTvosg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613030277013324.2772616054401; Wed, 10 Feb 2021 23:57:57 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-537-SPe84wXsNryWhog6--NbGQ-1; Thu, 11 Feb 2021 02:57:52 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 48BD8804036; Thu, 11 Feb 2021 07:57:46 +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 D2F975C1BD; Thu, 11 Feb 2021 07:57:43 +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 A934418095CB; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7veC8022718 for ; Thu, 11 Feb 2021 02:57:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 75E5E5D9E8; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40F1B5D9E3 for ; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030274; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+Ce7r4AY8qvEDMR6ZeK2T1F5S+xR9xMj+jk3cuTJ9OY=; b=MDMBtQTf6gGli2bTPXiaJMiE3kCyeE2LY+BGX+Pyc0DoRP/yMGUYJsahbTTo4/ScWLMD4P b44QEq/hjCOOKzuMexL3YJUgL2Xzo6aiZsrohLZINZLA0vMLr1XdL48mZvjV97UzYcLdQ4 e3P1YOXkA6EDJrcWn6P8bwpeTmx9TL4= X-MC-Unique: SPe84wXsNryWhog6--NbGQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 2/7] conf: use virDomainNetTeamingInfoPtr instead of virDomainNetTeamingInfo Date: Thu, 11 Feb 2021 02:57:29 -0500 Message-Id: <20210211075734.340526-3-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To make it easier to split out the parsing/formatting of the element into separate functions (so we can more easily add the element to , change its virDomainNetDef so that it points to a virDomainNetTeamingInfo rather than containing one. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 31 ++++++++++++++++------------ src/conf/domain_conf.h | 2 +- src/conf/domain_validate.c | 26 ++++++++++++----------- src/qemu/qemu_command.c | 10 ++++----- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_migration.c | 4 ++-- src/qemu/qemu_validate.c | 42 ++++++++++++++++++++------------------ 7 files changed, 63 insertions(+), 54 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7d7acb940a..bbf54c90ba 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2542,7 +2542,7 @@ virDomainNetDefFree(virDomainNetDefPtr def) =20 g_free(def->backend.tap); g_free(def->backend.vhost); - g_free(def->teaming.persistent); + virDomainNetTeamingInfoFree(def->teaming); g_free(def->virtPortProfile); g_free(def->script); g_free(def->downscript); @@ -11447,18 +11447,23 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xml= opt, } } =20 - if (teamingType) { - int tmpTeaming; + if (teamingType || teamingPersistent) { + def->teaming =3D g_new0(virDomainNetTeamingInfo, 1); =20 - if ((tmpTeaming =3D virDomainNetTeamingTypeFromString(teamingType)= ) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown teaming type '%s'"), - teamingType); - goto error; + if (teamingType) { + int tmpTeaming; + + if ((tmpTeaming =3D virDomainNetTeamingTypeFromString(teamingT= ype)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown teaming type '%s'"), + teamingType); + goto error; + } + def->teaming->type =3D tmpTeaming; } - def->teaming.type =3D tmpTeaming; + + def->teaming->persistent =3D g_steal_pointer(&teamingPersistent); } - def->teaming.persistent =3D g_steal_pointer(&teamingPersistent); =20 rv =3D virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf); if (rv >=3D 0) { @@ -25825,10 +25830,10 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, "\n"); } =20 - if (def->teaming.type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_NONE) { + if (def->teaming && def->teaming->type !=3D VIR_DOMAIN_NET_TEAMING_TYP= E_NONE) { virBufferAsprintf(buf, "teaming.typ= e)); - virBufferEscapeString(buf, " persistent=3D'%s'", def->teaming.pers= istent); + virDomainNetTeamingTypeToString(def->teaming->ty= pe)); + virBufferEscapeString(buf, " persistent=3D'%s'", def->teaming->per= sistent); virBufferAddLit(buf, "/>\n"); } if (def->linkstate) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 92fe588b3f..fb695a212b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1038,7 +1038,7 @@ struct _virDomainNetDef { char *tap; char *vhost; } backend; - virDomainNetTeamingInfo teaming; + virDomainNetTeamingInfoPtr teaming; union { virDomainChrSourceDefPtr vhostuser; struct { diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b6f53886cd..703946b3e5 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1507,18 +1507,20 @@ virDomainNetDefValidate(const virDomainNetDef *net) return -1; } =20 - if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT) { - if (!net->teaming.persistent) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("teaming persistent attribute must be set if = teaming type is 'transient'")); - return -1; - } - } else { - if (net->teaming.persistent) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("teaming persistent attribute not allowed if = teaming type is '%s'"), - virDomainNetTeamingTypeToString(net->teaming.ty= pe)); - return -1; + if (net->teaming) { + if (net->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIEN= T) { + if (!net->teaming->persistent) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("teaming persistent attribute must be set= if teaming type is 'transient'")); + return -1; + } + } else { + if (net->teaming->persistent) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("teaming persistent attribute not allowed= if teaming type is '%s'"), + virDomainNetTeamingTypeToString(net->teamin= g->type)); + return -1; + } } } =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6b6e0bfc34..09516d407f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3536,7 +3536,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, if (net->mtu) virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu); =20 - if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTEN= T) + if (net->teaming && net->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMI= NG_TYPE_PERSISTENT) virBufferAddLit(&buf, ",failover=3Don"); } =20 @@ -4461,11 +4461,11 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, if (qemuBuildRomStr(&buf, dev->info) < 0) return NULL; =20 - if (dev->parentnet && - dev->parentnet->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TR= ANSIENT && - dev->parentnet->teaming.persistent) { + if (dev->parentnet && dev->parentnet->teaming && + dev->parentnet->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_T= RANSIENT && + dev->parentnet->teaming->persistent) { virBufferAsprintf(&buf, ",failover_pair_id=3D%s", - dev->parentnet->teaming.persistent); + dev->parentnet->teaming->persistent); } =20 return virBufferContentAndReset(&buf); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 53b4fb5f4f..2adf3d2f37 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4458,7 +4458,7 @@ qemuDomainValidateActualNetDef(const virDomainNetDef = *net, return -1; } =20 - if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT && + if (net->teaming && net->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_T= YPE_TRANSIENT && actualType !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("interface %s - teaming transient device must be = type=3D'hostdev', not '%s'"), diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f44d31c971..5d794ab4d0 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1223,8 +1223,8 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *= def) * the device will be auto-unplugged by QEMU during * migration. */ - if (hostdev->parentnet && - hostdev->parentnet->teaming.type =3D=3D VIR_DOMAIN_NET= _TEAMING_TYPE_TRANSIENT) { + if (hostdev->parentnet && hostdev->parentnet->teaming && + hostdev->parentnet->teaming->type =3D=3D VIR_DOMAIN_NE= T_TEAMING_TYPE_TRANSIENT) { continue; } =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a70737327e..45745de289 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1588,26 +1588,28 @@ qemuValidateDomainDeviceDefNetwork(const virDomainN= etDef *net, return -1; } =20 - if (net->teaming.type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_NONE && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio-net failover (teaming) is not supported w= ith this QEMU binary")); - return -1; - } - if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT - && !virDomainNetIsVirtioModel(net)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("virtio-net teaming persistent interface must be = , not '%s'"), - virDomainNetGetModelString(net)); - return -1; - } - if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT && - net->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && - net->type !=3D VIR_DOMAIN_NET_TYPE_NETWORK) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("virtio-net teaming transient interface must be t= ype=3D'hostdev', not '%s'"), - virDomainNetTypeToString(net->type)); - return -1; + if (net->teaming) { + if (net->teaming->type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_NONE && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio-net failover (teaming) is not support= ed with this QEMU binary")); + return -1; + } + if (net->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTE= NT + && !virDomainNetIsVirtioModel(net)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtio-net teaming persistent interface must= be , not '%s'"), + virDomainNetGetModelString(net)); + return -1; + } + if (net->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIEN= T && + net->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && + net->type !=3D VIR_DOMAIN_NET_TYPE_NETWORK) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtio-net teaming transient interface must = be type=3D'hostdev', not '%s'"), + virDomainNetTypeToString(net->type)); + return -1; + } } =20 if (net->coalesce && !qemuValidateNetSupportsCoalesce(net->type)) { --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613030346; cv=none; d=zohomail.com; s=zohoarc; b=AYIig64bfJ1UcesVeph6MsFWo3zphTvMTyIwvK0UTn6GteKqgZoFtLUoVnrVLcKcp5hLXfR+flIdIDlelcmVg5DkILbvbhwnUHb0qd+ZUH/n8UjsL45X9jLWPbLeP7LOu8iYp8JEB2ZevMRXFZ1VvqHkxqy60jFmvF1sUI1/9po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030346; h=Content-Type:Content-Transfer-Encoding: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=ag1ayrGPfZn/8CMo5GLigTZDPqIcsm7pShtlJtRKYHo=; b=Qt0lD3NUq/COCdM1zu4fMMQymH1u3J3wDSDTo7nEqgsiBAvKVbfNr1eL82VI5vhTMeTkCzdl7xBV75KoqBUZ3YFYXpXUQTRfDFVQY/wDJfvBeVkqlpygDl+4zAaVDapH43JRxHmj/YaqyHg53YbV8h2BrofUD4NUfoVAN9pAoWY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613030346799655.3925372250837; Wed, 10 Feb 2021 23:59:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-UpmcA66iMrWpZtsIrj2K9A-1; Thu, 11 Feb 2021 02:58:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08F9E189DF51; Thu, 11 Feb 2021 07:58:15 +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 D6D956F940; Thu, 11 Feb 2021 07:58:14 +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 9D3EB1809C91; Thu, 11 Feb 2021 07:58:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7vega022723 for ; Thu, 11 Feb 2021 02:57:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD69D5D9E8; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 979375D9E3 for ; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030345; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ag1ayrGPfZn/8CMo5GLigTZDPqIcsm7pShtlJtRKYHo=; b=FeyWNhb+F2T+Wrsa8Kl4DKhTzA/W6GqRedGn77kHAnzSKNd/n6YRYvRUXpf1ABZdhfHD7s U98c9M/VHZsh8WOfqRwY8gOSrr7hENgvzRVvDjGyhV02Y/IEBtgwXqtIn6qSMT/bi1e3r9 STZBkfpve9Gg6AldScluUCbW76Y1Tys= X-MC-Unique: UpmcA66iMrWpZtsIrj2K9A-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 3/7] conf: separate Parse/Format functions for virDomainNetTeamingInfo Date: Thu, 11 Feb 2021 02:57:30 -0500 Message-Id: <20210211075734.340526-4-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In preparation for using the same element in two places, split the parsing/formating for that subelement out of the virDomainNetDef functions into their own functions. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 74 +++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bbf54c90ba..3fe8517f39 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10629,6 +10629,34 @@ virDomainChrSourceReconnectDefParseXML(virDomainCh= rSourceReconnectDefPtr def, } =20 =20 +static int +virDomainNetTeamingInfoParseXML(xmlXPathContextPtr ctxt, + virDomainNetTeamingInfoPtr *teaming) +{ + g_autofree char *typeStr =3D virXPathString("string(./teaming/@type)",= ctxt); + g_autofree char *persistentStr =3D virXPathString("string(./teaming/@p= ersistent)", ctxt); + g_autoptr(virDomainNetTeamingInfo) tmpTeaming =3D NULL; + int tmpType; + + if (!typeStr && !persistentStr) + return 0; + + tmpTeaming =3D g_new0(virDomainNetTeamingInfo, 1); + + if ((tmpType =3D virDomainNetTeamingTypeFromString(typeStr)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown teaming type '%s'"), + typeStr); + return -1; + } + + tmpTeaming->type =3D tmpType; + tmpTeaming->persistent =3D g_steal_pointer(&persistentStr); + *teaming =3D g_steal_pointer(&tmpTeaming); + return 0; +} + + static virDomainNetDefPtr virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr node, @@ -10683,8 +10711,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, g_autofree char *vhostuser_type =3D NULL; g_autofree char *trustGuestRxFilters =3D NULL; g_autofree char *vhost_path =3D NULL; - g_autofree char *teamingType =3D NULL; - g_autofree char *teamingPersistent =3D NULL; const char *prefix =3D xmlopt ? xmlopt->config.netPrefix : NULL; =20 if (!(def =3D virDomainNetDefNew(xmlopt))) @@ -10895,10 +10921,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, if (!vhost_path && (tmp =3D virXMLPropString(cur, "vhost")= )) vhost_path =3D virFileSanitizePath(tmp); VIR_FREE(tmp); - } else if (virXMLNodeNameEqual(cur, "teaming") && - !teamingType && !teamingPersistent) { - teamingType =3D virXMLPropString(cur, "type"); - teamingPersistent =3D virXMLPropString(cur, "persistent"); } } cur =3D cur->next; @@ -11447,23 +11469,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, } } =20 - if (teamingType || teamingPersistent) { - def->teaming =3D g_new0(virDomainNetTeamingInfo, 1); - - if (teamingType) { - int tmpTeaming; - - if ((tmpTeaming =3D virDomainNetTeamingTypeFromString(teamingT= ype)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown teaming type '%s'"), - teamingType); - goto error; - } - def->teaming->type =3D tmpTeaming; - } - - def->teaming->persistent =3D g_steal_pointer(&teamingPersistent); - } + if (virDomainNetTeamingInfoParseXML(ctxt, &def->teaming) < 0) + goto error; =20 rv =3D virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf); if (rv >=3D 0) { @@ -25513,6 +25520,19 @@ virDomainChrSourceReconnectDefFormat(virBufferPtr = buf, } =20 =20 +static void +virDomainNetTeamingInfoFormat(virDomainNetTeamingInfoPtr teaming, + virBufferPtr buf) +{ + if (teaming && teaming->type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_NONE) { + virBufferAsprintf(buf, "type)); + virBufferEscapeString(buf, " persistent=3D'%s'", teaming->persiste= nt); + virBufferAddLit(buf, "/>\n"); + } +} + + int virDomainNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, @@ -25830,12 +25850,8 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, "\n"); } =20 - if (def->teaming && def->teaming->type !=3D VIR_DOMAIN_NET_TEAMING_TYP= E_NONE) { - virBufferAsprintf(buf, "teaming->ty= pe)); - virBufferEscapeString(buf, " persistent=3D'%s'", def->teaming->per= sistent); - virBufferAddLit(buf, "/>\n"); - } + virDomainNetTeamingInfoFormat(def->teaming, buf); + if (def->linkstate) { virBufferAsprintf(buf, "\n", virDomainNetInterfaceLinkStateTypeToString(def->= linkstate)); --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613030308; cv=none; d=zohomail.com; s=zohoarc; b=JApYLUHkGGUuZ5AXJZnUWFP0fg9IGYNeV7GsrphmtkSielvFPEdYutpBEElHxC89FUc3szG0x5v5kphlBKOYBciHpQfzLqkwd80CPj9h9ZmVGxayCz04wFe7da7EUfxkaSEm48ouPcqW7ob3BkDpxuuXyE0ogu4XUq1UOOa2lYc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030308; h=Content-Type:Content-Transfer-Encoding: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=PWuxgircaSzhiQKXkLFdOGgTjM8hxrSkptaJF40Bp7E=; b=A5MkFYJ3SFPD5DGZFjV0Vpe0RnNrEJf6hTjJvyd0A5FmUbCyaYLd8aBfqMqOO2urq8i1i+OSNbukycG7NsCNCSEJIi4YtQboTADTd3HKqdyFc4y2AZ7talbALvdAI105iavne2QAeVcG55yLUk8tS6QhfJn5rC53uw/JAs8raCk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613030308516273.5051537098201; Wed, 10 Feb 2021 23:58:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-zwA6dXv-MP6Gw2LRjxVqaA-1; Thu, 11 Feb 2021 02:58:23 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1D19100A614; Thu, 11 Feb 2021 07:58:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE7C260C0F; Thu, 11 Feb 2021 07:58:17 +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 9768F50033; Thu, 11 Feb 2021 07:58:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7vfVB022728 for ; Thu, 11 Feb 2021 02:57:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 308CE5D9E8; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFBFF5D9E3 for ; Thu, 11 Feb 2021 07:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030306; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PWuxgircaSzhiQKXkLFdOGgTjM8hxrSkptaJF40Bp7E=; b=ahWkffx8OpU9v1Wg6tCTp70QwUxvmwUHLnRnUYz7/GP/7Yuikj5x1DzacR7aidJKe5iRk0 GGzr24tVxwcl+VlyGPMDcZIAoQq7XVsjoY1OPu5BySbk6yIT10u34NCT88dIwHg/xEJp12 Kk9M42sU3OFF7J+Thp2F/aqEpUVEqtc= X-MC-Unique: zwA6dXv-MP6Gw2LRjxVqaA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 4/7] schema: separate teaming element definition from interface element Date: Thu, 11 Feb 2021 02:57:31 -0500 Message-Id: <20210211075734.340526-5-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- docs/schemas/domaincommon.rng | 39 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7a2706a4fb..31960fb7cf 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3529,23 +3529,7 @@ - - - - - persistent - - - - - transient - - - - - - - + @@ -3581,6 +3565,27 @@ + + + + + + + persistent + + + + + transient + + + + + + + + + --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613030353; cv=none; d=zohomail.com; s=zohoarc; b=Hw6ukZ1DOCY9S6VV0HZ18wLNqJA0hiM9PoY1IG6NzJrIQNhdJeyUPgeIyMdLCNuUIFDhACQUkR4p6IKdO98Er1i65PzG8+gjcxarYH2QQ6zgZevcF2JDK8jvvwQ8TTJKeh10apnz4uypbswwUenr1Xq6lk2/GZCQyZOQI8q8/vU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030353; h=Content-Type:Content-Transfer-Encoding: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=H81i7nF6gTSciw13tC31soFX6fR5c7t1QDixivOcoxc=; b=MEgfO1C5oG27JVbHuWnpC9hhvHG0s2FB2rRg9QWmo6pszrXXOI7nvFwEc7Opvqk8bzrlixUl2lzDC/mcCXWAgvlNrZ+XK1zTbT1qBnadvxfw4NCixu6dGfpYVi/riP8+PoolsoYlQbgnKNa+A9ZTV72GIF4rAVNyyIaKVZ3XF8g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613030353231227.9270824293909; Wed, 10 Feb 2021 23:59:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-524-NOHf5gI3PGKArqVGklzaYg-1; Thu, 11 Feb 2021 02:57:57 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84B46100A624; Thu, 11 Feb 2021 07:57:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C2BC5C1BD; Thu, 11 Feb 2021 07:57:52 +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 1D65A4EE4D; Thu, 11 Feb 2021 07:57:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7vfMX022737 for ; Thu, 11 Feb 2021 02:57:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9AB415D9E8; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 531B55D9E3 for ; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030352; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=H81i7nF6gTSciw13tC31soFX6fR5c7t1QDixivOcoxc=; b=C9yvWcIzGpVVKOrDCgVt6RVUH5U5sqszecCC+/Dy7xnxIDInY1BTsg61gNJEmyq85DZS4v hFV/qJ3GLLlLfrcScxrB0wf5MSxYUw6ZF6tnPj5j2+kSKePNZ5i8pKBY5kusXSHOwc0XtQ oSVU3CZxDKQuJ1A4r2DqhAoEjLipNWs= X-MC-Unique: NOHf5gI3PGKArqVGklzaYg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 5/7] conf: parse/format element in plain Date: Thu, 11 Feb 2021 02:57:32 -0500 Message-Id: <20210211075734.340526-6-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The element in allows pairing two interfaces together as a simple "failover bond" network device in a guest. One of the devices will be the "transient" interface - it will be preferred for all network traffic when it is present, but may be removed when necessary, in particular during migration, when traffic will instead go through the other interface of the pair - the "persistent" interface. As it happens, in the QEMU implementation of this teaming pair (called "virtio failover" in QEMU) the transient interface is always a host network device assigned to the guest using VFIO (aka "hostdev"); the persistent interface is always an emulated virtio NIC. When support was initially added for , it was written to require that the transient/hostdev device be defined using ; this was done because the virtio failover implementation in QEMU and the virtio guest driver demands that the two interfaces in the pair have matching MAC addresses, and the only way libvirt can guarantee the MAC address of a hostdev network device is to use , whose main purpose is to configure the device's MAC address. (note that in turn requires that the network device be an SRIOV VF (Virtual Function), as that is the only type of network device whose MAC address we can set in a way that will survive the device's driver init in the guest). It has recently come up that some users are unable to use because they are running in a container environment where libvirt doesn't have the necessary privileges or resources to set the VF's MAC address (because setting the VF MAC is done via the same device's PF (Physical Function), and the PF is not exposed to libvirt's container. At the same time, they *are* able to set the VF's MAC address in advance of staring up libvirt in the container. So they could theoretically use the feature if libvirt just skipped the "setting the MAC address" part. Fortunately, that is *exactly* the difference between (a "hostdev VF") and (a "plain hostdev" - it could be *any PCI device; libvirt doesn't know what type of PCI device it is, and doesn't care). But what *is* still needed is for libvirt to provide a small bit of information on the commandline argument for the hostdev, telling QEMU that this device will be part of a team ("failover pair"), and the id of the other device in the pair. So, what we need to do is add support for the element to plain , and that is what this patch does. (actually, this patch adds parsing/formatting of the element in . The next patch will actually wire that into the qemu driver.) Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 51 +++++++++++++++ docs/schemas/domaincommon.rng | 3 + src/conf/domain_conf.c | 5 ++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 19 ++++++ .../net-virtio-teaming-hostdev.xml | 48 ++++++++++++++ .../net-virtio-teaming-hostdev.xml | 64 +++++++++++++++++++ tests/qemuxml2xmltest.c | 3 + 8 files changed, 194 insertions(+) create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming-hostdev.xml create mode 100644 tests/qemuxml2xmloutdata/net-virtio-teaming-hostdev.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 2493be595f..eafd6b3396 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -4837,6 +4837,22 @@ support in the hypervisor and the guest network driv= er). ... =20 +The second interface in this example is referencing a network that is +a pool of SRIOV VFs (i.e. a "hostdev network"). You could instead +directly reference an SRIOV VF device: + +:: + + ... + + +
+ + + + + ... + The ```` element required attribute ``type`` will be set to either ``"persistent"`` to indicate a device that should always be present in the domain, or ``"transient"`` to indicate a device that may periodically be @@ -4858,6 +4874,41 @@ once migration is completed; while migration is taki= ng place, network traffic will use the virtio NIC. (Of course the emulated virtio NIC and the hostde= v NIC must be connected to the same subnet for bonding to work properly). =20 +:since:`Since 7.1.0` The ```` element can also be added to a +plain ```` device. + +:: + + ... + + +
+ + + + + ... + +This device must be a network device, but not necessarily an SRIOV +VF. Using plain ```` rather than ```` or ```` is useful if the +device that will be assigned with VFIO is a standard NIC (not a VF) or +if libvirt doesn't have the necessary resources and privileges to set +the VF's MAC address (e.g. if libvirt is running unprivileged, or in a +container). This of course means that the user (or another +application) is responsible for setting the MAC address of the device +in a way such that it will survive guest driver initialization. For +standard NICs (i.e. not an SRIOV VF) this probably means that the +NIC's factory-programmed MAC address will need to be used for the +teaming pair (since any driver init in the guest will reset the MAC +back to factory). If it is an SRIOV VF, then its MAC address will need +to be set via the VF's PF, e.g. if you are going to use VF 2 of the PF +enp2s0f1, you would use something like this command: + +:: + + ip link set enp2s0f1 vf 2 mac 52:54:00:11:22:33 + NB1: Since you must know the alias name of the virtio NIC when configuring= the hostdev NIC, it will need to be manually set in the virtio NIC's configura= tion (as with all other manually set alias names, this means it must start with diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 31960fb7cf..e6de934456 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5156,6 +5156,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3fe8517f39..8701136aa9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15015,6 +15015,9 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr x= mlopt, } } =20 + if (virDomainNetTeamingInfoParseXML(ctxt, &def->teaming) < 0) + goto error; + return def; =20 error: @@ -27433,6 +27436,8 @@ virDomainHostdevDefFormat(virBufferPtr buf, break; } =20 + virDomainNetTeamingInfoFormat(def->teaming, buf); + if (def->readonly) virBufferAddLit(buf, "\n"); if (def->shareable) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fb695a212b..e263e6098b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -354,6 +354,7 @@ struct _virDomainHostdevDef { virDomainHostdevCaps caps; } source; virDomainHostdevOrigStates origstates; + virDomainNetTeamingInfoPtr teaming; virDomainDeviceInfoPtr info; /* Guest address */ }; =20 diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 703946b3e5..b47ecba86b 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1585,6 +1585,25 @@ virDomainHostdevDefValidate(const virDomainHostdevDe= f *hostdev) break; } } + + if (hostdev->teaming) { + if (hostdev->teaming->type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSI= ENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("teaming hostdev devices must have type=3D'tr= ansient'")); + return -1; + } + if (!hostdev->teaming->persistent) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("missing required persistent attribute in hos= tdev teaming element")); + return -1; + } + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("teaming is only supported for pci hostdev de= vices")); + return -1; + } + } return 0; } =20 diff --git a/tests/qemuxml2argvdata/net-virtio-teaming-hostdev.xml b/tests/= qemuxml2argvdata/net-virtio-teaming-hostdev.xml new file mode 100644 index 0000000000..b176e66a00 --- /dev/null +++ b/tests/qemuxml2argvdata/net-virtio-teaming-hostdev.xml @@ -0,0 +1,48 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/net-virtio-teaming-hostdev.xml b/test= s/qemuxml2xmloutdata/net-virtio-teaming-hostdev.xml new file mode 100644 index 0000000000..a7edab63bd --- /dev/null +++ b/tests/qemuxml2xmloutdata/net-virtio-teaming-hostdev.xml @@ -0,0 +1,64 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + +
+ + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + +
+ + + +
+ + +
+ + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a00ebd7d76..5cd945f28f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -438,6 +438,9 @@ mymain(void) DO_TEST("net-virtio-teaming-network", QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("net-virtio-teaming-hostdev", + QEMU_CAPS_VIRTIO_NET_FAILOVER, + QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST_CAPS_LATEST("net-isolated-port"); DO_TEST("net-hostdev", NONE); DO_TEST("net-hostdev-bootorder", NONE); --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1613030315; cv=none; d=zohomail.com; s=zohoarc; b=JWl2e2Y+KRGYq2ZC/aygGusxKDMkE8FcONo3rRh64Kt3iSLmZdP4cCOydNoPKSMTTPjfD+kTxghrjfnzYWXV/OxsH/fz/q6QYsyA7agcJ4kCwdgHQEVGWpdHVaJF+24vpmU6BrqSvgRKJonKOVJkejG4Z9IK7ikMVLXd+2Yo5Vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030315; h=Content-Type:Content-Transfer-Encoding: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=FCCTRiTAmX/ziUig9nQvdGf9jp6waSjwM87w1tp0u1A=; b=ENxJc+9ffdu/6zQbj+3FPKgzpgH9EY7R2AmwrNXPn5T0pDqkbPo4lBH+dDwY29u3s4o6Ew6mb/YklbWxg8JmgLdPptZ1p3YPh5EWFluMrn9mPGrthNvd1wWjWH1G2hYbdxQDqGCVt5BrZEXVjJGJIm86GK/gLpbNNyXFib8OhsE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161303031504145.10859255239768; Wed, 10 Feb 2021 23:58:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-1HckWmU0M1Sxh5XWkl3o6Q-1; Thu, 11 Feb 2021 02:58:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7FEB80403B; Thu, 11 Feb 2021 07:58:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4E2D6F940; Thu, 11 Feb 2021 07:58:20 +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 6B94457DF9; Thu, 11 Feb 2021 07:58:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7vfCH022747 for ; Thu, 11 Feb 2021 02:57:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id F206C5D9F8; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC0415D9E3 for ; Thu, 11 Feb 2021 07:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030314; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FCCTRiTAmX/ziUig9nQvdGf9jp6waSjwM87w1tp0u1A=; b=CTrl4oxo94++Qo5c4PrJt+VvbbZFJxGunYXv8yr2wQA3GU914GPwnqSTY0fzEkmAumniJ0 BD+n9q8g5mmcDbZYob0VZRKRmHIbWoIdVUnh6nHrHYzd16MSqX3AWRd1dh1OK0gQ4YNUQC JfuJMAtDpo4lkmnwRMul7PtFLUhsrmA= X-MC-Unique: 1HckWmU0M1Sxh5XWkl3o6Q-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 6/7] qemu: plug config from into qemu commandline Date: Thu, 11 Feb 2021 02:57:33 -0500 Message-Id: <20210211075734.340526-7-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 15 ++++--- .../net-virtio-teaming-hostdev.args | 40 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming-hostdev.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 09516d407f..30663c933e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4427,6 +4427,7 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; int backend =3D pcisrc->backend; + virDomainNetTeamingInfoPtr teaming; =20 /* caller has to assign proper passthrough backend type */ switch ((virDomainHostdevSubsysPCIBackendType)backend) { @@ -4461,11 +4462,15 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, if (qemuBuildRomStr(&buf, dev->info) < 0) return NULL; =20 - if (dev->parentnet && dev->parentnet->teaming && - dev->parentnet->teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_T= RANSIENT && - dev->parentnet->teaming->persistent) { - virBufferAsprintf(&buf, ",failover_pair_id=3D%s", - dev->parentnet->teaming->persistent); + if (dev->parentnet) + teaming =3D dev->parentnet->teaming; + else + teaming =3D dev->teaming; + + if (teaming && + teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT && + teaming->persistent) { + virBufferAsprintf(&buf, ",failover_pair_id=3D%s", teaming->persis= tent); } =20 return virBufferContentAndReset(&buf); diff --git a/tests/qemuxml2argvdata/net-virtio-teaming-hostdev.args b/tests= /qemuxml2argvdata/net-virtio-teaming-hostdev.args new file mode 100644 index 0000000000..19e7260843 --- /dev/null +++ b/tests/qemuxml2argvdata/net-virtio-teaming-hostdev.args @@ -0,0 +1,40 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-netdev user,id=3Dhostua-backup0 \ +-device virtio-net-pci,failover=3Don,netdev=3Dhostua-backup0,id=3Dua-backu= p0,\ +mac=3D00:11:22:33:44:55,bus=3Dpci.0,addr=3D0x3 \ +-netdev user,id=3Dhostua-backup1 \ +-device virtio-net-pci,failover=3Don,netdev=3Dhostua-backup1,id=3Dua-backu= p1,\ +mac=3D66:44:33:22:11:00,bus=3Dpci.0,addr=3D0x4 \ +-device vfio-pci,host=3D0000:03:07.1,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x5,\ +failover_pair_id=3Dua-backup0 \ +-device vfio-pci,host=3D0000:03:07.2,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x6,\ +failover_pair_id=3Dua-backup1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x7 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index faa71a7a16..93d6a608bf 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1503,6 +1503,9 @@ mymain(void) QEMU_CAPS_VIRTIO_NET_FAILOVER, QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST_PARSE_ERROR("net-virtio-teaming", NONE); + DO_TEST("net-virtio-teaming-hostdev", + QEMU_CAPS_VIRTIO_NET_FAILOVER, + QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("net-eth", NONE); DO_TEST("net-eth-ifname", NONE); DO_TEST("net-eth-names", NONE); --=20 2.29.2 From nobody Sun May 5 05:44:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613030346; cv=none; d=zohomail.com; s=zohoarc; b=Py7k8jytDvv9qx/YHNSQ+PefDvFO7/gM6deolFuOP3koTNCTC/R7SU64ZaOssIFpKiBpLlH4m2JqsUGd9h5ZzQhfmGF258m5YYst96cgdAjYue1h3IpKOKawFHzi51mDvBiwkHeqGlFZNQMhoYUFgsMjnR/t3AYXGqwliezf1Qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613030346; h=Content-Type:Content-Transfer-Encoding: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=+qm4PaDWZINOuEUOAyj9wP1OHyzHTv/JIyqfx6Wiirw=; b=QJOt5wzFyv82dz4UHX65TKzEzCy8O/RV9NbryLsqFMGPEQq4PSSFJ1pu7H4AAMzQsFYefkhsRIZ0dCZwZUlYULIvFpm35ZX1JU4TYo/vVLvlRJ0CrqhAxyZ3C1qrO48zSr6S7yjxLaHlv3vN7zeEbRc69yShOY29FsYBmDcuW5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613030345959582.8008066107512; Wed, 10 Feb 2021 23:59:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-O_znXSdFP9GmqtjfveWdsA-1; Thu, 11 Feb 2021 02:59:02 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD79F100A61E; Thu, 11 Feb 2021 07:58:21 +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 848581A919; Thu, 11 Feb 2021 07:58:21 +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 4553A1809C92; Thu, 11 Feb 2021 07:58:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11B7vgke022752 for ; Thu, 11 Feb 2021 02:57:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 54FAC5D9E8; Thu, 11 Feb 2021 07:57:42 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E70C5D9E3 for ; Thu, 11 Feb 2021 07:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613030344; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+qm4PaDWZINOuEUOAyj9wP1OHyzHTv/JIyqfx6Wiirw=; b=QHvUhYp8o3m3yX+4sLh0RbjUPouhLkOk+vDFNLJTMqILe/pSggswtJKEaR8Q5YOFte5gYV sJSDdFaNtg+Hpo9gPWJaoFLvtflfghERtAQ/XvqkyS0b5QSB7ok4VZp1z3vB0ATpz3V/ik MXdAaLlLpgMLgInI1OB0g8NDK/NVCTY= X-MC-Unique: O_znXSdFP9GmqtjfveWdsA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 7/7] news: document support for in Date: Thu, 11 Feb 2021 02:57:34 -0500 Message-Id: <20210211075734.340526-8-laine@redhat.com> In-Reply-To: <20210211075734.340526-1-laine@redhat.com> References: <20210211075734.340526-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- NEWS.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index c6ae6a6c60..a9a1a61119 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -35,6 +35,12 @@ v7.1.0 (unreleased) ``virNetworkGetXMLDesc()``, and ``virDomainScreenshot()``, APIs have b= een implemented in the Hyper-V driver. =20 + * Support element in plain devices + + This is useful when libvirt doesn't have the privileges necessary + to set the hostdev device's MAC address (which is a necessary + part of the alternate ). + * **Improvements** =20 * **Bug fixes** --=20 2.29.2