From nobody Sun May 5 09:07:24 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=1579490699; cv=none;
d=zohomail.com; s=zohoarc;
b=U3vUCEH/8Dkbur43042AMGaG7Mg5L4P0/Rm6nXiz8Cnl5+tVChoV7gKA9DKfYcCnIqe0vpE+jg/+jDX9f24qnNoB+9ZvBqBM+6j1/lBVVbGO8xD6DYn6DHEskZolzixQmNbOhlht5pzZp8pdGkERO1MUnZkL8CgpUeWcJKycpZU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490699;
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=3TF/XizuB2qoU4dfbe/MBaIDVZt/jx7Gv0nmqqR6sj4=;
b=CGRzb8cWMtoC0+IBs1cr1fP7Qv/xEQ1KFXP2iaNxkP+U7FzsUMbj4W0nw1kOdtHmA+7sb+/hoMfu4YtEKVwKlemHNnIfJGHSw2akCFf4rcRwbpWumlee95pNJAkRvohhgr/9IK8a7LdOHA4DESpwQVqNdSMQZZYhDcbpVn1AhV8=
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 1579490699893213.48605698231484;
Sun, 19 Jan 2020 19:24:59 -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-290-mGbzF0kBNCWVFhWJVud5Kw-1; Sun, 19 Jan 2020 22:24:56 -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 80C548010D0;
Mon, 20 Jan 2020 03:24:51 +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 5A0E15C3FA;
Mon, 20 Jan 2020 03:24:51 +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 17A1C81973;
Mon, 20 Jan 2020 03:24:51 +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 00K3OQlg002376 for ;
Sun, 19 Jan 2020 22:24:26 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 5B8C85C299; Mon, 20 Jan 2020 03:24:26 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id AFD475C1BB;
Mon, 20 Jan 2020 03:24:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490698;
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=3TF/XizuB2qoU4dfbe/MBaIDVZt/jx7Gv0nmqqR6sj4=;
b=LJ+7TCpz0nK55Xmcl7LLTktGIilMFnIt7h+O/cgJ6HbwZZNt8mr4RWlKZfZGEXKU2h74tC
+P0Lk2+aiZMYyZ3pnv47qGqOakOhKD9GmmhfC0rc0wXTQmFtjF/lMHG++RxXg3bzQLEyOv
XFubFlv5w0QoT7epSsFe5oQALwQ3gxc=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 01/12] conf: refactor hostdev driver subelement format
for simpler additions
Date: Sun, 19 Jan 2020 22:24:08 -0500
Message-Id: <20200120032419.448310-2-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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: mGbzF0kBNCWVFhWJVud5Kw-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"
This reorganizes with no functional change, to make it easier to see
what is added in an upcoming patch.
(Yes, the "backend !=3D DEFAULT" clause is duplicated in the nested if -
the first is to check if *any* attributes of are present, the
second is checking for this specific attribute; this will be useful
when we add a second attribute).
Signed-off-by: Laine Stump
---
src/conf/domain_conf.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2a8a04cacb..0208d330c3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25022,16 +25022,23 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
=20
if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI =
&&
pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
- const char *backend =3D
- virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend);
=20
- if (!backend) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected pci hostdev driver name type %d"),
- pcisrc->backend);
- return -1;
+ virBufferAddLit(buf, "backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
+ const char *backend =3D
+ virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backe=
nd);
+
+ if (!backend) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected pci hostdev driver name type =
%d"),
+ pcisrc->backend);
+ return -1;
+ }
+ virBufferAsprintf(buf, " name=3D'%s'", backend);
}
- virBufferAsprintf(buf, "\n", backend);
+
+ virBufferAddLit(buf, "/>\n");
}
=20
virBufferAddLit(buf, " (p=none dis=none)
header.from=
Return-Path:
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
[207.211.31.81]) by mx.zohomail.com
with SMTPS id 157949070508850.63148114979617;
Sun, 19 Jan 2020 19:25: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-409-HCqkGvL6MCCLdTSvbdXvWQ-1; Sun, 19 Jan 2020 22:25:01 -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 E8F2B800D5C;
Mon, 20 Jan 2020 03:24:54 +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 BCC8060BF7;
Mon, 20 Jan 2020 03:24:54 +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 7965E18089D8;
Mon, 20 Jan 2020 03:24:54 +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 00K3ORDU002385 for ;
Sun, 19 Jan 2020 22:24:27 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 2BAC15C299; Mon, 20 Jan 2020 03:24:27 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 854FF5C1BB;
Mon, 20 Jan 2020 03:24:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490703;
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=fbD8Br5aMIDioL/8KXQ7sUTdGGQ7TuRzh/XpmDRqt2E=;
b=VX01Tu/kk01Z8NOrX86Fs6P/1GC9DVfBtx0ooCwEzZcsGKlTba9+y1KX9glXNDtVhWMGNX
8bTe7oLkjwNng1Rm5qMmSmRE+snZ1ACZLkQhj5b0sk1qV4KxA6+LHW61uQIXPyuA+ho7AG
XykoL7Ra9XVVBozR3mF6/wFzYr3jptc=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 02/12] conf: change virDomainVirtioNet*Format() to
return void
Date: Sun, 19 Jan 2020 22:24:09 -0500
Message-Id: <20200120032419.448310-3-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.12
X-MC-Unique: HCqkGvL6MCCLdTSvbdXvWQ-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"
All three of these functions could only return 0 anyway, so just get
rid of all the extra red tape.
Signed-off-by: Laine Stump
Reviewed-by: Daniel P. Berrang=C3=A9
---
src/conf/domain_conf.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0208d330c3..69e3b7be9a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25317,7 +25317,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
}
=20
=20
-static int
+static void
virDomainVirtioNetGuestOptsFormat(char **outstr,
virDomainNetDefPtr def)
{
@@ -25345,11 +25345,10 @@ virDomainVirtioNetGuestOptsFormat(char **outstr,
virBufferTrim(&buf, " ", -1);
=20
*outstr =3D virBufferContentAndReset(&buf);
- return 0;
}
=20
=20
-static int
+static void
virDomainVirtioNetHostOptsFormat(char **outstr,
virDomainNetDefPtr def)
{
@@ -25385,11 +25384,10 @@ virDomainVirtioNetHostOptsFormat(char **outstr,
virBufferTrim(&buf, " ", -1);
=20
*outstr =3D virBufferContentAndReset(&buf);
- return 0;
}
=20
=20
-static int
+static void
virDomainVirtioNetDriverFormat(char **outstr,
virDomainNetDefPtr def)
{
@@ -25422,7 +25420,6 @@ virDomainVirtioNetDriverFormat(char **outstr,
virDomainVirtioOptionsFormat(&buf, def->virtio);
=20
*outstr =3D virBufferContentAndReset(&buf);
- return 0;
}
=20
=20
@@ -25696,15 +25693,13 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, "\n",
virDomainNetGetModelString(def));
if (virDomainNetIsVirtioModel(def)) {
- int rc =3D 0;
g_autofree char *str =3D NULL;
g_autofree char *gueststr =3D NULL;
g_autofree char *hoststr =3D NULL;
=20
- if (virDomainVirtioNetDriverFormat(&str, def) < 0 ||
- virDomainVirtioNetGuestOptsFormat(&gueststr, def) < 0 ||
- virDomainVirtioNetHostOptsFormat(&hoststr, def) < 0)
- rc =3D -1;
+ virDomainVirtioNetDriverFormat(&str, def);
+ virDomainVirtioNetGuestOptsFormat(&gueststr, def);
+ virDomainVirtioNetHostOptsFormat(&hoststr, def);
=20
if (!gueststr && !hoststr) {
if (str)
@@ -25722,9 +25717,6 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, " \n");
}
-
- if (rc < 0)
- return -1;
}
}
if (def->backend.tap || def->backend.vhost) {
--=20
2.24.1
From nobody Sun May 5 09:07:24 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=1579490707; cv=none;
d=zohomail.com; s=zohoarc;
b=Cs7F4N/zF68fdSmZ+jIuWP03971NuEw+ODwUFtemi6JFIdXcFkpoYao/MBvQEoPWUEmErvWrAQ2qbfSDnZFsL3rUVxzHk1Lcks3odE4MguTR+i0h59fgQgOG5NP0IXLVuNTayW6S6Dh3J9GXmwRCB/zkx+wqYfNLRgPI35knVH8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490707;
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=SeNtMLHbuu98Jy7QhcK0uPKCKGhRpOrE1eumAlguQm8=;
b=U4U+NJ4v39s3Hj5IdJ/B/43Yos8Q9kBe6yucbUaCPzv/CDkOXL+oPqN3BQAmBdxTEpM7NEj3WXY02ClKgVHDJ02A8KKqkPB5Zuuwurvh3pfQAUU0lHgHAFM4nH5NO1PLR7HUxNj2QF53vt3ztSTCI2VbAPzpggyuyJLDeGjJULo=
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 1579490707131588.2350011357322;
Sun, 19 Jan 2020 19:25: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-358-WvhiiQtOM6-tFs4BQSyKRg-1; Sun, 19 Jan 2020 22:25:04 -0500
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FD92DB2F;
Mon, 20 Jan 2020 03:24:58 +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 673215D9E5;
Mon, 20 Jan 2020 03:24:58 +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 2236281979;
Mon, 20 Jan 2020 03:24:58 +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 00K3OSa4002390 for ;
Sun, 19 Jan 2020 22:24:28 -0500
Received: by smtp.corp.redhat.com (Postfix)
id F2FC35C299; Mon, 20 Jan 2020 03:24:27 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 567045C1BB;
Mon, 20 Jan 2020 03:24:27 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490706;
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=SeNtMLHbuu98Jy7QhcK0uPKCKGhRpOrE1eumAlguQm8=;
b=X8IbpI3ZLA5hUKfMH0V2VfpTXsDoSGXBKyWrtXxdQEobuBNnvrKFVhswW3wN3eMSqh25Ds
hX1xRwjR/RnLPW02qfKIP8d5bE5eU4WrgWCFQQOhP72leHKm4PXq5sfUARCMZfye4JfN3y
amWz18f+i6I3NvoNaQf8z9Y7BZpl43U=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 03/12] conf: rename two static functions
Date: Sun, 19 Jan 2020 22:24:10 -0500
Message-Id: <20200120032419.448310-4-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.14
X-MC-Unique: WvhiiQtOM6-tFs4BQSyKRg-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"
Adding Driver to the names makes them better fit their purpose.
Signed-off-by: Laine Stump
Reviewed-by: Daniel P. Berrang=C3=A9
---
src/conf/domain_conf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 69e3b7be9a..58f4a1c14b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25318,8 +25318,8 @@ virDomainActualNetDefFormat(virBufferPtr buf,
=20
=20
static void
-virDomainVirtioNetGuestOptsFormat(char **outstr,
- virDomainNetDefPtr def)
+virDomainVirtioNetDriverGuestOptsFormat(char **outstr,
+ virDomainNetDefPtr def)
{
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
if (def->driver.virtio.guest.csum) {
@@ -25349,8 +25349,8 @@ virDomainVirtioNetGuestOptsFormat(char **outstr,
=20
=20
static void
-virDomainVirtioNetHostOptsFormat(char **outstr,
- virDomainNetDefPtr def)
+virDomainVirtioNetDriverHostOptsFormat(char **outstr,
+ virDomainNetDefPtr def)
{
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
if (def->driver.virtio.host.csum) {
@@ -25698,8 +25698,8 @@ virDomainNetDefFormat(virBufferPtr buf,
g_autofree char *hoststr =3D NULL;
=20
virDomainVirtioNetDriverFormat(&str, def);
- virDomainVirtioNetGuestOptsFormat(&gueststr, def);
- virDomainVirtioNetHostOptsFormat(&hoststr, def);
+ virDomainVirtioNetDriverGuestOptsFormat(&gueststr, def);
+ virDomainVirtioNetDriverHostOptsFormat(&hoststr, def);
=20
if (!gueststr && !hoststr) {
if (str)
--=20
2.24.1
From nobody Sun May 5 09:07:24 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=1579490712; cv=none;
d=zohomail.com; s=zohoarc;
b=RteGZ1Q5LAo7JET7z/r5mk0J5jAMJ0Qw9J7Qr74Z3GAI1zUFhPpSRwVS3iAidMsjQMF+JJ3QC5ZtgjQU4CyWZ9zKZGTpqKv0dRcX1ynSw9jIkXaO89NZJB41VLgIvR0CEnAt+Y8PvGIEEEl1D+tV6A+spUlAhqUCCRjXMkGHvh0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490712;
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=QvLPrSK/7gPRKPN2S0yhjrmif/fdx63qClarLduiOJk=;
b=dynsWhHN47FXSwSHSfmvAjiNOGUoYyYq3TYrYoxSb2fWJmMJ/VE54tfB3BHMW+gbm26RsymKcLTzJDoh00ons3FHxpKRifpq7Wa5jwgC1nVe0MOaJnAh0G4h/ngtJbOYawb/iIGcjIJr8eTCsMDX1oroWzPzdNdLDETIA1qaBKE=
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 1579490712214879.2526582962595;
Sun, 19 Jan 2020 19:25:12 -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-132-4C8576nTO06b_3oA68OT_Q-1; Sun, 19 Jan 2020 22:25:08 -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 4BE5A800C79;
Mon, 20 Jan 2020 03:25:02 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 11067272A1;
Mon, 20 Jan 2020 03:25:02 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9D08B180887A;
Mon, 20 Jan 2020 03:25:01 +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 00K3OSMp002401 for ;
Sun, 19 Jan 2020 22:24:28 -0500
Received: by smtp.corp.redhat.com (Postfix)
id DA3A85C299; Mon, 20 Jan 2020 03:24:28 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2A4065C1BB;
Mon, 20 Jan 2020 03:24:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490711;
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=QvLPrSK/7gPRKPN2S0yhjrmif/fdx63qClarLduiOJk=;
b=gAM4ECe16eRzpylAUeVABwwhPZq+Dt4alHU6XHpyBHa+iyIeFhA46KLIdn256VPOvPJ3Zk
3sQOG8RM2zi1pmO8iUoUT1rTuRdWiXtJitWC2K417uD+MYTALbH1NaKVwjnA+/4SafR/Wl
hnjFboFDBbCXWnB6wiZ3MZkzukpWQYU=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 04/12] conf: refactor 's
subelement parse/format
Date: Sun, 19 Jan 2020 22:24:11 -0500
Message-Id: <20200120032419.448310-5-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.84 on 10.5.11.23
X-MC-Unique: 4C8576nTO06b_3oA68OT_Q-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"
Until now the subelement of was only
parsed/used/formatted if the device model was "virtio". Making the
driver member of the data object a struct instead of a union and
refactoring the parsing/formatting code in this separate patch will
make it easier to see exactly what is being added when an upcoming
patch adds an attribute to that will be present/parsed
regardless of whether or not the device model is "virtio".
Signed-off-by: Laine Stump
---
src/conf/domain_conf.c | 443 +++++++++++++++++++++--------------------
src/conf/domain_conf.h | 52 ++---
2 files changed, 254 insertions(+), 241 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 58f4a1c14b..1379ae1600 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12059,205 +12059,210 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr x=
mlopt,
if (ifname_guest_actual !=3D NULL)
def->ifname_guest_actual =3D g_steal_pointer(&ifname_guest_actual);
=20
- if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV &&
- virDomainNetIsVirtioModel(def)) {
- if (backend !=3D NULL) {
- if ((val =3D virDomainNetBackendTypeFromString(backend)) < 0 ||
- val =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown interface "
- "has been specified"),
- backend);
- goto error;
- }
- def->driver.virtio.name =3D val;
- }
- if (txmode !=3D NULL) {
- if ((val =3D virDomainNetVirtioTxModeTypeFromString(txmode)) <=
0 ||
- val =3D=3D VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown interface =
"
- "has been specified"),
- txmode);
- goto error;
- }
- def->driver.virtio.txmode =3D val;
- }
- if (ioeventfd) {
- if ((val =3D virTristateSwitchTypeFromString(ioeventfd)) <=3D =
0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown interface ioeventfd mode '%s'"),
- ioeventfd);
- goto error;
- }
- def->driver.virtio.ioeventfd =3D val;
- }
- if (event_idx) {
- if ((val =3D virTristateSwitchTypeFromString(event_idx)) <=3D =
0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown interface event_idx mode '%s'"),
- event_idx);
- goto error;
- }
- def->driver.virtio.event_idx =3D val;
- }
- if (queues) {
- unsigned int q;
- if (virStrToLong_uip(queues, NULL, 10, &q) < 0) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("'queues' attribute must be positive numb=
er: %s"),
- queues);
- goto error;
- }
- if (q > 1)
- def->driver.virtio.queues =3D q;
- }
- if (rx_queue_size) {
- unsigned int q;
- if (virStrToLong_uip(rx_queue_size, NULL, 10, &q) < 0) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("'rx_queue_size' attribute must be positi=
ve number: %s"),
- rx_queue_size);
- goto error;
- }
- def->driver.virtio.rx_queue_size =3D q;
- }
- if (tx_queue_size) {
- unsigned int q;
- if (virStrToLong_uip(tx_queue_size, NULL, 10, &q) < 0) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("'tx_queue_size' attribute must be positi=
ve number: %s"),
- tx_queue_size);
- goto error;
- }
- def->driver.virtio.tx_queue_size =3D q;
- }
-
- if ((tmpNode =3D virXPathNode("./driver/host", ctxt))) {
- if ((str =3D virXMLPropString(tmpNode, "csum"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
+ if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+ /*
+ * the subelement of has
+ * already been parsed by virDomainHostdevDefParseXMLSubsys()
+ */
+ if (virDomainNetIsVirtioModel(def)) {
+ if (backend !=3D NULL) {
+ if ((val =3D virDomainNetBackendTypeFromString(backend)) <=
0 ||
+ val =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host csum mode '%s'"),
- str);
+ _("Unknown interface "
+ "has been specified"),
+ backend);
goto error;
}
- def->driver.virtio.host.csum =3D val;
+ def->driver.virtio.name =3D val;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "gso"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
+ if (txmode !=3D NULL) {
+ if ((val =3D virDomainNetVirtioTxModeTypeFromString(txmode=
)) < 0 ||
+ val =3D=3D VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host gso mode '%s'"),
- str);
+ _("Unknown interface "
+ "has been specified"),
+ txmode);
goto error;
}
- def->driver.virtio.host.gso =3D val;
+ def->driver.virtio.txmode =3D val;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "tso4"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
+ if (ioeventfd) {
+ if ((val =3D virTristateSwitchTypeFromString(ioeventfd)) <=
=3D 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host tso4 mode '%s'"),
- str);
+ _("unknown interface ioeventfd mode '%s=
'"),
+ ioeventfd);
goto error;
}
- def->driver.virtio.host.tso4 =3D val;
+ def->driver.virtio.ioeventfd =3D val;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "tso6"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
+ if (event_idx) {
+ if ((val =3D virTristateSwitchTypeFromString(event_idx)) <=
=3D 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host tso6 mode '%s'"),
- str);
+ _("unknown interface event_idx mode '%s=
'"),
+ event_idx);
goto error;
}
- def->driver.virtio.host.tso6 =3D val;
+ def->driver.virtio.event_idx =3D val;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "ecn"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host ecn mode '%s'"),
- str);
+ if (queues) {
+ unsigned int q;
+ if (virStrToLong_uip(queues, NULL, 10, &q) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'queues' attribute must be positive =
number: %s"),
+ queues);
goto error;
}
- def->driver.virtio.host.ecn =3D val;
+ if (q > 1)
+ def->driver.virtio.queues =3D q;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "ufo"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host ufo mode '%s'"),
- str);
+ if (rx_queue_size) {
+ unsigned int q;
+ if (virStrToLong_uip(rx_queue_size, NULL, 10, &q) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'rx_queue_size' attribute must be po=
sitive number: %s"),
+ rx_queue_size);
goto error;
}
- def->driver.virtio.host.ufo =3D val;
+ def->driver.virtio.rx_queue_size =3D q;
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "mrg_rxbuf"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host mrg_rxbuf mode '%s'"),
- str);
+ if (tx_queue_size) {
+ unsigned int q;
+ if (virStrToLong_uip(tx_queue_size, NULL, 10, &q) < 0) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("'tx_queue_size' attribute must be po=
sitive number: %s"),
+ tx_queue_size);
goto error;
}
- def->driver.virtio.host.mrg_rxbuf =3D val;
+ def->driver.virtio.tx_queue_size =3D q;
}
- VIR_FREE(str);
- }
=20
- if ((tmpNode =3D virXPathNode("./driver/guest", ctxt))) {
- if ((str =3D virXMLPropString(tmpNode, "csum"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown guest csum mode '%s'"),
- str);
- goto error;
+ if ((tmpNode =3D virXPathNode("./driver/host", ctxt))) {
+ if ((str =3D virXMLPropString(tmpNode, "csum"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host csum mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.csum =3D val;
}
- def->driver.virtio.guest.csum =3D val;
- }
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "tso4"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown guest tso4 mode '%s'"),
- str);
- goto error;
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "gso"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host gso mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.gso =3D val;
}
- def->driver.virtio.guest.tso4 =3D val;
- }
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "tso6"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown guest tso6 mode '%s'"),
- str);
- goto error;
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "tso4"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host tso4 mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.tso4 =3D val;
}
- def->driver.virtio.guest.tso6 =3D val;
- }
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "ecn"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown guest ecn mode '%s'"),
- str);
- goto error;
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "tso6"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host tso6 mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.tso6 =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "ecn"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host ecn mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.ecn =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "ufo"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host ufo mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.ufo =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "mrg_rxbuf"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host mrg_rxbuf mode '%s'=
"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.host.mrg_rxbuf =3D val;
}
- def->driver.virtio.guest.ecn =3D val;
+ VIR_FREE(str);
}
- VIR_FREE(str);
- if ((str =3D virXMLPropString(tmpNode, "ufo"))) {
- if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)=
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown guest ufo mode '%s'"),
- str);
- goto error;
+
+ if ((tmpNode =3D virXPathNode("./driver/guest", ctxt))) {
+ if ((str =3D virXMLPropString(tmpNode, "csum"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown guest csum mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.guest.csum =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "tso4"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown guest tso4 mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.guest.tso4 =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "tso6"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown guest tso6 mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.guest.tso6 =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "ecn"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown guest ecn mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.guest.ecn =3D val;
+ }
+ VIR_FREE(str);
+ if ((str =3D virXMLPropString(tmpNode, "ufo"))) {
+ if ((val =3D virTristateSwitchTypeFromString(str)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown guest ufo mode '%s'"),
+ str);
+ goto error;
+ }
+ def->driver.virtio.guest.ufo =3D val;
}
- def->driver.virtio.guest.ufo =3D val;
}
+ def->backend.vhost =3D g_steal_pointer(&vhost_path);
}
- def->backend.vhost =3D g_steal_pointer(&vhost_path);
}
=20
def->linkstate =3D VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
@@ -25388,36 +25393,40 @@ virDomainVirtioNetDriverHostOptsFormat(char **out=
str,
=20
=20
static void
-virDomainVirtioNetDriverFormat(char **outstr,
- virDomainNetDefPtr def)
+virDomainNetDriverAttributesFormat(char **outstr,
+ virDomainNetDefPtr def)
{
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
- if (def->driver.virtio.name) {
- virBufferAsprintf(&buf, " name=3D'%s'",
- virDomainNetBackendTypeToString(def->driver.virt=
io.name));
- }
- if (def->driver.virtio.txmode) {
- virBufferAsprintf(&buf, " txmode=3D'%s'",
- virDomainNetVirtioTxModeTypeToString(def->driver=
.virtio.txmode));
- }
- if (def->driver.virtio.ioeventfd) {
- virBufferAsprintf(&buf, " ioeventfd=3D'%s'",
- virTristateSwitchTypeToString(def->driver.virtio=
.ioeventfd));
- }
- if (def->driver.virtio.event_idx) {
- virBufferAsprintf(&buf, " event_idx=3D'%s'",
- virTristateSwitchTypeToString(def->driver.virtio=
.event_idx));
- }
- if (def->driver.virtio.queues)
- virBufferAsprintf(&buf, " queues=3D'%u'", def->driver.virtio.queue=
s);
- if (def->driver.virtio.rx_queue_size)
- virBufferAsprintf(&buf, " rx_queue_size=3D'%u'",
- def->driver.virtio.rx_queue_size);
- if (def->driver.virtio.tx_queue_size)
- virBufferAsprintf(&buf, " tx_queue_size=3D'%u'",
- def->driver.virtio.tx_queue_size);
=20
- virDomainVirtioOptionsFormat(&buf, def->virtio);
+ if (virDomainNetIsVirtioModel(def)) {
+
+ if (def->driver.virtio.name) {
+ virBufferAsprintf(&buf, " name=3D'%s'",
+ virDomainNetBackendTypeToString(def->driver.=
virtio.name));
+ }
+ if (def->driver.virtio.txmode) {
+ virBufferAsprintf(&buf, " txmode=3D'%s'",
+ virDomainNetVirtioTxModeTypeToString(def->dr=
iver.virtio.txmode));
+ }
+ if (def->driver.virtio.ioeventfd) {
+ virBufferAsprintf(&buf, " ioeventfd=3D'%s'",
+ virTristateSwitchTypeToString(def->driver.vi=
rtio.ioeventfd));
+ }
+ if (def->driver.virtio.event_idx) {
+ virBufferAsprintf(&buf, " event_idx=3D'%s'",
+ virTristateSwitchTypeToString(def->driver.vi=
rtio.event_idx));
+ }
+ if (def->driver.virtio.queues)
+ virBufferAsprintf(&buf, " queues=3D'%u'", def->driver.virtio.q=
ueues);
+ if (def->driver.virtio.rx_queue_size)
+ virBufferAsprintf(&buf, " rx_queue_size=3D'%u'",
+ def->driver.virtio.rx_queue_size);
+ if (def->driver.virtio.tx_queue_size)
+ virBufferAsprintf(&buf, " tx_queue_size=3D'%u'",
+ def->driver.virtio.tx_queue_size);
+
+ virDomainVirtioOptionsFormat(&buf, def->virtio);
+ }
=20
*outstr =3D virBufferContentAndReset(&buf);
}
@@ -25454,6 +25463,9 @@ virDomainNetDefFormat(virBufferPtr buf,
char macstr[VIR_MAC_STRING_BUFLEN];
g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER;
const char *prefix =3D xmlopt ? xmlopt->config.netPrefix : NULL;
+ g_autofree char *driverstr =3D NULL;
+ g_autofree char *gueststr =3D NULL;
+ g_autofree char *hoststr =3D NULL;
=20
/* publicActual is true if we should report the current state in
* def->data.network.actual *instead of* the config (*not* in
@@ -25692,33 +25704,32 @@ virDomainNetDefFormat(virBufferPtr buf,
if (virDomainNetGetModelString(def)) {
virBufferEscapeString(buf, "\n",
virDomainNetGetModelString(def));
- if (virDomainNetIsVirtioModel(def)) {
- g_autofree char *str =3D NULL;
- g_autofree char *gueststr =3D NULL;
- g_autofree char *hoststr =3D NULL;
+ }
=20
- virDomainVirtioNetDriverFormat(&str, def);
- virDomainVirtioNetDriverGuestOptsFormat(&gueststr, def);
- virDomainVirtioNetDriverHostOptsFormat(&hoststr, def);
+ virDomainNetDriverAttributesFormat(&driverstr, def);
=20
- if (!gueststr && !hoststr) {
- if (str)
- virBufferAsprintf(buf, " \n", str);
- } else {
- if (str)
- virBufferAsprintf(buf, "\n", str);
- else
- virBufferAddLit(buf, "\n");
- virBufferAdjustIndent(buf, 2);
- if (hoststr)
- virBufferAsprintf(buf, " \n", hoststr);
- if (gueststr)
- virBufferAsprintf(buf, " \n", gueststr);
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, " \n");
- }
- }
+ if (virDomainNetIsVirtioModel(def)) {
+ virDomainVirtioNetDriverGuestOptsFormat(&gueststr, def);
+ virDomainVirtioNetDriverHostOptsFormat(&hoststr, def);
+ }
+
+ if (!gueststr && !hoststr) {
+ if (driverstr)
+ virBufferAsprintf(buf, " \n", driverstr);
+ } else {
+ if (driverstr)
+ virBufferAsprintf(buf, "\n", driverstr);
+ else
+ virBufferAddLit(buf, "\n");
+ virBufferAdjustIndent(buf, 2);
+ if (hoststr)
+ virBufferAsprintf(buf, " \n", hoststr);
+ if (gueststr)
+ virBufferAsprintf(buf, " \n", gueststr);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, " \n");
}
+
if (def->backend.tap || def->backend.vhost) {
virBufferAddLit(buf, "backend.tap);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6ae89fa498..5a44113681 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -927,32 +927,34 @@ struct _virDomainNetDef {
bool mac_generated; /* true if mac was *just now* auto-generated by li=
bvirt */
int model; /* virDomainNetModelType */
char *modelstr;
- union {
- struct {
- virDomainNetBackendType name; /* which driver backend to use */
- virDomainNetVirtioTxModeType txmode;
- virTristateSwitch ioeventfd;
- virTristateSwitch event_idx;
- unsigned int queues; /* Multiqueue virtio-net */
- unsigned int rx_queue_size;
- unsigned int tx_queue_size;
- struct {
- virTristateSwitch csum;
- virTristateSwitch gso;
- virTristateSwitch tso4;
- virTristateSwitch tso6;
- virTristateSwitch ecn;
- virTristateSwitch ufo;
- virTristateSwitch mrg_rxbuf;
- } host;
+ struct {
+ union {
struct {
- virTristateSwitch csum;
- virTristateSwitch tso4;
- virTristateSwitch tso6;
- virTristateSwitch ecn;
- virTristateSwitch ufo;
- } guest;
- } virtio;
+ virDomainNetBackendType name; /* which driver backend to u=
se */
+ virDomainNetVirtioTxModeType txmode;
+ virTristateSwitch ioeventfd;
+ virTristateSwitch event_idx;
+ unsigned int queues; /* Multiqueue virtio-net */
+ unsigned int rx_queue_size;
+ unsigned int tx_queue_size;
+ struct {
+ virTristateSwitch csum;
+ virTristateSwitch gso;
+ virTristateSwitch tso4;
+ virTristateSwitch tso6;
+ virTristateSwitch ecn;
+ virTristateSwitch ufo;
+ virTristateSwitch mrg_rxbuf;
+ } host;
+ struct {
+ virTristateSwitch csum;
+ virTristateSwitch tso4;
+ virTristateSwitch tso6;
+ virTristateSwitch ecn;
+ virTristateSwitch ufo;
+ } guest;
+ } virtio;
+ };
} driver;
struct {
char *tap;
--=20
2.24.1
From nobody Sun May 5 09:07:24 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=1579490716; cv=none;
d=zohomail.com; s=zohoarc;
b=ItRFeAy1RhfDiHUd9jB+AltPnkCKms7c7Uahnbe0Uu3rnJ2d8pCBx/J43M8C9U6a2EJFdibBf0DBH3EDMJChygCMsq2BfbyDV6bsjoU7cUQ7VcIunWq7dJzdtnEDj+L4MAgxKNutBBiOjASvYcLl97PeIB9o4LasizZFCsyA/BE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490716;
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=ladilKElM2Yi+iKLYAVSVbGAuhFKJHjiHjY2kSYHDVc=;
b=mgnblzM94a1euJxRQSK+/DvaY2wgPCdAA3U6XAbjEiso1QVuKMZBEbK+R1qcI8EH0of8sPuIbVbSTPyIBwrNxz336cjnmUmuwV3O8kgSuzstbQpIIcxVqDHzM3cg3WBXn6VwyQ8INoQTPhkysKhuFYcbD0es+0Y27gaDx7MZ20E=
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 1579490716388608.6208958524201;
Sun, 19 Jan 2020 19:25:16 -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-92-2ohEN9R-MXOM2nPSmJfVeQ-1; Sun, 19 Jan 2020 22:25:12 -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 C5C291084431;
Mon, 20 Jan 2020 03:25:07 +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 961F5399;
Mon, 20 Jan 2020 03:25:07 +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 44A9481974;
Mon, 20 Jan 2020 03:25:07 +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 00K3OVEl002416 for ;
Sun, 19 Jan 2020 22:24:31 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8857B5C299; Mon, 20 Jan 2020 03:24:31 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id E1B925C1BB;
Mon, 20 Jan 2020 03:24:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490715;
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=ladilKElM2Yi+iKLYAVSVbGAuhFKJHjiHjY2kSYHDVc=;
b=jONrx49yNyVLDY6voGjoo9CtFkKKDNSRvTbqPyC8zzjwoyYWUhyGW+jsSqgeFjfxHcV0NT
+SxnQ6wApPzmX3U75K8+d9s5ITCNuQAdh2lNTBUriaxzjbIAyPvyHrZurK41Gzs2szTISM
KVOs3CzfHLFkd/7rCUT2EMySwTPAuJ8=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 05/12] qemu: add capabilities flag for failover
feature
Date: Sun, 19 Jan 2020 22:24:12 -0500
Message-Id: <20200120032419.448310-6-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.84 on 10.5.11.23
X-MC-Unique: 2ohEN9R-MXOM2nPSmJfVeQ-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
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 +
4 files changed, 5 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 84c62a4e28..15943b4a45 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -553,6 +553,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"blockdev-file-dynamic-auto-read-only",
"savevm-monitor-nodes",
"drive-nvme",
+ "virtio-net.failover",
);
=20
=20
@@ -1275,6 +1276,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 193c19fc81..2beee3e839 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -534,6 +534,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for =
syntax-check */
QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC, /* the auto-read-only prop=
erty of block backends for files is dynamic */
QEMU_CAPS_SAVEVM_MONITOR_NODES, /* 'savevm' handles monitor-owned node=
s properly */
QEMU_CAPS_DRIVE_NVME, /* -drive file.driver=3Dnvme */
+ QEMU_CAPS_VIRTIO_NET_FAILOVER, /* virtio-net-*.failover */
=20
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu=
capabilitiesdata/caps_4.2.0.aarch64.xml
index a6469073fd..536092e1f1 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -175,6 +175,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 4857e2f5a5..35f601dc5d 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -218,6 +218,7 @@
+
4002000
0
43100242
--=20
2.24.1
From nobody Sun May 5 09:07:24 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=1579490685; cv=none;
d=zohomail.com; s=zohoarc;
b=Uk9hsryL62prUKmfo3Nct6HmrPpOfg1QNNLyBMJcPgOcXN4/OVznvpoxBV2pklPUSfqIdkx16fEhQW0YEgaYxG0kc1R4J1+DBwbKi2SMU5N+RAuZdONue4j6duyAp3lPiI/azxUh6hZnLjx4+RhzYLNGhfthx2bCkegDTiA0LUI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490685;
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=SgHChoTzSM5cnqZEmFV2KayfPvbHNO/9aqtCWT6dtSk=;
b=CXmolgSz9N84mbaGbk8miBJVg0DR/VcD26EYwD0kye8PpdodfWF8Z1C5HS6uof9+EaHc/yuLkaYFo8Qm7IqLvyq0hH2sq6TQ1XSnY2UR4quDp/OzZhM62TBvXUuv544Vp6Z7/071X/R3TqfJ4EX+lQtQhGxFIK7CQuoqIDPYpYY=
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 1579490685125651.3132299644191;
Sun, 19 Jan 2020 19:24: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-114-SbDp9UCYPX2dvWW_X0XQzA-1; Sun, 19 Jan 2020 22:24:41 -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 5F7FBDB20;
Mon, 20 Jan 2020 03:24:36 +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 BDD6E60C05;
Mon, 20 Jan 2020 03:24:35 +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 CBE0418089CD;
Mon, 20 Jan 2020 03:24:33 +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 00K3OWDs002429 for ;
Sun, 19 Jan 2020 22:24:32 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 601B15C299; Mon, 20 Jan 2020 03:24:32 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id B59205C1BB;
Mon, 20 Jan 2020 03:24:31 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490683;
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=SgHChoTzSM5cnqZEmFV2KayfPvbHNO/9aqtCWT6dtSk=;
b=CbPA51TKk86yU7UVe2ETBlhkPBmSbaH2z8H1a/aw3MXZ/syY125UMNoCqHFG9icN+4KgvI
7dpEzWYWT0jfKcfuU1xlfqLf0HNhuG7Yos0IlUxXfHt5DrulyG8S1fWsHHmWXDKJe8gJel
ICbGeAhDQKsP16++IFF33cMfXKmIQ3c=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 06/12] conf: add failover attribute to
subelement of
Date: Sun, 19 Jan 2020 22:24:13 -0500
Message-Id: <20200120032419.448310-7-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.12
X-MC-Unique: SbDp9UCYPX2dvWW_X0XQzA-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"
This attribute is only used for virtio-net devices, so it is stored in
the virtio part of the anonymous union in virDomainNetDef::driver. An
example of the new option:
The corresponding qemu commandline option can only be set if the qemu
binary supports it, so we check for the qemu capability before adding
it.
Signed-off-by: Laine Stump
---
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 15 ++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 3 ++
src/qemu/qemu_domain.c | 12 ++++-
.../qemuxml2argvdata/net-virtio-failover.args | 36 +++++++++++++
.../qemuxml2argvdata/net-virtio-failover.xml | 36 +++++++++++++
tests/qemuxml2argvtest.c | 3 ++
.../net-virtio-failover.xml | 50 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
10 files changed, 161 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/net-virtio-failover.args
create mode 100644 tests/qemuxml2argvdata/net-virtio-failover.xml
create mode 100644 tests/qemuxml2xmloutdata/net-virtio-failover.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 76d94b156f..80aea47e36 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3050,6 +3050,11 @@
[
]
+
+
+ [
+ ]
+
[
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1379ae1600..29636617a2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11558,6 +11558,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
g_autofree char *txmode =3D NULL;
g_autofree char *ioeventfd =3D NULL;
g_autofree char *event_idx =3D NULL;
+ g_autofree char *failover =3D NULL;
g_autofree char *queues =3D NULL;
g_autofree char *rx_queue_size =3D NULL;
g_autofree char *tx_queue_size =3D NULL;
@@ -11729,6 +11730,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
txmode =3D virXMLPropString(cur, "txmode");
ioeventfd =3D virXMLPropString(cur, "ioeventfd");
event_idx =3D virXMLPropString(cur, "event_idx");
+ failover =3D virXMLPropString(cur, "failover");
queues =3D virXMLPropString(cur, "queues");
rx_queue_size =3D virXMLPropString(cur, "rx_queue_size");
tx_queue_size =3D virXMLPropString(cur, "tx_queue_size");
@@ -12105,6 +12107,15 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
}
def->driver.virtio.event_idx =3D val;
}
+ if (failover) {
+ if ((val =3D virTristateSwitchTypeFromString(failover)) <=
=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown interface failover setting '=
%s'"),
+ failover);
+ goto error;
+ }
+ def->driver.virtio.failover =3D val;
+ }
if (queues) {
unsigned int q;
if (virStrToLong_uip(queues, NULL, 10, &q) < 0) {
@@ -25416,6 +25427,10 @@ virDomainNetDriverAttributesFormat(char **outstr,
virBufferAsprintf(&buf, " event_idx=3D'%s'",
virTristateSwitchTypeToString(def->driver.vi=
rtio.event_idx));
}
+ if (def->driver.virtio.failover) {
+ virBufferAsprintf(&buf, " failover=3D'%s'",
+ virTristateSwitchTypeToString(def->driver.vi=
rtio.failover));
+ }
if (def->driver.virtio.queues)
virBufferAsprintf(&buf, " queues=3D'%u'", def->driver.virtio.q=
ueues);
if (def->driver.virtio.rx_queue_size)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 5a44113681..af9691d62b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -934,6 +934,7 @@ struct _virDomainNetDef {
virDomainNetVirtioTxModeType txmode;
virTristateSwitch ioeventfd;
virTristateSwitch event_idx;
+ virTristateSwitch failover;
unsigned int queues; /* Multiqueue virtio-net */
unsigned int rx_queue_size;
unsigned int tx_queue_size;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 904d2beab5..d3c0cc0506 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3834,6 +3834,9 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu);
}
=20
+ if (usingVirtio && net->driver.virtio.failover =3D=3D VIR_TRISTATE_SWI=
TCH_ON)
+ virBufferAddLit(&buf, ",failover=3Don");
+
virBufferAsprintf(&buf, ",netdev=3Dhost%s", net->info.alias);
virBufferAsprintf(&buf, ",id=3D%s", net->info.alias);
virBufferAsprintf(&buf, ",mac=3D%s",
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a6dde15bad..6f45d74bde 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6396,7 +6396,8 @@ qemuDomainValidateActualNetDef(const virDomainNetDef =
*net,
=20
=20
static int
-qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
+qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net,
+ virQEMUCapsPtr qemuCaps)
{
bool hasIPv4 =3D false;
bool hasIPv6 =3D false;
@@ -6471,6 +6472,13 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNe=
tDef *net)
_("tx_queue_size has to be a power of two"));
return -1;
}
+
+ if (net->driver.virtio.failover =3D=3D VIR_TRISTATE_SWITCH_ON &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio-net failover is not supported with th=
is QEMU binary"));
+ return -1;
+ }
}
=20
if (net->mtu &&
@@ -8377,7 +8385,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-failover.args b/tests/qemuxm=
l2argvdata/net-virtio-failover.args
new file mode 100644
index 0000000000..da41e19628
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-virtio-failover.args
@@ -0,0 +1,36 @@
+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 virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x5
diff --git a/tests/qemuxml2argvdata/net-virtio-failover.xml b/tests/qemuxml=
2argvdata/net-virtio-failover.xml
new file mode 100644
index 0000000000..1f545b8d73
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-virtio-failover.xml
@@ -0,0 +1,36 @@
+]
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219100
+ 219100
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i386
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 58b4deefc6..c4fbe321d8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1308,6 +1308,9 @@ 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-failover",
+ QEMU_CAPS_VIRTIO_NET_FAILOVER);
+ DO_TEST_PARSE_ERROR("net-virtio-failover", NONE);
DO_TEST("net-eth", NONE);
DO_TEST("net-eth-ifname", NONE);
DO_TEST("net-eth-names", NONE);
diff --git a/tests/qemuxml2xmloutdata/net-virtio-failover.xml b/tests/qemux=
ml2xmloutdata/net-virtio-failover.xml
new file mode 100644
index 0000000000..7895c03dd7
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/net-virtio-failover.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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3cefc64833..326e49fbcd 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -451,6 +451,8 @@ 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-failover",
+ QEMU_CAPS_VIRTIO_NET_FAILOVER);
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 Sun May 5 09:07:24 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=1579490684; cv=none;
d=zohomail.com; s=zohoarc;
b=j5J93gnTs2lBFg7J+OVwAdLQIpaR8TMmp0p3u/TNIkmwola8FYAX9n+bqyrVcVfaSrSx8DCPNeQoq95XLUifqXnJ5ZfNauMpvKI+iyoWYbN5jhRdFone7S7apLYlhtZ1Xyv1VZTRwZqvAXlwqqd/RASXI7rQ4/lCRWq/2fzQnX8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490684;
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=f4nOzZWUY7sceuQ6KiPs75hQyerRFdWE0OYWGUDMQbM=;
b=GXdWAxf+25VMlthpHoEp5sbB2qGaoIhof4cdrNlapbnIteLWDzCh3KezEtDrFZcXi/71a+TLzXFtGRdnkxWag9GJmRoU3NTaAQLqwbv34DKG/SjEkfXbgwdOOgrKj9xCP3qkfZC8Tne21+WovCmYxCQL3ZcWWfT2nJb+KcsZ/Ng=
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 1579490684830353.18567446653924;
Sun, 19 Jan 2020 19:24: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-423-eCdUbKWxOAeEORMsp6VtIw-1; Sun, 19 Jan 2020 22:24:41 -0500
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58599107ACC7;
Mon, 20 Jan 2020 03:24:36 +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 B8E765D9D6;
Mon, 20 Jan 2020 03:24:35 +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 0E09481969;
Mon, 20 Jan 2020 03:24: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 00K3OXQw002435 for ;
Sun, 19 Jan 2020 22:24:33 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 343B45C299; Mon, 20 Jan 2020 03:24:33 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8AF845C1BB;
Mon, 20 Jan 2020 03:24:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490683;
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=f4nOzZWUY7sceuQ6KiPs75hQyerRFdWE0OYWGUDMQbM=;
b=Ku0stEOKpa2OVDxk4jfIyjIDxTpPDKFfKH9H4eEJzHzkoGKEjuUfnhugYd2X1PJKY7O7mi
MMCxh12+skoL8Ml4LaQIhUMkN3m690tztekOTwa1Wf8zRYUzC1VwFPGx2C0mK7bMM9Ae4J
azkuCnfJrZnTfGxGaq7PezpqIqnXleo=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 07/12] qemu: add backupAlias attribute to
subelement of hostdev devices
Date: Sun, 19 Jan 2020 22:24:14 -0500
Message-Id: <20200120032419.448310-8-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.14
X-MC-Unique: eCdUbKWxOAeEORMsp6VtIw-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 new attribute backupAlias gives the alias name ("id" in
QEMU parlance) of the virtio-net device that will be paired in the
guest with a vfio-pci device for "failover" when the vfio-pci device
is unplugged (e.g. during migration).
This patch adds backupAlias for (which has
its stored in the child virDomainHostdevDef); an upcoming
patch will handle the case of when the
network is a pool of SRIOV VFs (in that case the subelement
is stored in the virDomainNetDef).
Since a MAC address must be set for the hostdev in order for the
failover to work (a current guest driver limitation is that the MAC
addresses of the two devices must match), and that isn't possible with
plain , backupAlias is prohibited by validation in the case
of a plain .
An example usage:
QEMU will internally associate these two devices, and will
automatically unplug the hostdev at the start of any migration, and
re-plug a new device on the destination when migration is complete (it
is up to the guest virtio driver to handle bonding the two devices).
Signed-off-by: Laine Stump
---
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 16 ++++++++++++++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_domain.c | 6 ++++++
.../qemuxml2argvdata/net-virtio-failover.args | 6 +++++-
tests/qemuxml2argvdata/net-virtio-failover.xml | 14 ++++++++++++++
tests/qemuxml2argvtest.c | 3 ++-
.../qemuxml2xmloutdata/net-virtio-failover.xml | 18 +++++++++++++++++-
tests/qemuxml2xmltest.c | 3 ++-
10 files changed, 68 insertions(+), 6 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 80aea47e36..e0977d28d3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3002,6 +3002,11 @@
+
+
+ [
+ ]
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 29636617a2..e0e47415ed 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2941,8 +2941,10 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr=
def)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
VIR_FREE(def->source.subsys.u.scsi_host.wwpn);
break;
- case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+ VIR_FREE(def->source.subsys.u.pci.backupAlias);
+ break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
@@ -6360,6 +6362,12 @@ virDomainHostdevDefValidate(const virDomainHostdevDe=
f *hostdev)
"'unassigned' address type"));
return -1;
}
+ if (hostdev->source.subsys.u.pci.backupAlias &&
+ !hostdev->parentnet) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("backupAlias is not supported for plain <=
hostdev> - is required"));
+ return -1;
+ }
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO=
NE &&
@@ -8410,6 +8418,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
}
pcisrc->backend =3D backend;
=20
+ pcisrc->backupAlias =3D virXPathString("string(./driver/@backupAli=
as)", ctxt);
break;
=20
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
@@ -25037,7 +25046,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi;
=20
if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI =
&&
- pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
+ (pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT ||
+ pcisrc->backupAlias)) {
=20
virBufferAddLit(buf, "backupAl=
ias);
+
virBufferAddLit(buf, "/>\n");
}
=20
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index af9691d62b..0bf1d2b6bf 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -235,6 +235,7 @@ struct _virDomainHostdevSubsysUSB {
struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
+ char *backupAlias; /* alias id of backup virtio device for failover */
};
=20
struct _virDomainHostdevSubsysSCSIHost {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d3c0cc0506..82a95e2474 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4706,6 +4706,8 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
return NULL;
if (qemuBuildRomStr(&buf, dev->info) < 0)
return NULL;
+ if (pcisrc->backupAlias)
+ virBufferAsprintf(&buf, ",failover_pair_id=3D%s", pcisrc->backupAl=
ias);
=20
return virBufferContentAndReset(&buf);
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6f45d74bde..d32a3c0935 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6664,6 +6664,12 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHo=
stdevDef *hostdev,
return -1;
}
}
+ if (hostdev->source.subsys.u.pci.backupAlias &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio-net failover / hostdev backupAlia=
s is not supported with this QEMU binary"));
+ return -1;
+ }
break;
=20
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
diff --git a/tests/qemuxml2argvdata/net-virtio-failover.args b/tests/qemuxm=
l2argvdata/net-virtio-failover.args
index da41e19628..19e7260843 100644
--- a/tests/qemuxml2argvdata/net-virtio-failover.args
+++ b/tests/qemuxml2argvdata/net-virtio-failover.args
@@ -33,4 +33,8 @@ 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 virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x5
+-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/qemuxml2argvdata/net-virtio-failover.xml b/tests/qemuxml=
2argvdata/net-virtio-failover.xml
index 1f545b8d73..99ac37013a 100644
--- a/tests/qemuxml2argvdata/net-virtio-failover.xml
+++ b/tests/qemuxml2argvdata/net-virtio-failover.xml
@@ -31,6 +31,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c4fbe321d8..411393a55a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1309,7 +1309,8 @@ mymain(void)
QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE);
DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
DO_TEST("net-virtio-failover",
- QEMU_CAPS_VIRTIO_NET_FAILOVER);
+ QEMU_CAPS_VIRTIO_NET_FAILOVER,
+ QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST_PARSE_ERROR("net-virtio-failover", NONE);
DO_TEST("net-eth", NONE);
DO_TEST("net-eth-ifname", NONE);
diff --git a/tests/qemuxml2xmloutdata/net-virtio-failover.xml b/tests/qemux=
ml2xmloutdata/net-virtio-failover.xml
index 7895c03dd7..9c73a3bee7 100644
--- a/tests/qemuxml2xmloutdata/net-virtio-failover.xml
+++ b/tests/qemuxml2xmloutdata/net-virtio-failover.xml
@@ -41,10 +41,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 326e49fbcd..c91690a030 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -452,7 +452,8 @@ mymain(void)
DO_TEST("net-virtio-network-portgroup", NONE);
DO_TEST("net-virtio-rxtxqueuesize", NONE);
DO_TEST("net-virtio-failover",
- QEMU_CAPS_VIRTIO_NET_FAILOVER);
+ 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 Sun May 5 09:07:24 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=1579490702; cv=none;
d=zohomail.com; s=zohoarc;
b=LJTw4FYo4e7KscKKJEizeyw+1TddxeO+3egdXYymK4oGMY8KnuaaldEIOf30nGRKScIwhd62uaKwJ1pqrzriitw/oIV92DKoPZNgovlQx0PpPj22BrvtQhT4MaLaLksyUwBafDyEAN/x/NveT5kv/qjmCxpmVNarvqDSKLZnA5Y=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490702;
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=TyeFcmMtgvNuO30VbmD+a936CnjgLV3jABw0DNm18cI=;
b=h389rpnuQASkZbhJp6qDq+10uxW3VbvDCInWsH3Ur/HP0ALHohAz8XPFMTD6VaGshdVkGkcQouU7MgpNcABg3cx2l4kKr3o8O7dfu13XcbxITAR1EhDFsiiIN47CZb8D9t+uUHvwrohjZvES76AcrB1iID+y1cLgRiC+Ig/WA5c=
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 1579490702690850.2262108954815;
Sun, 19 Jan 2020 19:25:02 -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-185-klaUCY5GPPqwiH3PisMNrw-1; Sun, 19 Jan 2020 22:24:59 -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 45ABF107ACC7;
Mon, 20 Jan 2020 03:24:54 +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 1E8DF39A;
Mon, 20 Jan 2020 03:24:54 +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 D316B18089D6;
Mon, 20 Jan 2020 03:24:53 +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 00K3OYY6002440 for ;
Sun, 19 Jan 2020 22:24:34 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 06FF95C299; Mon, 20 Jan 2020 03:24:34 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 5F17D5C1BB;
Mon, 20 Jan 2020 03:24:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490701;
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=TyeFcmMtgvNuO30VbmD+a936CnjgLV3jABw0DNm18cI=;
b=KAgtDLeSusXXOOOg9NOra2l+PUhrM6hlUq2QJJCNOQRsk4umT8MOJKgCRpuASmu5Pr02ut
QphZJMKMAhAgSBLln8CJ0HlDzn0qBoeOhI/Zr6VRNFw+xU4upzyJrc3IQek3235F0lXKqo
0K4Np2i7bQlQDK46gef1l/083kF19bc=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 08/12] conf: add backupAlias attribute to
driver subelement
Date: Sun, 19 Jan 2020 22:24:15 -0500
Message-Id: <20200120032419.448310-9-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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.84 on 10.5.11.23
X-MC-Unique: klaUCY5GPPqwiH3PisMNrw-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"
For the subelement (including the
backupAlias attribute) is parsed directly into the hostdev child
object (virDomaniHostdevDef) of the interface (using
virDomainHostdevDefParseXMLSubsys()). But for where the network is a pool of hostdevs, the hostdev
object doesn't exist until the network port is allocated at runtime,
and so virDomainHostdevDefParseXMLSubsys() can't be called during XML
parsing, and any backupAlias in the driver subelement of the XML will
be lost.
For this case, we need to add a backupAlias member to the interface
object (virDomainNetDef), and parse it during the parsing
that happens for all non-hostdev interfaces. Then when the network
port is allocated at runtime and the hostdev child object is created,
we can copy the backupAlias into the hostdev so it is available when
building the QEMU commandline.
An example usage:
Signed-off-by: Laine Stump
---
src/conf/domain_conf.c | 11 ++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_domain.c | 15 +++---
.../net-virtio-failover-network.xml | 37 ++++++++++++++
.../net-virtio-failover-network.xml | 51 +++++++++++++++++++
tests/qemuxml2xmltest.c | 3 ++
6 files changed, 112 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/net-virtio-failover-network.xml
create mode 100644 tests/qemuxml2xmloutdata/net-virtio-failover-network.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e0e47415ed..89cccd22bc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2428,6 +2428,7 @@ virDomainNetDefClear(virDomainNetDefPtr def)
break;
}
=20
+ VIR_FREE(def->driver.backupAlias);
VIR_FREE(def->backend.tap);
VIR_FREE(def->backend.vhost);
VIR_FREE(def->virtPortProfile);
@@ -11563,6 +11564,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
g_autofree char *localaddr =3D NULL;
g_autofree char *localport =3D NULL;
g_autofree char *model =3D NULL;
+ g_autofree char *backupAlias =3D NULL;
g_autofree char *backend =3D NULL;
g_autofree char *txmode =3D NULL;
g_autofree char *ioeventfd =3D NULL;
@@ -11735,6 +11737,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
} else if (virXMLNodeNameEqual(cur, "model")) {
model =3D virXMLPropString(cur, "type");
} else if (virXMLNodeNameEqual(cur, "driver")) {
+ backupAlias =3D virXMLPropString(cur, "backupAlias");
backend =3D virXMLPropString(cur, "name");
txmode =3D virXMLPropString(cur, "txmode");
ioeventfd =3D virXMLPropString(cur, "ioeventfd");
@@ -12075,6 +12078,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
* the subelement of has
* already been parsed by virDomainHostdevDefParseXMLSubsys()
*/
+
+ if (backupAlias)
+ def->driver.backupAlias =3D g_steal_pointer(&backupAlias);
+
if (virDomainNetIsVirtioModel(def)) {
if (backend !=3D NULL) {
if ((val =3D virDomainNetBackendTypeFromString(backend)) <=
0 ||
@@ -25455,6 +25462,8 @@ virDomainNetDriverAttributesFormat(char **outstr,
virDomainVirtioOptionsFormat(&buf, def->virtio);
}
=20
+ virBufferEscapeString(&buf, " backupAlias=3D'%s'", def->driver.backupA=
lias);
+
*outstr =3D virBufferContentAndReset(&buf);
}
=20
@@ -30675,6 +30684,8 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDe=
fPtr iface,
}
actual->data.hostdev.def.source.subsys.type =3D VIR_DOMAIN_HOSTDEV=
_SUBSYS_TYPE_PCI;
actual->data.hostdev.def.source.subsys.u.pci.addr =3D port->plug.h=
ostdevpci.addr;
+ actual->data.hostdev.def.source.subsys.u.pci.backupAlias
+ =3D g_strdup(iface->driver.backupAlias);
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.dri=
ver) {
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
actual->data.hostdev.def.source.subsys.u.pci.backend =3D
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0bf1d2b6bf..2b6d9bab75 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -929,6 +929,7 @@ struct _virDomainNetDef {
int model; /* virDomainNetModelType */
char *modelstr;
struct {
+ char *backupAlias; /* alias id of backup virtio device for failove=
r */
union {
struct {
virDomainNetBackendType name; /* which driver backend to u=
se */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d32a3c0935..b8acbc6248 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6472,13 +6472,16 @@ qemuDomainDeviceDefValidateNetwork(const virDomainN=
etDef *net,
_("tx_queue_size has to be a power of two"));
return -1;
}
+ }
=20
- if (net->driver.virtio.failover =3D=3D VIR_TRISTATE_SWITCH_ON &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("virtio-net failover is not supported with th=
is QEMU binary"));
- return -1;
- }
+
+ if ((net->driver.backupAlias ||
+ (virDomainNetIsVirtioModel(net) &&
+ net->driver.virtio.failover =3D=3D VIR_TRISTATE_SWITCH_ON)) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_FAILOVER)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio-net failover is not supported with this Q=
EMU binary"));
+ return -1;
}
=20
if (net->mtu &&
diff --git a/tests/qemuxml2argvdata/net-virtio-failover-network.xml b/tests=
/qemuxml2argvdata/net-virtio-failover-network.xml
new file mode 100644
index 0000000000..e2674ed57d
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-virtio-failover-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/qemuxml2xmloutdata/net-virtio-failover-network.xml b/tes=
ts/qemuxml2xmloutdata/net-virtio-failover-network.xml
new file mode 100644
index 0000000000..b803de1da2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/net-virtio-failover-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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c91690a030..45ba4db30c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -454,6 +454,9 @@ mymain(void)
DO_TEST("net-virtio-failover",
QEMU_CAPS_VIRTIO_NET_FAILOVER,
QEMU_CAPS_DEVICE_VFIO_PCI);
+ DO_TEST("net-virtio-failover-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 Sun May 5 09:07:24 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=1579490699; cv=none;
d=zohomail.com; s=zohoarc;
b=VuKpcTskZlVW7b9v7soPO039FcYWLDLD3wy+8OWKDIeXI/DVFhbe/Zhi0zQo2E0lWKfBWeuxbfqIXI0fDZjcMksQm4pIpYhduoD8E2zI/EGoenB9lbf2yBHkV3M5ufKDEfsSxhkDQVUG6Lgvelz6TfUrY60zoCFQD5a/XuyjiIY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490699;
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=qUbs1/AEqZhdvepkewiuenXWmN4L4sE6PGrubE+ZGo8=;
b=P0eVgCxgquFjSsbDQmAe/FYDASLwP0FdFqqTi9HcCED30rdl8l603jV3Wrd+rpbitNkKCpNk4mKrMHvU36lFa4N7mWckWBUok5yeYjJMTizeM1df22pYw0Z0kW0LtbNynDJiKAWCGMaCOo9swOpcHLyvHM19ZNTzu002Z7id0D0=
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 1579490699567741.141611633258;
Sun, 19 Jan 2020 19:24:59 -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-354-woF9aWgBOfOcJkCyR2ua-A-1; Sun, 19 Jan 2020 22:24:56 -0500
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 993D81005516;
Mon, 20 Jan 2020 03:24:51 +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 770E01001DD7;
Mon, 20 Jan 2020 03:24:51 +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 1308281972;
Mon, 20 Jan 2020 03:24:51 +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 00K3OYRJ002452 for ;
Sun, 19 Jan 2020 22:24:34 -0500
Received: by smtp.corp.redhat.com (Postfix)
id E4BE75C3FA; Mon, 20 Jan 2020 03:24:34 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 319AB5C1BB;
Mon, 20 Jan 2020 03:24:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490698;
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=qUbs1/AEqZhdvepkewiuenXWmN4L4sE6PGrubE+ZGo8=;
b=AoZ5QnY/cRvgabJopd725QpWdgEZmQRmIuOfXBexMBBu3gsoeO78HBZ2UyAWHyfcvuzbOT
dTld0zE1PPLGieZ1X/WdSf9186p6bhluzSBX2dFBnpwwVYGBYbEC9J5nm/qL2zbNPvrxd8
hlcOFADXWDAkWv5Wflt1I70ngCFiHk8=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 09/12] qemu: allow migration with assigned PCI hostdev
if backupAlias is set
Date: Sun, 19 Jan 2020 22:24:16 -0500
Message-Id: <20200120032419.448310-10-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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: jdenemar@redhat.com, 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.84 on 10.5.11.22
X-MC-Unique: woF9aWgBOfOcJkCyR2ua-A-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
PCI hostdev that has the backupAlias attribute 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
---
src/qemu/qemu_migration.c | 48 +++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 29d228a8d9..f675b445d5 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1093,10 +1093,50 @@ 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 a backupAlias is defined, the device will be auto-un=
plugged
+ * during migration.
+ */
+ if (hostdev->source.subsys.u.pci.backupAlias)
+ 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 Sun May 5 09:07:24 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=1579490705; cv=none;
d=zohomail.com; s=zohoarc;
b=ak4NvF2ceZOGh0h6iY09uIjeN1VjaqyDynI/qLLCWm0qmD8CfSRmTz93DvFufUuVukvEkrSS1Ie2B3ih7vBextETA7n3J/60seko0hIJeIU0SM4bJWS1gP3mlodCyWLPJhS50QosnBwFrDjr+HL97yW4FwJLImy4al7Udfg+U5M=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490705;
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=hizFgPsPNaygPlur/9JI7Jr+S0IVNrXdsTNAXoGoOY4=;
b=h3NrFMHKgf5uMzHpW89GQK8O+qZ1JLHdy9ILrXQAbe1yL5I5VZMX30MM3GPKmM+xYTbX7PLCm0aqJeiTEkqPgkH4hOmCmDoVo9r6h/RJcBdM/XyRvrBhoYgorTapnaP+bQrpp2YLeSycdUlTdDsMeM1zR7tQ9GiRjpVL6KaRC6Y=
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 1579490705830225.7857121601994;
Sun, 19 Jan 2020 19:25: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-27-WPBbMDIoNYaXoozUSJ6ZyQ-1; Sun, 19 Jan 2020 22:25:02 -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 0B9FBDB2B;
Mon, 20 Jan 2020 03:24:55 +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 D6BA887EDF;
Mon, 20 Jan 2020 03:24:54 +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 8CBFC81974;
Mon, 20 Jan 2020 03:24:54 +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 00K3OZcF002464 for ;
Sun, 19 Jan 2020 22:24:35 -0500
Received: by smtp.corp.redhat.com (Postfix)
id D28ED5C299; Mon, 20 Jan 2020 03:24:35 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1C3C75C1BB;
Mon, 20 Jan 2020 03:24:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490704;
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=hizFgPsPNaygPlur/9JI7Jr+S0IVNrXdsTNAXoGoOY4=;
b=R/NFYQGE7cYv9RmV1zL2jBrak5pLKmrO5BOKqqBmSvQl/Ac9ZLRXEFPbk4aO8eo+ld1zSI
bjbQgSmpTFhpm3jSksmQzBN6T9ACTqjDQZQkmvkZrLTC9dGWpg6h9Hxpc0VICSxyU5/01u
mNq6mWkjhGJtdXCbVbUGMJY96h2O74w=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 10/12] qemu: add wait-unplug to qemu migration status
enum
Date: Sun, 19 Jan 2020 22:24:17 -0500
Message-Id: <20200120032419.448310-11-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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: jdenemar@redhat.com, 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.13
X-MC-Unique: WPBbMDIoNYaXoozUSJ6ZyQ-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 eliminating itinerant error (effectively just warning,
since the migration continues) 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
---
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 f675b445d5..e53ef098ab 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1453,6 +1453,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 Sun May 5 09:07:24 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=1579490763; cv=none;
d=zohomail.com; s=zohoarc;
b=eDeeqDtJaKxHki8D3jxsmmcjQK58frwVXf9QKLg5waR1sDZ+IxogFnUMIPP5OigJUN+DDj+yX3LZp389JzC0xV10+UzoQ2zZ2jSaeEgMKFbIgRwwoIyo5KWqFHlflOxmwJkF5TE5kaQWpYJGZiNO1ov+U2WFdGzBw5lpKivUPes=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490763;
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=/esAeU5xpvSYVVOi4OiOTkd31d16XTZMZugA4fn33pw=;
b=kop5hUSsYIl0L1k5YONEYpXGYu4FbUUFa28lzXMa1h+x09nQw9tFlpsEHGagxGh1gctmaztDB4LrUK+4QBv7m+MH71eYKZueXuhkTLnwNZY/wuhUmLJi9gT9eEItq9WRpigv8xtCj+XClHr2U6QCroSr6f6H+yHuz6CyzeCqOV4=
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-1.mimecast.com
[207.211.31.81]) by mx.zohomail.com
with SMTPS id 1579490763145790.7860493874801;
Sun, 19 Jan 2020 19:26: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-329-GHA764kRM2uad96Gqp6FKA-1; Sun, 19 Jan 2020 22:25:06 -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 D838B1084432;
Mon, 20 Jan 2020 03:24:58 +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 B46DE84D99;
Mon, 20 Jan 2020 03:24:58 +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 731B08197B;
Mon, 20 Jan 2020 03:24:58 +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 00K3OaVP002471 for ;
Sun, 19 Jan 2020 22:24:36 -0500
Received: by smtp.corp.redhat.com (Postfix)
id A79695C299; Mon, 20 Jan 2020 03:24:36 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id 090EA5C1BB;
Mon, 20 Jan 2020 03:24:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490762;
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=/esAeU5xpvSYVVOi4OiOTkd31d16XTZMZugA4fn33pw=;
b=MfjLgYL7Jeuwy7xi09YHb1p4gAijwrzxjandnMVraMwe+jHtv2pNDnHgTHXEQPR7/U8n8i
3W/0GBSagFV9RmhuLsoNKLhX53rs57r7d5xH4F4Cw8+VcB+pABHmCICXOZei9kUJf2lS4z
W+wBXnCUwF/iLbIkfB55ulIySEFZKMo=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 11/12] docs: document virtio failover / QEMU auto-plug
of hostdev during migration
Date: Sun, 19 Jan 2020 22:24:18 -0500
Message-Id: <20200120032419.448310-12-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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: GHA764kRM2uad96Gqp6FKA-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 information in formatdomain.html seems too detailed, but it also
didn't seem right to put that information in a wiki page before the
patches are even pushed...
Signed-off-by: Laine Stump
---
docs/formatdomain.html.in | 70 +++++++++++++++++++++++++++++++++++++++
docs/news.xml | 27 +++++++++++++++
2 files changed, 97 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6e86d057a8..e3ea89fe25 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5871,6 +5871,76 @@
</devices>
...
=20
+
+
+
+ Since 6.1.0 (QEMU and KVM only, requires
+ QEMU 4.2.0 or newer) If the virtio-net driver in the
+ guest OS supports the virtio "failover" feature, it is possible
+ to setup a simple bond device comprised of one emulated virtio
+ NIC and one SRIOV VF "hostdev" NIC. In this configuration, the
+ higher-performing hostdev NIC will normally be preferred for all
+ network traffic, but when the VM is migrated, QEMU will
+ automatically unplug the VF from the VM, 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). The
+ interface <driver>
subelement
+ attributes failover
and backupAlias
+ are used to set this up - the virtio NIC will need to
+ have failover=3D'on'
set in
+ its <driver>
, and the hostdev NIC will
+ use backupAlias
to indicate the alias name of the
+ virtio NIC.
+
+
+ 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, it must start with "ua-".
+
+
+ NB2: Currently the only known implementation of failover in a
+ guest OS virtio-net driver requires that the MAC addresses of
+ the virtio and hostdev NIC must match. Since that may not always
+ be a requirement, libvirt doesn't enforce this limitation - it
+ is up to the person/management application that is creating the
+ configuration.
+
+
+ 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 following 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.
+
+
+
+...
+<devices>
+ <interface type=3D'network'>
+ <source network=3D'mybridge'/>
+ <mac address=3D'00:11:22:33:44:55'/>
+ <model type=3D'virtio'/>
+ <driver failover=3D'on'/>
+ <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'/>
+ <driver backupAlias=3D'ua-backup0'/>
+ </interface>
+</devices>
+...
=20
=20
diff --git a/docs/news.xml b/docs/news.xml
index 056c7ef026..051b6b3a54 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -44,6 +44,33 @@
+
+
+ support for virtio "failover" / QEMU auto-unplug of vfio devices
+
+
+ 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). 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 <driver> subelement "failover" and
+ "backupAlias" attributes.
+
+
--=20
2.24.1
From nobody Sun May 5 09:07:24 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=1579490746; cv=none;
d=zohomail.com; s=zohoarc;
b=BB6S0Vgur66fboJrbwPJGGyJ0wyBPYXbHvwZZJUHVcz8gSJYuyvqOw1hh3isXyWJW6XFqx1hoKdgSL2fh5mQ/lNlqIJnbP0IpXZ9SzT0wgcmhPFdUr8tH82hoC9Sti3kKVsoi7cbVzpuIZWl9gdu9jeLysmdu48e/TpilVZiUG0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
s=zohoarc;
t=1579490746;
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=OURQC41A12X+uP7hhJFdiAsWBBgmBZgq/xXXdiLCI+Y=;
b=LLNjBqmnTtv8Z7b6aBgTYmuXVOjl443pw6ZDqD0amxjFVodOt0kDRZnBzEyq8XS9n2ED5OVk2GtYKN8v2hT1a/48YCnV97veesrcli70YLQ+sRwVgTa8Ub9vxOb5hsEdYo4KTHXvZPTDtanN7IQm2ZlaE9CHQ2ACbxWxVyXfCYI=
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-2.mimecast.com
[205.139.110.61]) by mx.zohomail.com
with SMTPS id 1579490746221178.8385800174899;
Sun, 19 Jan 2020 19:25:46 -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-346-RCZ6KBsUPMurzMivsjEYpw-1; Sun, 19 Jan 2020 22:25:03 -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 086A4800D48;
Mon, 20 Jan 2020 03:24:58 +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 D2AA584D95;
Mon, 20 Jan 2020 03:24:57 +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 839AD81975;
Mon, 20 Jan 2020 03:24:57 +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 00K3ObAe002479 for ;
Sun, 19 Jan 2020 22:24:37 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 923725C299; Mon, 20 Jan 2020 03:24:37 +0000 (UTC)
Received: from tilapia.redhat.com (ovpn-121-72.rdu2.redhat.com [10.10.121.72])
by smtp.corp.redhat.com (Postfix) with ESMTP id D44565C1BB;
Mon, 20 Jan 2020 03:24:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1579490745;
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=OURQC41A12X+uP7hhJFdiAsWBBgmBZgq/xXXdiLCI+Y=;
b=FOjKwHUecFEngKafIGTWbXMoUAMIyMqjnNQQeeLK03XCvPfq0gtCACRYSAYorSfQbmpvvJ
g9vzPDoYWuPm3B6VmjD0XrsL3HjsWV52HGZ/sTDQIKbuM1v0i0d59IqEwQiIoPBU3JPjbt
kegrc/DquZclicrRBrVYeG+a8W0JavM=
From: Laine Stump
To: libvir-list@redhat.com
Subject: [libvirt PATCH 12/12] conf/qemu: new attribute
"useBackupMAC"
Date: Sun, 19 Jan 2020 22:24:19 -0500
Message-Id: <20200120032419.448310-13-laine@redhat.com>
In-Reply-To: <20200120032419.448310-1-laine@redhat.com>
References: <20200120032419.448310-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: RCZ6KBsUPMurzMivsjEYpw-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"
Current virtio-net drivers that support the failover feature match up
the virtio backup device with its corresponding hostdev device by
looking for an interface with a matching MAC address. Since libvirt
will assign a different random MAC address to each interface that
isn't given an explicit MAC address, this means that the configuration
for any failover pairs must include explicit matching MAC addresses.
To make life easier, we could have libvirt populate the XML config
with the same auto-generated MAC address for both interfaces when it
detects a failover pair that have no MAC addresses provided (a
failover pair can be detected by matching of the
virtio interface with of the hostdev
interface), but then we would be stuck with that behavior even if the
virtio guest driver later eliminated the requirement that mac
addresses match.
Additionally, some management software uses the MAC address as the
primary index for its list of network devices, and can't properly deal
with two interfaces having the same MAC address (oVirt). Even
libvirt's own virsh utility uses MAC address (combined with interface
type) to uniquely identify interfaces for the virsh detach-interface
command (in this case, fortunately the runtime interface type is used,
so one of the interfaces will always be of type=3D'hostdev' and the
other type=3D'something-else", so it doesn't currently cause any problem).
In order to remove the necessity of explicitly setting interface MAC
addresses, as well as permit the two interfaces of a failover pair to
each have a unique index while still fulfilling the current guest
driver requirement that the MAC addresses matchin the guest, this
patch adds a new attribute "useBackupMAC" that is set on the hostdev
interface of the pair. When useBackupMAC=3D'yes', the setup for the
hostdev interface will find the virtio failover interface (using
backupAlias) and use that interface's MAC address to initialize the
MAC address of the hostdev interface; the MAC address in the hostdev
interface config remains unchanged, it just isnt used for device
initialization.
I made this patch to followup on
https://bugzilla.redhat.com/show_bug.cgi?id=3D1693587#c12 (where I
suggested this attribute as a possible remedy to oVirt's requirement
that each network device have a unique MAC address).
Truthfully, I'm not convinced that I want it though, as it seems
"a bit" hackish. In particular, I've thought for a long time that the
"hostdev manager" code in util/virhostdev.c should really live in the
node device driver and be called from the hypervisors via a public API
(so that there is one central place on the host that maintains the
list of in-use PCI devices and their status), but this patch adds an
obstacle to that goal by adding a virDomainDefPtr to more of the APIs in
that library - if this was turned into a public API, then entire
virDomainDef would need to be serialized and sent in the API call,
then parsed at the other end - yuck :-/. NB: there are already
functions in virhostdev.h that take a virDomainDefPtr, so maybe I'm
being too sensitive.
On the upside, it solves a problem, and default bevahior is unchanged.
So although we would have to live with the presence of this option
forever once added, at least it would never be used unknowingly - the
behavior it triggers would only occur if it was explicitly called out
in the config.
Signed-off-by: Laine Stump
---
docs/formatdomain.html.in | 6 ++++-
docs/schemas/domaincommon.rng | 5 ++++
src/conf/domain_conf.c | 41 ++++++++++++++++++++++++++++--
src/conf/domain_conf.h | 2 ++
src/libxl/libxl_driver.c | 2 +-
src/qemu/qemu_hostdev.c | 5 ++--
src/qemu/qemu_hostdev.h | 1 +
src/qemu/qemu_hotplug.c | 2 +-
src/util/virhostdev.c | 47 +++++++++++++++++++++++++++++------
src/util/virhostdev.h | 1 +
tests/virhostdevtest.c | 18 +++++++-------
11 files changed, 106 insertions(+), 24 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e3ea89fe25..691c54da74 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5906,7 +5906,11 @@
the virtio and hostdev NIC must match. Since that may not always
be a requirement, libvirt doesn't enforce this limitation - it
is up to the person/management application that is creating the
- configuration.
+ configuration. However, if the driver
+ attribute useBackupMAC
is set to "yes", then the
+ hostdev NIC's own MAC address will be ignored, and libvirt will
+ initialize the hostdev NIC with the MAC address configured for
+ the virtio NIC (the backup).
NB3: Since the PCI addresses of the SRIOV VFs on the hosts that
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e0977d28d3..cd19a7c3b4 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3007,6 +3007,11 @@
[
+ ]
+
+ [
+ ]
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 89cccd22bc..ca49fb825b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6363,10 +6363,17 @@ virDomainHostdevDefValidate(const virDomainHostdevD=
ef *hostdev)
"'unassigned' address type"));
return -1;
}
- if (hostdev->source.subsys.u.pci.backupAlias &&
+ if ((hostdev->source.subsys.u.pci.backupAlias ||
+ hostdev->source.subsys.u.pci.useBackupMAC =3D=3D VIR_TRIS=
TATE_BOOL_YES) &&
!hostdev->parentnet) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("backupAlias is not supported for plain <=
hostdev> - is required"));
+ _("backupAlias and useBackupMAC are not sup=
ported for plain - is required"));
+ return -1;
+ }
+ if (hostdev->source.subsys.u.pci.useBackupMAC =3D=3D VIR_TRIST=
ATE_BOOL_YES &&
+ !hostdev->source.subsys.u.pci.backupAlias) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("useBackupMAC requires backupAlias to als=
o be set"));
return -1;
}
break;
@@ -8270,6 +8277,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
g_autofree char *model =3D NULL;
g_autofree char *display =3D NULL;
g_autofree char *ramfb =3D NULL;
+ g_autofree char *useBackupMAC =3D NULL;
=20
/* @managed can be read from the xml document - it is always an
* attribute of the toplevel element, no matter what type of
@@ -8420,6 +8428,13 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
pcisrc->backend =3D backend;
=20
pcisrc->backupAlias =3D virXPathString("string(./driver/@backupAli=
as)", ctxt);
+
+ if ((useBackupMAC =3D virXPathString("string(./driver/@useBackupMA=
C)", ctxt)) &&
+ (pcisrc->useBackupMAC =3D virTristateBoolTypeFromString(useBac=
kupMAC)) <=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown useBackupMAC value '%s'"), useBackup=
MAC);
+ return -1;
+ }
break;
=20
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
@@ -11565,6 +11580,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
g_autofree char *localport =3D NULL;
g_autofree char *model =3D NULL;
g_autofree char *backupAlias =3D NULL;
+ g_autofree char *useBackupMAC =3D NULL;
g_autofree char *backend =3D NULL;
g_autofree char *txmode =3D NULL;
g_autofree char *ioeventfd =3D NULL;
@@ -11738,6 +11754,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
model =3D virXMLPropString(cur, "type");
} else if (virXMLNodeNameEqual(cur, "driver")) {
backupAlias =3D virXMLPropString(cur, "backupAlias");
+ useBackupMAC =3D virXMLPropString(cur, "useBackupMAC");
backend =3D virXMLPropString(cur, "name");
txmode =3D virXMLPropString(cur, "txmode");
ioeventfd =3D virXMLPropString(cur, "ioeventfd");
@@ -12082,6 +12099,13 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
if (backupAlias)
def->driver.backupAlias =3D g_steal_pointer(&backupAlias);
=20
+ if (useBackupMAC &&
+ (def->driver.useBackupMAC =3D virTristateBoolTypeFromString(us=
eBackupMAC)) <=3D 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown useBackupMAC value '%s'"), useBackup=
MAC);
+ goto error;
+ }
+
if (virDomainNetIsVirtioModel(def)) {
if (backend !=3D NULL) {
if ((val =3D virDomainNetBackendTypeFromString(backend)) <=
0 ||
@@ -25073,6 +25097,11 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
=20
virBufferEscapeString(buf, " backupAlias=3D'%s'", pcisrc->backupAl=
ias);
=20
+ if (pcisrc->useBackupMAC) {
+ virBufferAsprintf(buf, " useBackupMAC=3D'%s'",
+ virTristateBoolTypeToString(pcisrc->useBacku=
pMAC));
+ }
+
virBufferAddLit(buf, "/>\n");
}
=20
@@ -25464,6 +25493,11 @@ virDomainNetDriverAttributesFormat(char **outstr,
=20
virBufferEscapeString(&buf, " backupAlias=3D'%s'", def->driver.backupA=
lias);
=20
+ if (def->driver.useBackupMAC) {
+ virBufferAsprintf(&buf, " useBackupMAC=3D'%s'",
+ virTristateBoolTypeToString(def->driver.useBacku=
pMAC));
+ }
+
*outstr =3D virBufferContentAndReset(&buf);
}
=20
@@ -30686,6 +30720,9 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDe=
fPtr iface,
actual->data.hostdev.def.source.subsys.u.pci.addr =3D port->plug.h=
ostdevpci.addr;
actual->data.hostdev.def.source.subsys.u.pci.backupAlias
=3D g_strdup(iface->driver.backupAlias);
+ actual->data.hostdev.def.source.subsys.u.pci.useBackupMAC
+ =3D iface->driver.useBackupMAC;
+
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.dri=
ver) {
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
actual->data.hostdev.def.source.subsys.u.pci.backend =3D
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2b6d9bab75..e505823a89 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -236,6 +236,7 @@ struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
char *backupAlias; /* alias id of backup virtio device for failover */
+ virTristateBool useBackupMAC; /* true to use MAC from backup virtio NI=
C */
};
=20
struct _virDomainHostdevSubsysSCSIHost {
@@ -930,6 +931,7 @@ struct _virDomainNetDef {
char *modelstr;
struct {
char *backupAlias; /* alias id of backup virtio device for failove=
r */
+ virTristateBool useBackupMAC; /* true to use MAC from backup virti=
o NIC */
union {
struct {
virDomainNetBackendType name; /* which driver backend to u=
se */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f021ec9c5d..7e4266c534 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3119,7 +3119,7 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr =
driver,
=20
if (virHostdevPreparePCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
vm->def->name, vm->def->uuid,
- &hostdev, 1, 0) < 0)
+ vm->def, &hostdev, 1, 0) < 0)
goto cleanup;
=20
if (libxlMakePCI(hostdev, &pcidev) < 0)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 1774850640..7359f67b66 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -238,6 +238,7 @@ int
qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
const char *name,
const unsigned char *uuid,
+ virDomainDefPtr def,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
virQEMUCapsPtr qemuCaps,
@@ -249,7 +250,7 @@ qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
return -1;
=20
return virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME,
- name, uuid, hostdevs,
+ name, uuid, def, hostdevs,
nhostdevs, flags);
}
=20
@@ -354,7 +355,7 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver,
return -1;
=20
if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid,
- def->hostdevs, def->nhostdevs,
+ def, def->hostdevs, def->nhostdevs,
qemuCaps, flags) < 0)
return -1;
=20
diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
index 23df925529..01a7dd37c5 100644
--- a/src/qemu/qemu_hostdev.h
+++ b/src/qemu/qemu_hostdev.h
@@ -51,6 +51,7 @@ int qemuHostdevPrepareNVMeDisks(virQEMUDriverPtr driver,
int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
const char *name,
const unsigned char *uuid,
+ virDomainDefPtr def,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
virQEMUCapsPtr qemuCaps,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 31d455505b..97fb859334 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1549,7 +1549,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
if (!cfg->relaxedACS)
flags |=3D VIR_HOSTDEV_STRICT_ACS_CHECK;
if (qemuHostdevPreparePCIDevices(driver, vm->def->name, vm->def->uuid,
- &hostdev, 1, priv->qemuCaps, flags) <=
0)
+ vm->def, &hostdev, 1, priv->qemuCaps,=
flags) < 0)
return -1;
=20
/* this could have been changed by qemuHostdevPreparePCIDevices */
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 9b4ea30216..d42b5263d6 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -487,6 +487,7 @@ virHostdevSaveNetConfig(virDomainHostdevDefPtr hostdev,
/**
* virHostdevSetNetConfig:
* @hostdev: config object describing a hostdev device
+ * @domaindef: complete domain if available (otherwise NULL)
* @uuid: uuid of the domain
*
* If the given hostdev device is an SRIOV network VF, determine its
@@ -497,9 +498,11 @@ virHostdevSaveNetConfig(virDomainHostdevDefPtr hostdev,
*/
static int
virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
+ virDomainDefPtr domaindef,
const unsigned char *uuid)
{
g_autofree char *linkdev =3D NULL;
+ const virMacAddr *mac;
const virNetDevVlan *vlan;
const virNetDevVPortProfile *virtPort;
int vf =3D -1;
@@ -511,6 +514,32 @@ virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
if (virHostdevNetDevice(hostdev, -1, &linkdev, &vf) < 0)
return -1;
=20
+ mac =3D &hostdev->parentnet->mac;
+ if (hostdev->source.subsys.u.pci.useBackupMAC =3D=3D VIR_TRISTATE_BOOL=
_YES) {
+ size_t i;
+
+ if (!domaindef) {
+ /* This should never happen */
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to get backup device MAC because doma=
indef is NULL"));
+ return -1;
+ }
+
+ for (i =3D 0; i < domaindef->nnets; i++) {
+ if (STREQ_NULLABLE(domaindef->nets[i]->info.alias,
+ hostdev->source.subsys.u.pci.backupAlias)) {
+ mac =3D &domaindef->nets[i]->mac;
+ break;
+ }
+ }
+ if (i > domaindef->nnets) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("backup device with alias name=3D'%s' was not=
found"),
+ hostdev->source.subsys.u.pci.backupAlias);
+ return -1;
+ }
+ }
+
vlan =3D virDomainNetGetActualVlan(hostdev->parentnet);
virtPort =3D virDomainNetGetActualVirtPortProfile(hostdev->parentnet);
if (virtPort) {
@@ -522,12 +551,10 @@ virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
return -1;
}
if (virHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort,
- &hostdev->parentnet->mac,
- uuid, port_profile_associat=
e) < 0)
+ mac, uuid, port_profile_ass=
ociate) < 0)
return -1;
} else {
- if (virNetDevSetNetConfig(linkdev, vf, &hostdev->parentnet->mac,
- vlan, NULL, true) < 0)
+ if (virNetDevSetNetConfig(linkdev, vf, mac, vlan, NULL, true) < 0)
return -1;
}
=20
@@ -724,6 +751,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mg=
r,
const char *dom_name,
const unsigned char *uuid,
virPCIDeviceListPtr pcidevs,
+ virDomainDefPtr domaindef, /* only used if=
nhostdevs > 0 */
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
unsigned int flags)
@@ -872,7 +900,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mg=
r,
* the network device, set the new netdev config */
for (i =3D 0; i < nhostdevs; i++) {
=20
- if (virHostdevSetNetConfig(hostdevs[i], uuid) < 0)
+ if (virHostdevSetNetConfig(hostdevs[i], domaindef, uuid) < 0)
goto resetvfnetconfig;
=20
last_processed_hostdev_vf =3D i;
@@ -988,6 +1016,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
const char *drv_name,
const char *dom_name,
const unsigned char *uuid,
+ virDomainDefPtr domaindef,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
unsigned int flags)
@@ -1001,7 +1030,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
return -1;
=20
return virHostdevPreparePCIDevicesImpl(mgr, drv_name, dom_name, uuid,
- pcidevs, hostdevs, nhostdevs, f=
lags);
+ pcidevs, domaindef, hostdevs,
+ nhostdevs, flags);
}
=20
=20
@@ -2151,6 +2181,7 @@ virHostdevPrepareDomainDevices(virHostdevManagerPtr m=
gr,
if (flags & VIR_HOSTDEV_SP_PCI) {
if (virHostdevPreparePCIDevices(mgr, driver,
def->name, def->uuid,
+ def,
def->hostdevs,
def->nhostdevs,
flags) < 0)
@@ -2358,8 +2389,8 @@ virHostdevPrepareOneNVMeDevice(virHostdevManagerPtr h=
ostdev_mgr,
}
=20
if (virHostdevPreparePCIDevicesImpl(hostdev_mgr,
- drv_name, dom_name, NULL,
- pciDevices, NULL, 0, pciFlags) < 0)
+ drv_name, dom_name, NULL, pciDevic=
es,
+ NULL, NULL, 0, pciFlags) < 0)
goto rollback;
=20
ret =3D 0;
diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
index ae84ed3d20..1aba8b73a8 100644
--- a/src/util/virhostdev.h
+++ b/src/util/virhostdev.h
@@ -68,6 +68,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_=
mgr,
const char *drv_name,
const char *dom_name,
const unsigned char *uuid,
+ virDomainDefPtr domaindef,
virDomainHostdevDefPtr *hostdevs,
int nhostdevs,
unsigned int flags)
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index b6260bd9c1..f05ea73125 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -186,7 +186,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
/* Test normal functionality */
VIR_TEST_DEBUG("Test 0 hostdevs");
if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
- NULL, 0, 0) < 0)
+ NULL, NULL, 0, 0) < 0)
return -1;
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count);
@@ -194,7 +194,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
/* Test unmanaged hostdevs */
VIR_TEST_DEBUG("Test >=3D1 unmanaged hostdevs");
if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
- hostdevs, nhostdevs, 0) < 0)
+ NULL, hostdevs, nhostdevs, 0) < 0)
return -1;
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count + nhostdevs);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count - nhostd=
evs);
@@ -204,7 +204,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs);
VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver/domain aga=
in");
if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
- &hostdevs[0], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[0], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
@@ -212,7 +212,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
=20
VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver, diff doma=
in again");
if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
- &hostdevs[1], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[1], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
@@ -220,7 +220,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void)
=20
VIR_TEST_DEBUG("Test: prepare same hostdevs for diff driver/domain aga=
in");
if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
- &hostdevs[2], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[2], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
@@ -272,7 +272,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed)
/* Test normal functionality */
VIR_TEST_DEBUG("Test >=3D1 hostdevs");
if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
- hostdevs, nhostdevs, 0) < 0)
+ NULL, hostdevs, nhostdevs, 0) < 0)
return -1;
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count + nhostdevs);
/* If testing a mixed roundtrip, devices are already in the inactive l=
ist
@@ -288,7 +288,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed)
inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs);
VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver/domain aga=
in");
if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
- &hostdevs[0], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[0], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
@@ -296,7 +296,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed)
=20
VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver, diff doma=
in again");
if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
- &hostdevs[1], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[1], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
@@ -304,7 +304,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed)
=20
VIR_TEST_DEBUG("Test: prepare same hostdevs for diff driver/domain aga=
in");
if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
- &hostdevs[2], 1, 0) =3D=3D 0)
+ NULL, &hostdevs[2], 1, 0) =3D=3D 0)
return -1;
virResetLastError();
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count);
--=20
2.24.1