From nobody Thu May 15 17:44:13 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1504862963080736.2753814064738;
Fri, 8 Sep 2017 02:29:23 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id 10B54883B4;
Fri, 8 Sep 2017 09:29:21 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EC7C53CC7;
Fri, 8 Sep 2017 09:29:20 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id DAAF91806106;
Fri, 8 Sep 2017 09:29:19 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id v889TAQj027173 for ;
Fri, 8 Sep 2017 05:29:10 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 41FD252792; Fri, 8 Sep 2017 09:29:10 +0000 (UTC)
Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com
[10.5.110.30])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CC42614C0
for ; Fri, 8 Sep 2017 09:29:07 +0000 (UTC)
Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id A40C2356D4
for ; Fri, 8 Sep 2017 09:29:05 +0000 (UTC)
Received: from mse01.zte.com.cn (unknown [10.30.3.20])
by Forcepoint Email with ESMTPS id 7328715BC0201F59278D
for ; Fri, 8 Sep 2017 17:13:35 +0800 (CST)
Received: from notes_smtp.zte.com.cn ([10.30.1.239])
by mse01.zte.com.cn with ESMTP id v889DHKp018110
for ; Fri, 8 Sep 2017 17:13:17 +0800 (GMT-8)
(envelope-from lu.zhipeng@zte.com.cn)
Received: from ceshi.localdomain ([10.74.120.130])
by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6)
with ESMTP id 2017090817132326-1965817 ;
Fri, 8 Sep 2017 17:13:23 +0800
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 10B54883B4
Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com;
dmarc=none (p=none dis=none) header.from=zte.com.cn
Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com;
spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 10B54883B4
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A40C2356D4
Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com;
dmarc=none (p=none dis=none) header.from=zte.com.cn
Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com;
spf=pass smtp.mailfrom=lu.zhipeng@zte.com.cn
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A40C2356D4
From: ZhiPeng Lu
To: libvir-list@redhat.com
Date: Fri, 8 Sep 2017 17:12:09 +0800
Message-Id: <1504861929-7975-1-git-send-email-lu.zhipeng@zte.com.cn>
X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release
8.5.3FP6|November 21, 2013) at 2017-09-08 17:13:23,
Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17,
2016) at 2017-09-08 17:13:02,
Serialize complete at 2017-09-08 17:13:02
X-MAIL: mse01.zte.com.cn v889DHKp018110
X-Greylist: Delayed for 00:15:29 by milter-greylist-4.5.16 (mx1.redhat.com
[10.5.110.30]); Fri, 08 Sep 2017 09:29:06 +0000 (UTC)
X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com
[10.5.110.30]);
Fri, 08 Sep 2017 09:29:06 +0000 (UTC) for IP:'202.103.147.172'
DOMAIN:'out1.zte.com.cn' HELO:'mxct.zte.com.cn'
FROM:'lu.zhipeng@zte.com.cn' RCPT:''
X-RedHat-Spam-Score: -0.002 (RP_MATCHES_RCVD,
SPF_PASS) 202.103.147.172 out1.zte.com.cn 202.103.147.172
out1.zte.com.cn
X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Cc: ZhiPeng Lu
Subject: [libvirt] [PATCH] vhost-user: add support reconnect for vhost-user
ports
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: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
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-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]);
Fri, 08 Sep 2017 09:29:21 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
For vhost-user ports, Open vSwitch acts as the server and QEMU the client.
When OVS crashed or restart, QEMU shoule be reconnect to OVS.
Signed-off-by: ZhiPeng Lu
---
docs/formatdomain.html.in | 6 +++--
docs/schemas/domaincommon.rng | 5 ++++
src/conf/domain_conf.c | 28 ++++++++++++++++++=
++--
.../qemuxml2argv-net-vhostuser-multiq.args | 2 +-
.../qemuxml2argv-net-vhostuser-multiq.xml | 2 +-
5 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 8ca7637..ffe45c2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5660,7 +5660,7 @@ qemu-kvm -net nic,model=3D? /dev/null
</interface>
<interface type=3D'vhostuser'>
<mac address=3D'52:54:00:3b:83:1b'/>
- <source type=3D'unix' path=3D'/tmp/vhost2.sock' mode=3D'client'/>
+ <source type=3D'unix' path=3D'/tmp/vhost2.sock' mode=3D'client' rec=
onnect=3D'10'/>
<model type=3D'virtio'/>
<driver queues=3D'5'/>
</interface>
@@ -5675,7 +5675,9 @@ qemu-kvm -net nic,model=3D? /dev/null
Both mode=3D'server'
and mode=3D'client'
are supported.
vhost-user requires the virtio model type, thus the
- <model>
element is mandatory.
+ <model>
element is mandatory. reconnect
+ is an optional element,which configures reconnect timeout if the
+ connection is lost.
=20
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 06c5a91..82f30ae 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2383,6 +2383,11 @@
client
+
+
+ [
+ ]
+
[
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2fc1fc3..f9c3b35 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10176,6 +10176,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
char *vhostuser_mode =3D NULL;
char *vhostuser_path =3D NULL;
char *vhostuser_type =3D NULL;
+ char *vhostuser_reconnect =3D NULL;
char *trustGuestRxFilters =3D NULL;
char *vhost_path =3D NULL;
virNWFilterHashTablePtr filterparams =3D NULL;
@@ -10262,11 +10263,12 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xml=
opt,
goto error;
}
} else if (!vhostuser_path && !vhostuser_mode && !vhostuser_ty=
pe
- && def->type =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
- virXMLNodeNameEqual(cur, "source")) {
+ && !vhostuser_reconnect && def->type =3D=3D VIR_DOM=
AIN_NET_TYPE_VHOSTUSER
+ && virXMLNodeNameEqual(cur, "source")) {
vhostuser_type =3D virXMLPropString(cur, "type");
vhostuser_path =3D virXMLPropString(cur, "path");
vhostuser_mode =3D virXMLPropString(cur, "mode");
+ vhostuser_reconnect =3D virXMLPropString(cur, "reconnect");
} else if (!def->virtPortProfile
&& virXMLNodeNameEqual(cur, "virtualport")) {
if (def->type =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK) {
@@ -10478,6 +10480,11 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
"type=3D'vhostuser'/>"));
goto error;
}
+ if (vhostuser_reconnect !=3D NULL && STREQ(vhostuser_mode, "server=
")) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'reconnect' attribute unsupported "
+ "'server' mode for "));
+ }
=20
if (VIR_ALLOC(def->data.vhostuser) < 0)
goto error;
@@ -10490,6 +10497,17 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
def->data.vhostuser->data.nix.listen =3D true;
} else if (STREQ(vhostuser_mode, "client")) {
def->data.vhostuser->data.nix.listen =3D false;
+ if (vhostuser_reconnect !=3D NULL) {
+ def->data.vhostuser->data.nix.reconnect.enabled =3D true;
+ if (virStrToLong_ui(vhostuser_reconnect, NULL, 0,
+ &def->data.vhostuser->data.nix.reconnec=
t.timeout) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("vhost-user reconnect attribute is inva=
lid"));
+ vhostuser_reconnect =3D NULL;
+ def->data.vhostuser->data.nix.reconnect.enabled =3D fa=
lse;
+ goto error;
+ }
+ }
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Wrong 'mode' attribute "
@@ -10937,6 +10955,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
VIR_FREE(vhostuser_type);
VIR_FREE(vhostuser_path);
VIR_FREE(vhostuser_mode);
+ VIR_FREE(vhostuser_reconnect);
VIR_FREE(ifname);
VIR_FREE(ifname_guest);
VIR_FREE(ifname_guest_actual);
@@ -22928,6 +22947,11 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " mode=3D'%s'",
def->data.vhostuser->data.nix.listen ?
"server" : "client");
+ if (def->data.vhostuser->data.nix.reconnect.enabled =3D=3D=
true) {
+ virBufferAsprintf(buf, " reconnect=3D'%u'",
+ def->data.vhostuser->data.nix.reconn=
ect.timeout);
+ }
+
sourceLines++;
}
break;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args =
b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
index b69ebd8..996828f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
@@ -32,7 +32,7 @@ addr=3D0x4 \
-netdev socket,listen=3D:2015,id=3Dhostnet2 \
-device rtl8139,netdev=3Dhostnet2,id=3Dnet2,mac=3D52:54:00:95:db:c0,bus=3D=
pci.0,\
addr=3D0x5 \
--chardev socket,id=3Dcharnet3,path=3D/tmp/vhost2.sock \
+-chardev socket,id=3Dcharnet3,path=3D/tmp/vhost2.sock,reconnect=3D10 \
-netdev vhost-user,chardev=3Dcharnet3,queues=3D4,id=3Dhostnet3 \
-device virtio-net-pci,mq=3Don,vectors=3D10,netdev=3Dhostnet3,id=3Dnet3,\
mac=3D52:54:00:ee:96:6d,bus=3Dpci.0,addr=3D0x6
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml b=
/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
index d5c42fe..7eb6fa0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
@@ -40,7 +40,7 @@
-
+
--=20
1.8.3.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list]