From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1579880421; cv=none; d=zohomail.com; s=zohoarc; b=Mppf1v4ww1Xmqo1Z427fXuN+UCTuNWQ1IeIDcgOXnSxGlifH6Xp/iiYTHz2jusA6Mt75eOQ5iZHKEWLeg1AanpX8rDxLJVtqn4ft6xSE0UnH3ZflZGWusvJDRoE/4vb4RcnBVCWrSxlsYbvvg74TC6tWnUXT7G9wleyk4cGXTx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579880421; 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=yajKZ20lCUssSiFO1h0BfNqM2a28XCqzenWH7YgnJxc=; b=CCCI1GwZ4PTolbdkdapfBec1JWg8/uAMHGu6WXKP81v3bsvL33saWhotBz/bpvkdN8WT/O2v1TWDk/sJU9Ny333qv/Fufu9q8Gj17V9lHJZ56bPBJGzIDXJ6P+akGy9avvutEuRxFfb7KLCgKa+7tDmUvqR4e4OYfoa+X3bPuwM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1579880421660398.7673768757784; Fri, 24 Jan 2020 07:40:21 -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-424-UJ5oNKVuMv6fry4InBJpzQ-1; Fri, 24 Jan 2020 10:40:17 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AF1690DE3C; Fri, 24 Jan 2020 15:39:34 +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 601198680D; Fri, 24 Jan 2020 15:39:34 +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 0866A18089CD; Fri, 24 Jan 2020 15:39:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdSkd010305 for ; Fri, 24 Jan 2020 10:39:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id D22715C1BB; Fri, 24 Jan 2020 15:39:28 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3901A5C1B0; Fri, 24 Jan 2020 15:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579880420; 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=yajKZ20lCUssSiFO1h0BfNqM2a28XCqzenWH7YgnJxc=; b=ObHJScvvBqo60MAYLMoRLUuxrJBcDktD01QcVXt7i/IjBtnLhhWzojwzSfnNtIepfqMgEs TQDZ8RexsCeOyvaa+Owoo0m5Anc439MQFvBUyAvgYgMSc82mWbVKUWlj9jMNoBG1YC93FI lv/yH3hOS3Z6JTuNMMlTuOw/r6FsBN4= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/6] qemu: add capabilities flag for failover feature Date: Fri, 24 Jan 2020 10:39:16 -0500 Message-Id: <20200124153922.3883568-2-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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.15 X-MC-Unique: UJ5oNKVuMv6fry4InBJpzQ-1 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" Presence of the virtio-net-pci option called "failover" indicates support in a qemu binary of a simplistic bonding of a virtio-net device with another PCI device. This feature allows migration of guests that have a network device assigned to a guest with VFIO, by creating a network bond device in the guest consisting of the VFIO-assigned device and a virtio-net-pci device, then temporarily (and automatically) unplugging the VFIO net device prior to migration (and hotplugging an equivalent device on the migration destination). (The feature is called "failover" because the bond device uses the vfio-pci netdev for normal guest networking, but "fails over" to the virtio-net-pci netdev once the vfio-pci device is unplugged for migration.) Full functioning of the feature also requires support in the virtio-net driver in the guest OS (since that is where the bond device resides), but if the "failover" commandline option is present for the virtio-net-pci device in qemu, at least the qemu part of the feature is available, and libvirt can add the proper options to both the virtio-net-pci and vfio-pci device commandlines to indicate qemu should attempt doing the failover during migration. This patch just adds the qemu capabilities flag "virtio-net.failover". Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- No change from V1. src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + 4 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 498348ad58..a41eb79e48 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -554,6 +554,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "savevm-monitor-nodes", "drive-nvme", "smp-dies", + + /* 350 */ + "virtio-net.failover", ); =20 =20 @@ -1276,6 +1279,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevic= ePropsVirtioNet[] =3D { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSpaprPCIHostBri= dge[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ebcb0d1373..16ca7211a6 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -536,6 +536,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_DRIVE_NVME, /* -drive file.driver=3Dnvme */ QEMU_CAPS_SMP_DIES, /* -smp dies=3D */ =20 + /* 350 */ + QEMU_CAPS_VIRTIO_NET_FAILOVER, /* virtio-net-*.failover */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index 184bb7ff77..6af09e1a83 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -176,6 +176,7 @@ + 4001050 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index afd59a269d..c71791e205 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -219,6 +219,7 @@ + 4002000 0 43100242 --=20 2.24.1 From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1579880467; cv=none; d=zohomail.com; s=zohoarc; b=Pc5bTmrfAnc9j1fDMKrek5VWGfQrAHEjUAL08jRbUMpvEkVlI1WAxvRjUfUGQvv76H6UsmmxyTkSmNXFe5jFy8mzazGvIskRI1oTm7UxSiecLrzflOqVZAeaTmAHLhdANw7iCRf8zWCHZtdbPdkNdoG5CFOSI/gZPdpF00k6NRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579880467; 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=D7pi1T9Uo2YUg/bjhZnzd8E+TT3sUZpAkriHpvHNZ2M=; b=G4eaVHvOGCHaKG/gbIOPb2zcmcire99pkbQwBR9RUDEmitI3Nv347ZTG1w10pdhHmGV4F8UEYVLLcIx/HAN3qIRj3ckD8b2NhDFHZBlS4TbKUMjIdMd/tMNxAHZYcJyvvqmpU/1mVP5X1YZkbAmSS2vzQn27IXexzXQ39RZVye0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1579880467215558.4809193904626; Fri, 24 Jan 2020 07:41:07 -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-183-DMp-6J6PP7C5-GYgqH6pWA-1; Fri, 24 Jan 2020 10:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32CD118A5503; Fri, 24 Jan 2020 15:39:33 +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 0AB75867E2; Fri, 24 Jan 2020 15:39:33 +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 B598285964; Fri, 24 Jan 2020 15:39:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdT5G010310 for ; Fri, 24 Jan 2020 10:39:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id C53695C241; Fri, 24 Jan 2020 15:39:29 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15C5F5C1B0; Fri, 24 Jan 2020 15:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579880466; 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=D7pi1T9Uo2YUg/bjhZnzd8E+TT3sUZpAkriHpvHNZ2M=; b=BdUe+J6ysp4uOrEzkV7SAdr56sYx849R+IBYHZGiF/p9fBICnYEUDSbrp3fXk6H292wCzA ndXy/Fe0jj3dSgHfDxoT41MEEEP54qhLhvfCE84R7OBO8DTln3iy5wKh0dB+quNgwrCpAA Xxh+FOLRYzumSt6nz/dk2G/KYu5GH3c= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/6] conf: parse/format subelement of Date: Fri, 24 Jan 2020 10:39:17 -0500 Message-Id: <20200124153922.3883568-3-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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.15 X-MC-Unique: DMp-6J6PP7C5-GYgqH6pWA-1 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 subelement of devices is used to configure a simple teaming association between two interfaces in a domain. Example:
The interface with is assumed to always be present, while the interface with type=3D'transient' may be be unplugged and later re-plugged; the persistent=3D'blah' attribute (and in the one currently available implementation, also the matching MAC addresses) is what associates the two devices with each other. It is up to the hypervisor and the guest network drivers to determine what to do with this information. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/schemas/domaincommon.rng | 19 ++++++ src/conf/domain_conf.c | 45 +++++++++++++ src/conf/domain_conf.h | 14 ++++ .../net-virtio-teaming-network.xml | 37 +++++++++++ tests/qemuxml2argvdata/net-virtio-teaming.xml | 50 ++++++++++++++ .../net-virtio-teaming-network.xml | 51 ++++++++++++++ .../qemuxml2xmloutdata/net-virtio-teaming.xml | 66 +++++++++++++++++++ tests/qemuxml2xmltest.c | 6 ++ 8 files changed, 288 insertions(+) create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming-network.xml create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming.xml create mode 100644 tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml create mode 100644 tests/qemuxml2xmloutdata/net-virtio-teaming.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 76d94b156f..026e753567 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3158,6 +3158,25 @@ + + + + + + persistent + + + + + transient + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f920d1dc39..ea719e5989 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -554,6 +554,13 @@ VIR_ENUM_IMPL(virDomainNetVirtioTxMode, "timer", ); =20 +VIR_ENUM_IMPL(virDomainNetTeaming, + VIR_DOMAIN_NET_TEAMING_TYPE_LAST, + "none", + "persistent", + "transient", +); + VIR_ENUM_IMPL(virDomainNetInterfaceLinkState, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_LAST, "default", @@ -6276,6 +6283,21 @@ virDomainNetDefValidate(const virDomainNetDef *net) virDomainNetTypeToString(net->type)); return -1; } + + 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; + } + } return 0; } =20 @@ -11574,6 +11596,8 @@ 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))) @@ -11775,6 +11799,10 @@ 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; @@ -12296,6 +12324,17 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, } } =20 + if (teamingType) { + if ((def->teaming.type + =3D virDomainNetTeamingTypeFromString(teamingType)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown teaming type '%s'"), + teamingType); + goto error; + } + } + def->teaming.persistent =3D g_steal_pointer(&teamingPersistent); + rv =3D virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf); if (rv >=3D 0) { def->tune.sndbuf_specified =3D true; @@ -25741,6 +25780,12 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, "\n"); } =20 + if (def->teaming.type !=3D VIR_DOMAIN_NET_TEAMING_TYPE_NONE) { + virBufferAsprintf(buf, "teaming.typ= e)); + virBufferEscapeString(buf, " persistent=3D'%s'", def->teaming.pers= istent); + virBufferAddLit(buf, "/>\n"); + } if (def->linkstate) { virBufferAsprintf(buf, "\n", virDomainNetInterfaceLinkStateTypeToString(def->= linkstate)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6ae89fa498..ee8eb3ddc0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -884,6 +884,15 @@ typedef enum { VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST } virDomainNetVirtioTxModeType; =20 +/* the type of teaming device */ +typedef enum { + VIR_DOMAIN_NET_TEAMING_TYPE_NONE, + VIR_DOMAIN_NET_TEAMING_TYPE_PERSISTENT, + VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT, + + VIR_DOMAIN_NET_TEAMING_TYPE_LAST +} virDomainNetTeamingType; + /* link interface states */ typedef enum { VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT =3D 0, /* Default link= state (up) */ @@ -958,6 +967,10 @@ struct _virDomainNetDef { char *tap; char *vhost; } backend; + struct { + virDomainNetTeamingType type; + char *persistent; /* alias name of persistent device */ + } teaming; union { virDomainChrSourceDefPtr vhostuser; struct { @@ -3425,6 +3438,7 @@ VIR_ENUM_DECL(virDomainFSModel); VIR_ENUM_DECL(virDomainNet); VIR_ENUM_DECL(virDomainNetBackend); VIR_ENUM_DECL(virDomainNetVirtioTxMode); +VIR_ENUM_DECL(virDomainNetTeaming); VIR_ENUM_DECL(virDomainNetInterfaceLinkState); VIR_ENUM_DECL(virDomainNetModel); VIR_ENUM_DECL(virDomainChrDevice); diff --git a/tests/qemuxml2argvdata/net-virtio-teaming-network.xml b/tests/= qemuxml2argvdata/net-virtio-teaming-network.xml new file mode 100644 index 0000000000..edab52f3a1 --- /dev/null +++ b/tests/qemuxml2argvdata/net-virtio-teaming-network.xml @@ -0,0 +1,37 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/net-virtio-teaming.xml b/tests/qemuxml2= argvdata/net-virtio-teaming.xml new file mode 100644 index 0000000000..830ce28524 --- /dev/null +++ b/tests/qemuxml2argvdata/net-virtio-teaming.xml @@ -0,0 +1,50 @@ + + 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-network.xml b/test= s/qemuxml2xmloutdata/net-virtio-teaming-network.xml new file mode 100644 index 0000000000..e0dbeafe02 --- /dev/null +++ b/tests/qemuxml2xmloutdata/net-virtio-teaming-network.xml @@ -0,0 +1,51 @@ + + 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.xml b/tests/qemuxm= l2xmloutdata/net-virtio-teaming.xml new file mode 100644 index 0000000000..5a5695794a --- /dev/null +++ b/tests/qemuxml2xmloutdata/net-virtio-teaming.xml @@ -0,0 +1,66 @@ + + 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 3cefc64833..e54c540ef6 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -451,6 +451,12 @@ mymain(void) DO_TEST("net-eth-unmanaged-tap", NONE); DO_TEST("net-virtio-network-portgroup", NONE); DO_TEST("net-virtio-rxtxqueuesize", NONE); + DO_TEST("net-virtio-teaming", + QEMU_CAPS_VIRTIO_NET_FAILOVER, + QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("net-virtio-teaming-network", + QEMU_CAPS_VIRTIO_NET_FAILOVER, + QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("net-hostdev", NONE); DO_TEST("net-hostdev-bootorder", NONE); DO_TEST("net-hostdev-vfio", QEMU_CAPS_DEVICE_VFIO_PCI); --=20 2.24.1 From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1579880742; cv=none; d=zohomail.com; s=zohoarc; b=Svou1N4Gadh6avsaguk+W1UUa7pQBUtLw5CXBTg9k993yiKdnUXrUZ0CfhRfpJLiMrAdZbqYCIaq75kmOEK9P6jCuANcL/rxiGN7Uozuo8p0o4Ia+DfShstAB/N3tp1BmMykDpuSjLxKJE/mQETlX6m+QpXKXq6Cc97mxPzfvVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579880742; 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=ExvrS/EE4Yt5l1guyBiKTLsS/EJqGRfSDj5O+7qlha8=; b=Bn5lMfiWrEZqcTXXalFcy5zRYOI7lZPkw6ucuJu8e1++b3xy6TbJTXbupb47xka85aTACEAe23FTS5GyinGUGDrev61ELNqoi7t1BvSwOeFVkBZ5XVC5dxoukuvwfgwY3KvNEISRt+1csUpeUxBlTay3IzNPgdrxOeWZL98c/G0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1579880742676337.5726356613794; Fri, 24 Jan 2020 07:45:42 -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-125-4yB0YgGfOR-RqigzLowu7w-1; Fri, 24 Jan 2020 10:45:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CACD90DE3B; Fri, 24 Jan 2020 15:39:37 +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 372E986808; Fri, 24 Jan 2020 15:39:37 +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 EC54485966; Fri, 24 Jan 2020 15:39:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdUiC010320 for ; Fri, 24 Jan 2020 10:39:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F0AE5C1BB; Fri, 24 Jan 2020 15:39:30 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF6985C1B0; Fri, 24 Jan 2020 15:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579880741; 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=ExvrS/EE4Yt5l1guyBiKTLsS/EJqGRfSDj5O+7qlha8=; b=UjIlUM/obLSa6za9MpaFBGVmK3bc0XBsK/kOmtypjITKU+6n2xpEdZ4o/hEK4L3slq8tOu MfjOMhouOWbfE/uyR5dQ/tdAd1lMW/mHZN24arPrMgfKsJXV13DqwrQ0wmnxawkRwMnV9V D8xYDkcXuEdTjjtLkAIry3UI8wQIABU= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/6] qemu: support interface functionality Date: Fri, 24 Jan 2020 10:39:18 -0500 Message-Id: <20200124153922.3883568-4-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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.15 X-MC-Unique: 4yB0YgGfOR-RqigzLowu7w-1 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 QEMU driver uses the element to setup a "failover" pair of devices - the persistent device must be a virtio emulated NIC, with the only extra configuration being the addition of ",failover=3Don" to the device commandline, and the transient device must be a hostdev NIC ( or with a network that is a pool of SRIOV VFs) where the extra configuration is the addition of ",failover_pair_id=3D$aliasOfVirtio" to the device commandline. These new options are supported in QEMU 4.2.0 and later. Extra qemu-specific validation is added to ensure that the device type/model is appropriate and that the qemu binary supports these commandline options. The result of this will be: 1) The virtio device presented to the guest will have an extra bit set in its PCI capabilities indicating that it can be used as a failover backup device. The virtio guest driver will need to be equipped to do something with this information. Unfortunately there is no way for libvirt to learn whether or not the guest driver supports failover - if it doesn't then the extra PCI capability will be ignored and the guest OS will just see two independent devices. (NB: the current virtio guest driver also requires that the MAC addresses of the two NICs match in order to pair them into a bond). 2) When a migration is requested, QEMu will automatically unplug the transient/hostdev NIC from the guest on the source host before starting migration, and automatically re-plug a similar device after restarting the guest CPUs on the destination host. While the transient NIC is unplugged, all network traffic will go through the persistent/virtio device, but when the hostdev NIC is plugged in, it will get all the traffic. This means that in normal circumstances the guest gets the performance advantage of vfio-assigned "real hardware" networking, but it can still be migrated with the only downside being a performance penalty (due to using an emulated NIC) during the migration. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 9 +++++ src/qemu/qemu_domain.c | 36 +++++++++++++++-- .../qemuxml2argvdata/net-virtio-teaming.args | 40 +++++++++++++++++++ tests/qemuxml2argvtest.c | 4 ++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c66b60fd21..63aa10d3af 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3833,6 +3833,8 @@ qemuBuildNicDevStr(virDomainDefPtr def, } virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu); } + if (usingVirtio && net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYP= E_PERSISTENT) + virBufferAddLit(&buf, ",failover=3Don"); =20 virBufferAsprintf(&buf, ",netdev=3Dhost%s", net->info.alias); virBufferAsprintf(&buf, ",id=3D%s", net->info.alias); @@ -4704,6 +4706,13 @@ 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) { + virBufferAsprintf(&buf, ",failover_pair_id=3D%s", + dev->parentnet->teaming.persistent); + } + return virBufferContentAndReset(&buf); } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ce0c5b78cd..6bd5d10f09 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6391,12 +6391,20 @@ qemuDomainValidateActualNetDef(const virDomainNetDe= f *net, return -1; } =20 + if (net->teaming.type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_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'"), + macstr, virDomainNetTypeToString(actualType)); + return -1; + } return 0; } =20 =20 static int -qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net) +qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net, + virQEMUCapsPtr qemuCaps) { bool hasIPv4 =3D false; bool hasIPv6 =3D false; @@ -6481,7 +6489,29 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNe= tDef *net) return -1; } =20 - if (net->coalesce && !qemuDomainNetSupportsCoalesce(net->type)) { + 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->coalesce && !qemuDomainNetSupportsCoalesce(net->type)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("coalesce settings on interface type %s are not s= upported"), virDomainNetTypeToString(net->type)); @@ -8377,7 +8407,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: - ret =3D qemuDomainDeviceDefValidateNetwork(dev->data.net); + ret =3D qemuDomainDeviceDefValidateNetwork(dev->data.net, qemuCaps= ); break; =20 case VIR_DOMAIN_DEVICE_CHR: diff --git a/tests/qemuxml2argvdata/net-virtio-teaming.args b/tests/qemuxml= 2argvdata/net-virtio-teaming.args new file mode 100644 index 0000000000..19e7260843 --- /dev/null +++ b/tests/qemuxml2argvdata/net-virtio-teaming.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 b923590930..4d26fe0b55 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1308,6 +1308,10 @@ mymain(void) QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE); DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE); + DO_TEST("net-virtio-teaming", + QEMU_CAPS_VIRTIO_NET_FAILOVER, + QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST_PARSE_ERROR("net-virtio-teaming", NONE); DO_TEST("net-eth", NONE); DO_TEST("net-eth-ifname", NONE); DO_TEST("net-eth-names", NONE); --=20 2.24.1 From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1579881113; cv=none; d=zohomail.com; s=zohoarc; b=iVoR2myiZf1Enk2JteWVGke9pldn4trnN5NSKdwWryKuHwmgZ9JViEwDOWITJFBCPfurnnG6KEr1re2EI7pnlnmTAGc5zspUH8QD3r56FqxHrqObX7yc/fNwlS3GcrH5WsTNsavDAB9wb8ayLAGvSoS44Bu8LaSaiFTc7DDQw1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579881113; 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=FxK/K1kjht9E527KxxwA6Q80acCxNTuhppc106rXjiY=; b=N7ixVsv1kJDWJ0bmP1Q5u3Y2VtRc2Ro076oyyHUWuOAyeALa/gJy/75LfLUgQjoujDx81JoKFjIqPrmZyZS67hj16PdgAMe3qMiN1nwdTyWV68L7HOAcDY9qSo3JISh89qJARakbrqGJyTnqtJC2n7Vz9IqmR6pfYJ4j8XnKv5M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1579881113418658.0401460452754; Fri, 24 Jan 2020 07:51:53 -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-288-jOL7Nb6vPM2JR39D-dKv0g-1; Fri, 24 Jan 2020 10:51:49 -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 6028510875B9; Fri, 24 Jan 2020 15:39:41 +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 309465C1BB; Fri, 24 Jan 2020 15:39:41 +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 D34A418089CF; Fri, 24 Jan 2020 15:39:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdVN4010330 for ; Fri, 24 Jan 2020 10:39:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4B2F95C1BB; Fri, 24 Jan 2020 15:39:31 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD11C5C1B0; Fri, 24 Jan 2020 15:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579881112; 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=FxK/K1kjht9E527KxxwA6Q80acCxNTuhppc106rXjiY=; b=hUnwFeWyMgn0aytgY7CB0Oh7gp5W3C0lWqIMMI0qrkOG5huT531CTWoVZOf69u56r+BCHv N88gWs/kYDFIZUXrkGrGQHIrHtEcttXqT6mukhHrAEyJ0g7kCHSPH0go1MbO7udZMkqvF4 LK/A/k4FJCkOQ2wAZgCnvfN1qz4GcuY= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/6] qemu: allow migration with assigned PCI hostdev if is set Date: Fri, 24 Jan 2020 10:39:19 -0500 Message-Id: <20200124153922.3883568-5-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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 X-MC-Unique: jOL7Nb6vPM2JR39D-dKv0g-1 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" Normally a PCI hostdev can't be migrated, so qemuMigrationSrcIsAllowedHostdev() won't permit it. In the case of a a hostdev network interface that has set, QEMU will automatically unplug the device prior to migration, and re-plug a corresponding device on the destination. This patch modifies qemuMigrationSrcIsAllowedHostdev() to allow domains with those devices to be migrated. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_migration.c | 52 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 29d228a8d9..46612a3c84 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1093,10 +1093,54 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef= *def) * forbidden. */ for (i =3D 0; i < def->nhostdevs; i++) { virDomainHostdevDefPtr hostdev =3D def->hostdevs[i]; - if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || - hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_USB) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain has assigned non-USB host devices")); + switch ((virDomainHostdevMode)hostdev->mode) { + case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES: + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot migrate a domain with ")); + return false; + + case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: + switch ((virDomainHostdevSubsysType)hostdev->source.subsys.typ= e) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: + /* USB devices can be "migrated" */ + continue; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot migrate a domain with "), + virDomainHostdevSubsysTypeToString(hostdev-= >source.subsys.type)); + return false; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + /* + * if this is a network interface with , migration *is* allowed because + * 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) { + continue; + } + + /* all other PCI hostdevs can't be migrated */ + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot migrate a domain with "), + virDomainHostdevSubsysTypeToString(hostdev-= >source.subsys.type)); + return false; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("invalid hostdev subsystem type")); + return false; + } + break; + + case VIR_DOMAIN_HOSTDEV_MODE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("invalid hostdev mode")); return false; } } --=20 2.24.1 From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1579881105; cv=none; d=zohomail.com; s=zohoarc; b=La8yOBX4YLON0O6dcXBW4F57FuWLIi6FEJIxFaZ8xmVHnh5FOPnkkwQ2uJrl4CvenszZhSyY5vUo3nVg08/XCVSNhTp8IuE5YYtvmdkc8P1k0owDqaiGp6yTChzRXjVWWin6N1dawLfDzbo8oTeZ7Ad4G8T9trJMmGPq037YHn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579881105; 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=cAdN/147LdcTzMfuo1LHESLuMP0W2ygDQvBh67Dc46E=; b=JdTBJmRG8A3FJd//OOrIrJCFZZ5RHNNlgmS+2sD1A7e5YvMWU+uDw8ieQLl5h0otoDumR4yofsywemHlcRo487Et3OjStKtIIno2Tc5hx1pFuGAlwYTFwfZGdl1zCGcSI7kgXgHfud78tT+mzuaV9UkflMglEdmDTGK1fbedOR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579881105854259.43454292587603; Fri, 24 Jan 2020 07:51:45 -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-238-TAPnUs19NISK9-d51GJv0w-1; Fri, 24 Jan 2020 10:51:41 -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 23DA119598BE; Fri, 24 Jan 2020 15:39:47 +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 EDA64857BC; Fri, 24 Jan 2020 15:39:46 +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 A449485965; Fri, 24 Jan 2020 15:39:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdWxF010339 for ; Fri, 24 Jan 2020 10:39:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 221205C1BB; Fri, 24 Jan 2020 15:39:32 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E35C5C1B0; Fri, 24 Jan 2020 15:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579881103; 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=cAdN/147LdcTzMfuo1LHESLuMP0W2ygDQvBh67Dc46E=; b=IcwWCfe1u/DRBHwiVCQ/FOx473b6lmyhqpbHrxZDtCaUQRl6nm4KWTGd+MiZM5/CVR34+X aXVgU9AgMmB1eCT6yAugmt5G9p2RGOne8tEZaZvEGto0Y+BOnbsXQDkddD4Zih0OTrqSxM 5c5f0C5IO4nS0epNxnKFbnDBTZO2Iyw= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 5/6] qemu: add wait-unplug to qemu migration status enum Date: Fri, 24 Jan 2020 10:39:20 -0500 Message-Id: <20200124153922.3883568-6-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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 X-MC-Unique: TAPnUs19NISK9-d51GJv0w-1 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" Aside from itinerant error (actually warning) messages due to an unrecognized response from qemu, this isn't even necessary - the migration proceeds successfully to completion anyway. (I'm not sure where to see this status reported in the API though - do we need to add an extra state, or recognition of a new event somewhere?) Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_migration.c | 1 + src/qemu/qemu_monitor.c | 1 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 1 + 4 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 46612a3c84..b56ccbdc3c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1457,6 +1457,7 @@ qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobIn= fo) case QEMU_MONITOR_MIGRATION_STATUS_SETUP: case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE: case QEMU_MONITOR_MIGRATION_STATUS_CANCELLING: + case QEMU_MONITOR_MIGRATION_STATUS_WAIT_UNPLUG: case QEMU_MONITOR_MIGRATION_STATUS_LAST: break; } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ccd20b3740..4f547bf5ec 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -168,6 +168,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus, "device", "postcopy-active", "completed", "failed", "cancelling", "cancelled", + "wait-unplug", ); =20 VIR_ENUM_IMPL(qemuMonitorVMStatus, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 3f3b81cddd..cca2cdcb27 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -767,6 +767,7 @@ typedef enum { QEMU_MONITOR_MIGRATION_STATUS_ERROR, QEMU_MONITOR_MIGRATION_STATUS_CANCELLING, QEMU_MONITOR_MIGRATION_STATUS_CANCELLED, + QEMU_MONITOR_MIGRATION_STATUS_WAIT_UNPLUG, =20 QEMU_MONITOR_MIGRATION_STATUS_LAST } qemuMonitorMigrationStatus; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e5164d218a..5d8c7e9b5e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3515,6 +3515,7 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr= reply, case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE: case QEMU_MONITOR_MIGRATION_STATUS_SETUP: case QEMU_MONITOR_MIGRATION_STATUS_CANCELLED: + case QEMU_MONITOR_MIGRATION_STATUS_WAIT_UNPLUG: case QEMU_MONITOR_MIGRATION_STATUS_LAST: break; =20 --=20 2.24.1 From nobody Mon May 6 07:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1579880804; cv=none; d=zohomail.com; s=zohoarc; b=eaWiXTbFDyo9j0fTKAmQbrPRm3CSFedfhluI24puceSWxuInqom2Ecz82lD8AVZjFCp99OAOkbrbN+WOcZ6QcVfTsOPhjPvswX8L6dUUVlHM57+kPaUJvZoaSL7GZ8ZonEg7Ty1MoqIzqWfYIiikAkvjWg89oVyZrdxUc3Zs+NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579880804; 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=ZHXWjY9Cptfss1ypO5cjTBhxVCS7E1msfXscv9ObIx8=; b=R0hDPwNr3C3YAUMwIwjYEWSeFLXXmlvNdnfXpB15YPDUfMmznWiiUWa9yoqFOQXlm7GgUVbKZKsG+HBEMhrszUkHbZVpVabEe++yK0EIvpKHAQWV8GleMyJAEVIjFeyQjkUVAXAtgXmeWmn+ubwQhZ5dnPWQjtKqPK7YtZgnbXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1579880804653762.1797945890972; Fri, 24 Jan 2020 07:46:44 -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-109-SyU2zYFFNgu8zVTZfm0uvA-1; Fri, 24 Jan 2020 10:46:41 -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 C9F27DD135; Fri, 24 Jan 2020 15:39:50 +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 A63625C241; Fri, 24 Jan 2020 15:39:50 +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 6191518089CE; Fri, 24 Jan 2020 15:39:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00OFdWN0010352 for ; Fri, 24 Jan 2020 10:39:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id CB4EE5C1BB; Fri, 24 Jan 2020 15:39:32 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-116-187.phx2.redhat.com [10.3.116.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 507085C1B0; Fri, 24 Jan 2020 15:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579880803; 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=ZHXWjY9Cptfss1ypO5cjTBhxVCS7E1msfXscv9ObIx8=; b=HUihOWCYWi2kUafPoNUuNvcZb06JKoBsd7kDu982YfwImFH2fapyN6Js6evBuSOFumd8uH B7kF6egS0S3+q8KrQCzzYx9mVP3s/rc/oSa3Rr5IA1UDct37MpM+6pR5seKvI+ZoBIk+Go W2sCI38Bwqm3jzbx5ugrLlW+uoRBpGk= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 6/6] docs: document subelement Date: Fri, 24 Jan 2020 10:39:21 -0500 Message-Id: <20200124153922.3883568-7-laine@redhat.com> In-Reply-To: <20200124153922.3883568-1-laine@redhat.com> References: <20200124153922.3883568-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Jens Freimann 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 X-MC-Unique: SyU2zYFFNgu8zVTZfm0uvA-1 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" and the QEMU backend implementation using virtio failover. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.html.in | 100 ++++++++++++++++++++++++++++++++++++++ docs/news.xml | 28 +++++++++++ 2 files changed, 128 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4db9c292b7..a1c2a1e392 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5873,6 +5873,106 @@ </devices> ... =20 +
Teaming a virtio/hostdev NIC pair + +

+ Since 6.1.0 (QEMU and KVM only, requires + QEMU 4.2.0 or newer and a guest virtio-net driver supporting + the "failover" feature) + + The <teaming> element of two interfaces can + be used to connect them as a team/bond device in the guest + (assuming proper support in the hypervisor and the guest + network driver). +

+ +
+...
+<devices>
+  <interface type=3D'network'>
+    <source network=3D'mybridge'/>
+    <mac address=3D'00:11:22:33:44:55'/>
+    <model type=3D'virtio'/>
+    <teaming type=3D'persistent'/>
+    <alias name=3D'ua-backup0'/>
+  </interface>
+  <interface type=3D'network'>
+    <source network=3D'hostdev-pool'/>
+    <mac address=3D'00:11:22:33:44:55'/>
+    <model type=3D'virtio'/>
+    <teaming type=3D'transient' persistent=3D'ua-backup0'/>
+  </interface>
+</devices>
+...
+ +

+ The <teaming> 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 removed, then later re-added to the domain. When + type=3D"transient", there should be a second attribute + to <teaming> called "persistent" + - this attribute should be set to the alias name of the other + device in the pair (the one that has <teaming + type=3D"persistent'/>). +

+

+ In the particular case of QEMU, + libvirt's <teaming> element is used to setup + a virtio-net "failover" device pair. For this setup, the + persistent device must be an interface with <model + type=3D"virtio"/>, and the transient device must + be <interface type=3D'hostdev'/> + (or <interface type=3D'network'/> where the + referenced network defines a pool of SRIOV VFs). The guest will + then have a simple network team/bond device made of the virtio + NIC + hostdev NIC pair. In this configuration, the + higher-performing hostdev NIC will normally be preferred for all + network traffic, but when the domain is migrated, QEMU will + automatically unplug the VF from the guest, and then hotplug a + similar device once migration is completed; while migration is + taking place, network traffic will use the virtio NIC. (Of + course the emulated virtio NIC and the hostdev NIC must be + connected to the same subnet for bonding to work properly). +

+

+ 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 configuration (as with all other manually set + alias names, this means it must start with "ua-"). +

+

+ NB2: Currently the only implementation of the guest OS + virtio-net driver supporting virtio-net failover requires that + the MAC addresses of the virtio and hostdev NIC must + match. Since that may not always be a requirement in the future, + libvirt doesn't enforce this limitation - it is up to the + person/management application that is creating the configuration + to assure the MAC addresses of the two devices match. +

+

+ NB3: Since the PCI addresses of the SRIOV VFs on the hosts that + are the source and destination of the migration will almost + certainly be different, either higher level management software + will need to modify the <source> of the + hostdev NIC (<interface type=3D'hostdev'>) at + the start of migration, or (a simpler solution) the + configuration will need to use a libvirt "hostdev" virtual + network that maintains a pool of such devices, as is implied in + the example's use of the libvirt network named "hostdev-pool" - + as long as the hostdev network pools on both hosts have the same + name, libvirt itself will take care of allocating an appropriate + device on both ends of the migration. Similarly the XML for the + virtio interface must also either work correctly unmodified on + both the source and destination of the migration (e.g. by + connecting to the same bridge device on both hosts, or by using + the same virtual network), or the management software must + properly modify the interface XML during migration so that the + virtio device remains connected to the same network segment + before and after migration. +

=20
Multicast tunnel
=20 diff --git a/docs/news.xml b/docs/news.xml index 056c7ef026..7dc9cc18cb 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -44,6 +44,34 @@
+ + + support for virtio+hostdev NIC <teaming> + + + QEMU 4.2.0 and later, combined with a sufficiently recent + guest virtio-net driver, supports setting up a simple + network bond device comprised of one virtio emulated NIC and + one hostdev NIC (which must be an SRIOV VF). (in QEMU, this + is known as the "virtio failover" feature). The allure of + this setup is that the bond will always favor the hostdev + device, providing better performance, until the guest is + migrated - at that time QEMU will automatically unplug the + hostdev NIC and the bond will send all traffic via the + virtio NIC until migration is completed, then QEMU on the + destination side will hotplug a new hostdev NIC and the bond + will switch back to using the hostdev for network + traffic. The result is that guests desiring the extra + performance of a hostdev NIC are now migratable without + network downtime (performance is just degraded during + migration) and without requiring a complicated bonding + configuration in the guest OS network config and complicated + unplug/replug logic in the management application on the + host - it can instead all be accomplished in libvirt with + the interface <teaming> subelement "type" and + "persistent" attributes. + +
--=20 2.24.1