From nobody Sat Nov 23 17:52:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1729841788; cv=none; d=zohomail.com; s=zohoarc; b=G5rDVDypUZuxaFZZSet2bL8rhOxYgVPHH1EgfuVYgvjKx4eol/1oI9eALjvItvXmNKtvjQY60XOqRWVexIYOWaUM6FORd0kcmFhUkSIGfgyAk/LlYy6HsjQ35ETQ033xqb5UOVDFPV9jgez3jHtfysaKm42SETWzk0pgx84g5Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729841788; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kwN7Eoew5aA5M2VDK5CTXe4nFhPV6kVl0Mlb0jqL+Vw=; b=l8dQhQ6bi/mxZcgKWLxpbHa1KdP9rtBuCogg2azssbcAwPuPfwsixd9mTYhw4p/pHqN9mw2AV92zjGPiG30fuhIisHB1K309v5M4qDFdwkxirUx8w9MFplMu+GMMRQqA0SR1nv0BU5bDxTV6glSVLdpng24Y45W/QmQOw/Ge+h0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729841788790110.40559221559568; Fri, 25 Oct 2024 00:36:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4Erp-0008Fe-H5; Fri, 25 Oct 2024 03:36:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4Erk-0008Ej-4l for qemu-devel@nongnu.org; Fri, 25 Oct 2024 03:36:12 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4ErU-0005Kp-AV for qemu-devel@nongnu.org; Fri, 25 Oct 2024 03:36:00 -0400 Received: from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:2711:0:640:16b3:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id AE22360FD7; Fri, 25 Oct 2024 10:35:50 +0300 (MSK) Received: from d-tatianin-lin.yandex.net (unknown [2a02:6bf:8011:f00:9e1f:69f6:8772:3b7]) by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id hZPAuP0IWW20-WS91zpFB; Fri, 25 Oct 2024 10:35:49 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1729841749; bh=kwN7Eoew5aA5M2VDK5CTXe4nFhPV6kVl0Mlb0jqL+Vw=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=MQGEjyKu55MWpkjdoDmxZq+LXw5zvTcvVSYWO6QE7WwQj6ratvwroja/nd5FF8FpA kiAeE/tC9BH07xMIXjsgmimUYa69bacLEVG4hhl20kCLC8KYi233fjCVkGQNF6R8GW mvV9YRVKuur8Z9eWXIs8tIykYkcVBK8KsUAfwJCU= Authentication-Results: mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Daniil Tatianin To: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Cc: Daniil Tatianin , devel@lists.libvirt.org, Jason Wang , Eric Blake , Markus Armbruster , Thomas Huth , Laurent Vivier , Paolo Bonzini , Hailiang Zhang , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Nicholas Piggin , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= , Corey Minyard , qemu-devel@nongnu.org Subject: [PATCH 1/2] net/stream: deprecate 'reconnect' in favor of 'reconnect-ms' Date: Fri, 25 Oct 2024 10:35:24 +0300 Message-Id: <20241025073525.976136-2-d-tatianin@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025073525.976136-1-d-tatianin@yandex-team.ru> References: <20241025073525.976136-1-d-tatianin@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=d-tatianin@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1729841791279116600 Content-Type: text/plain; charset="utf-8" Do the same thing we already did for chardev in c8e2b6b4d7e, and introduce a new 'reconnect-ms' option to make it possible to specify sub-second timeouts. This also changes the related documentaion and tests to use reconnect-ms as well. Signed-off-by: Daniil Tatianin Reviewed-by: Marc-Andr=C3=A9 Lureau --- docs/about/deprecated.rst | 10 ++++++++++ net/stream.c | 34 ++++++++++++++++++++++------------ qapi/net.json | 13 ++++++++++++- qemu-options.hx | 24 ++++++++++++------------ tests/qtest/netdev-socket.c | 2 +- 5 files changed, 57 insertions(+), 26 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ce38a3d0cf..1e1e9f5f18 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -400,6 +400,16 @@ Backend ``memory`` (since 9.0) The ``reconnect`` option only allows specifiying second granularity timeou= ts, which is not enough for all types of use cases, use ``reconnect-ms`` inste= ad. =20 + +Net device options +'''''''''''''''''' + +Stream ``reconnect`` (since 9.2) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``reconnect`` option only allows specifiying second granularity timeou= ts, +which is not enough for all types of use cases, use ``reconnect-ms`` inste= ad. + CPU device properties ''''''''''''''''''''' =20 diff --git a/net/stream.c b/net/stream.c index 97e6ec6679..4de5613844 100644 --- a/net/stream.c +++ b/net/stream.c @@ -51,7 +51,7 @@ typedef struct NetStreamState { guint ioc_write_tag; SocketReadState rs; unsigned int send_index; /* number of bytes sent*/ - uint32_t reconnect; + uint32_t reconnect_ms; guint timer_tag; SocketAddress *addr; } NetStreamState; @@ -387,10 +387,9 @@ static gboolean net_stream_reconnect(gpointer data) =20 static void net_stream_arm_reconnect(NetStreamState *s) { - if (s->reconnect && s->timer_tag =3D=3D 0) { + if (s->reconnect_ms && s->timer_tag =3D=3D 0) { qemu_set_info_str(&s->nc, "connecting"); - s->timer_tag =3D g_timeout_add_seconds(s->reconnect, - net_stream_reconnect, s); + s->timer_tag =3D g_timeout_add(s->reconnect_ms, net_stream_reconne= ct, s); } } =20 @@ -398,7 +397,7 @@ static int net_stream_client_init(NetClientState *peer, const char *model, const char *name, SocketAddress *addr, - uint32_t reconnect, + uint32_t reconnect_ms, Error **errp) { NetStreamState *s; @@ -412,8 +411,8 @@ static int net_stream_client_init(NetClientState *peer, s->ioc =3D QIO_CHANNEL(sioc); s->nc.link_down =3D true; =20 - s->reconnect =3D reconnect; - if (reconnect) { + s->reconnect_ms =3D reconnect_ms; + if (reconnect_ms) { s->addr =3D QAPI_CLONE(SocketAddress, addr); } qio_channel_socket_connect_async(sioc, addr, @@ -432,13 +431,24 @@ int net_init_stream(const Netdev *netdev, const char = *name, sock =3D &netdev->u.stream; =20 if (!sock->has_server || !sock->server) { + uint32_t reconnect_ms =3D 0; + + if (sock->has_reconnect && sock->has_reconnect_ms) { + error_setg(errp, "'reconnect' and 'reconnect-ms' are mutually " + "exclusive"); + return -1; + } else if (sock->has_reconnect_ms) { + reconnect_ms =3D sock->reconnect_ms; + } else if (sock->has_reconnect) { + reconnect_ms =3D sock->reconnect * 1000u; + } + return net_stream_client_init(peer, "stream", name, sock->addr, - sock->has_reconnect ? sock->reconnec= t : 0, - errp); + reconnect_ms, errp); } - if (sock->has_reconnect) { - error_setg(errp, "'reconnect' option is incompatible with " - "socket in server mode"); + if (sock->has_reconnect || sock->has_reconnect_ms) { + error_setg(errp, "'reconnect' and 'reconnect-ms' options are " + "incompatible with socket in server mode"); return -1; } return net_stream_server_init(peer, "stream", name, sock->addr, errp); diff --git a/qapi/net.json b/qapi/net.json index 87fc0d0b28..2739a2f423 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -650,15 +650,26 @@ # attempt a reconnect after the given number of seconds. Setting # this to zero disables this function. (default: 0) (since 8.0) # +# @reconnect-ms: For a client socket, if a socket is disconnected, then +# attempt a reconnect after the given number of milliseconds. Setting +# this to zero disables this function. This member is mutually +# exclusive with @reconnect. (default: 0) (Since: 9.2) +# # Only SocketAddress types 'unix', 'inet' and 'fd' are supported. # +# Features: +# +# @deprecated: Member @reconnect is deprecated. Use @reconnect-ms +# instead. +# # Since: 7.2 ## { 'struct': 'NetdevStreamOptions', 'data': { 'addr': 'SocketAddress', '*server': 'bool', - '*reconnect': 'uint32' } } + '*reconnect': { 'type': 'int', 'features': [ 'deprecated' ] }, + '*reconnect-ms': 'int' } } =20 ## # @NetdevDgramOptions: diff --git a/qemu-options.hx b/qemu-options.hx index daae494147..bb228f6200 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2833,9 +2833,9 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev socket,id=3Dstr[,fd=3Dh][,udp=3Dhost:port][,localaddr=3Dhost:= port]\n" " configure a network backend to connect to another net= work\n" " using an UDP tunnel\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don= |off][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect= =3Dseconds]\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,abstract=3Don|off][,tight=3Don|off][,reconnect=3Dseconds]\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Df= ile-descriptor[,reconnect=3Dseconds]\n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don= |off][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect= -ms=3Dmilliseconds]\n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,abstract=3Don|off][,tight=3Don|off][,reconnect-ms=3Dmilliseconds]\= n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Df= ile-descriptor[,reconnect-ms=3Dmilliseconds]\n" " configure a network backend to connect to another net= work\n" " using a socket connection in stream mode.\n" "-netdev dgram,id=3Dstr,remote.type=3Dinet,remote.host=3Dmaddr,remote.= port=3Dport[,local.type=3Dinet,local.host=3Daddr]\n" @@ -3291,7 +3291,7 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect=3Ds= econds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect-ms= =3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. =20 ``server=3Don|off`` @@ -3333,9 +3333,9 @@ SRST # second VM |qemu_system| linux.img \\ -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ - -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234,reconnect=3D5 + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234,reconnect-ms=3D5000 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off][,reconnect=3Dseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off][,reconnect-ms=3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented unix domain socket. =20 ``server=3Don|off`` @@ -3350,8 +3350,8 @@ SRST ``tight=3Don|off`` if false, pad an abstract socket address with enough null bytes to= make it fill struct sockaddr_un member sun_path. =20 - ``reconnect=3Dseconds`` - for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + ``reconnect-ms=3Dmilliseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of milliseconds. Setting this to zero disables this function. (default: 0) =20 Example (using passt as a replacement of -netdev user): @@ -3377,9 +3377,9 @@ SRST # second VM |qemu_system| linux.img \\ -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ - -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/qemu0,reconnect=3D5 + -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Dun= ix,addr.path=3D/tmp/qemu0,reconnect-ms=3D5000 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor[,reconnect=3Dseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Dfile= -descriptor[,reconnect-ms=3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented socket file descriptor. =20 ``server=3Don|off`` @@ -4390,14 +4390,14 @@ SRST ``telnet options:`` localhost 5555 =20 - ``tcp:[host]:port[,server=3Don|off][,wait=3Don|off][,nodelay=3Don|off]= [,reconnect=3Dseconds]`` + ``tcp:[host]:port[,server=3Don|off][,wait=3Don|off][,nodelay=3Don|off]= [,reconnect-ms=3Dmilliseconds]`` The TCP Net Console has two modes of operation. It can send the serial I/O to a location or wait for a connection from a location. By default the TCP Net Console is sent to host at the port. If you use the ``server=3Don`` option QEMU will wait for a c= lient socket application to connect to the port before continuing, unless the ``wait=3Don|off`` option was specified. The ``nodelay= =3Don|off`` - option disables the Nagle buffering algorithm. The ``reconnect=3Do= n`` + option disables the Nagle buffering algorithm. The ``reconnect-ms`` option only applies if ``server=3Dno`` is set, if the connection g= oes down it will attempt to reconnect at the given interval. If host is omitted, 0.0.0.0 is assumed. Only one TCP connection at a diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c index fc7d11961e..317af03817 100644 --- a/tests/qtest/netdev-socket.c +++ b/tests/qtest/netdev-socket.c @@ -204,7 +204,7 @@ static void test_stream_unix_reconnect(void) =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dunix," - "addr.path=3D%s,reconnect=3D1", path); + "addr.path=3D%s,reconnect-ms=3D1000", path); =20 wait_stream_connected(qts0, "st0", &addr); g_assert_cmpint(addr->type, =3D=3D, SOCKET_ADDRESS_TYPE_UNIX); --=20 2.34.1 From nobody Sat Nov 23 17:52:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1729841813; cv=none; d=zohomail.com; s=zohoarc; b=Y/I8NyJiDyeev1pori4D/MoSAB0loTyCq8j/E7DXn6wnRMmerQ3BBXhpaAar3RhdgqJN0tMnsgLqH+zVsGMzVgVFoM4rmHjWVps93MsFjlZ6Z5GnUw9j8Kle4lgoSQvuIQCtazqLWr1fwj0T3k4YWcroAhu+rdmvmGhZQ1nCRqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729841813; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eR++ZBj++vpYFE5XSXEmJVeFVO/NeJb3cI6kemHHU2E=; b=nu+jhvvsSVfojEMQ3ceIJiQ041ijtu4ObhZ4uWZ1DA82LFJ2V2L9C0F3IH8/vwMbvZqUHU7Sx+vIFZqYmWpKfUEGsAFzBoHumPGOojfoDEW4h27hyA21h0RF88+3E3rBDKh4zzrq3l+2QM8W0p/4rJVyKOCyQ46/I0zfERszFPE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729841812473440.6437585251948; Fri, 25 Oct 2024 00:36:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4Erz-0008Jp-9Q; Fri, 25 Oct 2024 03:36:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4Erk-0008Ep-N4 for qemu-devel@nongnu.org; Fri, 25 Oct 2024 03:36:12 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4ErV-0005Kv-Op for qemu-devel@nongnu.org; Fri, 25 Oct 2024 03:36:01 -0400 Received: from mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:2711:0:640:16b3:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 7FE6E60A96; Fri, 25 Oct 2024 10:35:51 +0300 (MSK) Received: from d-tatianin-lin.yandex.net (unknown [2a02:6bf:8011:f00:9e1f:69f6:8772:3b7]) by mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id hZPAuP0IWW20-PwIOj9NT; Fri, 25 Oct 2024 10:35:50 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1729841750; bh=eR++ZBj++vpYFE5XSXEmJVeFVO/NeJb3cI6kemHHU2E=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=SF5bBalfyWXl3gT2ugFlVXFL7ZLn1hyhiEADZTjcXDWNPPjmNRixEKdXAwQ/D5fgZ JkwhO4E/6RZI9xcNFl2OrPlK/4N+dngRQCXEvYsPxuX+kA2rbLPvPJJj1xNIdiHNwx Wn/rtp0lgCyxif5o3vBUjL7prdsPjnio+TsyMQ1w= Authentication-Results: mail-nwsmtp-smtp-corp-main-83.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Daniil Tatianin To: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Cc: Daniil Tatianin , devel@lists.libvirt.org, Jason Wang , Eric Blake , Markus Armbruster , Thomas Huth , Laurent Vivier , Paolo Bonzini , Hailiang Zhang , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Nicholas Piggin , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= , Corey Minyard , qemu-devel@nongnu.org Subject: [PATCH 2/2] chardev: finalize 'reconnect' deprecation Date: Fri, 25 Oct 2024 10:35:25 +0300 Message-Id: <20241025073525.976136-3-d-tatianin@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025073525.976136-1-d-tatianin@yandex-team.ru> References: <20241025073525.976136-1-d-tatianin@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=d-tatianin@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1729841815564116600 Content-Type: text/plain; charset="utf-8" Change all related docs and tests to use the new 'reconnect-ms' option instead of the now deprecated 'reconnect'. Signed-off-by: Daniil Tatianin Reviewed-by: Marc-Andr=C3=A9 Lureau --- docs/COLO-FT.txt | 4 ++-- docs/system/ppc/powernv.rst | 2 +- qemu-options.hx | 22 +++++++++++----------- tests/qtest/ipmi-bt-test.c | 2 +- tests/qtest/vhost-user-test.c | 2 +- tests/unit/test-char.c | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/COLO-FT.txt b/docs/COLO-FT.txt index 2e760a4aee..2283a09c08 100644 --- a/docs/COLO-FT.txt +++ b/docs/COLO-FT.txt @@ -193,8 +193,8 @@ any IP's here, except for the $primary_ip variable. -device piix3-usb-uhci -device usb-tablet -name secondary \ -netdev tap,id=3Dhn0,vhost=3Doff,helper=3D/usr/lib/qemu/qemu-bridge-hel= per \ -device rtl8139,id=3De0,netdev=3Dhn0 \ - -chardev socket,id=3Dred0,host=3D$primary_ip,port=3D9003,reconnect=3D1 \ - -chardev socket,id=3Dred1,host=3D$primary_ip,port=3D9004,reconnect=3D1 \ + -chardev socket,id=3Dred0,host=3D$primary_ip,port=3D9003,reconnect-ms= =3D1000 \ + -chardev socket,id=3Dred1,host=3D$primary_ip,port=3D9004,reconnect-ms= =3D1000 \ -object filter-redirector,id=3Df1,netdev=3Dhn0,queue=3Dtx,indev=3Dred0 \ -object filter-redirector,id=3Df2,netdev=3Dhn0,queue=3Drx,outdev=3Dred1= \ -object filter-rewriter,id=3Drew0,netdev=3Dhn0,queue=3Dall \ diff --git a/docs/system/ppc/powernv.rst b/docs/system/ppc/powernv.rst index 09f3965858..de7a807ac7 100644 --- a/docs/system/ppc/powernv.rst +++ b/docs/system/ppc/powernv.rst @@ -181,7 +181,7 @@ connected to a remote QEMU machine acting as BMC, using= these options =20 .. code-block:: bash =20 - -chardev socket,id=3Dipmi0,host=3Dlocalhost,port=3D9002,reconnect=3D10 \ + -chardev socket,id=3Dipmi0,host=3Dlocalhost,port=3D9002,reconnect-ms=3D1= 0000 \ -device ipmi-bmc-extern,id=3Dbmc0,chardev=3Dipmi0 \ -device isa-ipmi-bt,bmc=3Dbmc0,irq=3D10 \ -nodefaults diff --git a/qemu-options.hx b/qemu-options.hx index bb228f6200..dacc9790a4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1102,7 +1102,7 @@ SRST external entity that provides the IPMI services. =20 A connection is made to an external BMC simulator. If you do this, - it is strongly recommended that you use the "reconnect=3D" chardev + it is strongly recommended that you use the "reconnect-ms=3D" chardev option to reconnect to the simulator if the connection is lost. Note that if this is not used carefully, it can be a security issue, as the interface has the ability to send resets, NMIs, and power off @@ -3318,8 +3318,8 @@ SRST ``ipv6=3Don|off`` whether to accept IPv6 addresses, default to try both IPv4 and IPv6 =20 - ``reconnect=3Dseconds`` - for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + ``reconnect-ms=3Dmilliseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of milliseconds. Setting this to zero disables this function. (default: 0) =20 Example (two guests connected using a TCP/IP socket): @@ -3388,8 +3388,8 @@ SRST ``addr.str=3Dfile-descriptor`` file descriptor number to use as a socket =20 - ``reconnect=3Dseconds`` - for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of seconds. + ``reconnect-ms=3Dmilliseconds`` + for a client socket, if a socket is disconnected, then attempt a r= econnect after the given number of milliseconds. Setting this to zero disables this function. (default: 0) =20 ``-netdev dgram,id=3Dstr,remote.type=3Dinet,remote.host=3Dmaddr,remote.por= t=3Dport[,local.type=3Dinet,local.host=3Daddr]`` @@ -3679,9 +3679,9 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, "-chardev help\n" "-chardev null,id=3Did[,mux=3Don|off][,logfile=3DPATH][,logappend=3Don= |off]\n" "-chardev socket,id=3Did[,host=3Dhost],port=3Dport[,to=3Dto][,ipv4=3Do= n|off][,ipv6=3Don|off][,nodelay=3Don|off]\n" - " [,server=3Don|off][,wait=3Don|off][,telnet=3Don|off][,websoc= ket=3Don|off][,reconnect=3Dseconds][,mux=3Don|off]\n" + " [,server=3Don|off][,wait=3Don|off][,telnet=3Don|off][,websoc= ket=3Don|off][,reconnect-ms=3Dmilliseconds][,mux=3Don|off]\n" " [,logfile=3DPATH][,logappend=3Don|off][,tls-creds=3DID][,tls= -authz=3DID] (tcp)\n" - "-chardev socket,id=3Did,path=3Dpath[,server=3Don|off][,wait=3Don|off]= [,telnet=3Don|off][,websocket=3Don|off][,reconnect=3Dseconds]\n" + "-chardev socket,id=3Did,path=3Dpath[,server=3Don|off][,wait=3Don|off]= [,telnet=3Don|off][,websocket=3Don|off][,reconnect-ms=3Dmilliseconds]\n" " [,mux=3Don|off][,logfile=3DPATH][,logappend=3Don|off][,abstr= act=3Don|off][,tight=3Don|off] (unix)\n" "-chardev udp,id=3Did[,host=3Dhost],port=3Dport[,localaddr=3Dlocaladdr= ]\n" " [,localport=3Dlocalport][,ipv4=3Don|off][,ipv6=3Don|off][,mu= x=3Don|off]\n" @@ -3792,7 +3792,7 @@ The available backends are: A void device. This device will not emit any data, and will drop any data it receives. The null backend does not take any options. =20 -``-chardev socket,id=3Did[,TCP options or unix options][,server=3Don|off][= ,wait=3Don|off][,telnet=3Don|off][,websocket=3Don|off][,reconnect=3Dseconds= ][,tls-creds=3Did][,tls-authz=3Did]`` +``-chardev socket,id=3Did[,TCP options or unix options][,server=3Don|off][= ,wait=3Don|off][,telnet=3Don|off][,websocket=3Don|off][,reconnect-ms=3Dmill= iseconds][,tls-creds=3Did][,tls-authz=3Did]`` Create a two-way stream socket, which can be either a TCP or a unix socket. A unix socket will be created if ``path`` is specified. Behaviour is undefined if TCP options are specified for a unix @@ -3809,9 +3809,9 @@ The available backends are: ``websocket=3Don|off`` specifies that the socket uses WebSocket protoc= ol for communication. =20 - ``reconnect`` sets the timeout for reconnecting on non-server + ``reconnect-ms`` sets the timeout for reconnecting on non-server sockets when the remote end goes away. qemu will delay this many - seconds and then attempt to reconnect. Zero disables reconnecting, + milliseconds and then attempt to reconnect. Zero disables reconnecting, and is the default. =20 ``tls-creds`` requests enablement of the TLS protocol for @@ -4427,7 +4427,7 @@ SRST The WebSocket protocol is used instead of raw tcp socket. The port acts as a WebSocket server. Client mode is not supported. =20 - ``unix:path[,server=3Don|off][,wait=3Don|off][,reconnect=3Dseconds]`` + ``unix:path[,server=3Don|off][,wait=3Don|off][,reconnect-ms=3Dmillisec= onds]`` A unix domain socket is used instead of a tcp socket. The option works the same as if you had specified ``-serial tcp`` except the unix domain socket path is used for connections. diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c index 13f7c841f5..637732fd5a 100644 --- a/tests/qtest/ipmi-bt-test.c +++ b/tests/qtest/ipmi-bt-test.c @@ -411,7 +411,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 global_qtest =3D qtest_initf( - " -chardev socket,id=3Dipmi0,host=3D127.0.0.1,port=3D%d,reconnect= =3D10" + " -chardev socket,id=3Dipmi0,host=3D127.0.0.1,port=3D%d,reconnect-= ms=3D10000" " -device ipmi-bmc-extern,chardev=3Dipmi0,id=3Dbmc0" " -device isa-ipmi-bt,bmc=3Dbmc0", emu_port); qtest_irq_intercept_in(global_qtest, "ioapic"); diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d6075001e7..8948fb81ef 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -920,7 +920,7 @@ static void wait_for_rings_started(TestServer *s, size_= t count) =20 static inline void test_server_connect(TestServer *server) { - test_server_create_chr(server, ",reconnect=3D1"); + test_server_create_chr(server, ",reconnect-ms=3D1000"); } =20 static gboolean diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c index a1c6bb874c..a6e8753e1c 100644 --- a/tests/unit/test-char.c +++ b/tests/unit/test-char.c @@ -1545,18 +1545,18 @@ int main(int argc, char **argv) static CharSocketClientTestConfig client2 ## name =3D \ { addr, NULL, true, false, char_socket_event }; \ static CharSocketClientTestConfig client3 ## name =3D \ - { addr, ",reconnect=3D1", false, false, char_socket_event }; \ + { addr, ",reconnect-ms=3D1000", false, false, char_socket_event };= \ static CharSocketClientTestConfig client4 ## name =3D \ - { addr, ",reconnect=3D1", true, false, char_socket_event }; \ + { addr, ",reconnect-ms=3D1000", true, false, char_socket_event }; \ static CharSocketClientTestConfig client5 ## name =3D \ { addr, NULL, false, true, char_socket_event }; \ static CharSocketClientTestConfig client6 ## name =3D \ { addr, NULL, true, true, char_socket_event }; \ static CharSocketClientTestConfig client7 ## name =3D \ - { addr, ",reconnect=3D1", true, false, \ + { addr, ",reconnect-ms=3D1000", true, false, \ char_socket_event_with_error }; \ static CharSocketClientTestConfig client8 ## name =3D \ - { addr, ",reconnect=3D1", false, false, char_socket_event }; \ + { addr, ",reconnect-ms=3D1000", false, false, char_socket_event };\ g_test_add_data_func("/char/socket/client/mainloop/" # name, \ &client1 ##name, char_socket_client_test); \ g_test_add_data_func("/char/socket/client/wait-conn/" # name, \ --=20 2.34.1