From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alx4M-0005Sn-3U for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:16:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alx4H-0001kN-3b for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:16:50 -0400 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:33074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alx4G-0001kJ-VQ for qemu-devel@nongnu.org; Fri, 01 Apr 2016 07:16:45 -0400 Received: by mail-qk0-x232.google.com with SMTP id s5so36562886qkd.0 for ; Fri, 01 Apr 2016 04:16:44 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Fri, 1 Apr 2016 13:16:15 +0200 Message-Id: <1459509388-6185-6-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1459509388-6185-1-git-send-email-marcandre.lureau@redhat.com> References: <1459509388-6185-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Yuanhan Liu , "Michael S. Tsirkin" , Ilya Maximets , jonshin@cisco.com, Tetsuya Mukawa , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau If the client socket has the 'reconnect' option, make sure the 'wait' option is also used. That way, an initial connection will be ensured before the VM start and the virtio device is configured. Signed-off-by: Marc-André Lureau --- net/vhost-user.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/vhost-user.c b/net/vhost-user.c index 1b9e73a..9007d0b 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -27,6 +27,8 @@ typedef struct VhostUserState { typedef struct VhostUserChardevProps { bool is_socket; bool is_unix; + bool is_reconnect; + bool is_wait; } VhostUserChardevProps; VHostNetState *vhost_user_get_vhost_net(NetClientState *nc) @@ -239,6 +241,10 @@ static int net_vhost_chardev_opts(void *opaque, } else if (strcmp(name, "path") == 0) { props->is_unix = true; } else if (strcmp(name, "server") == 0) { + } else if (strcmp(name, "reconnect") == 0) { + props->is_reconnect = true; + } else if (strcmp(name, "wait") == 0) { + props->is_wait = true; } else { error_setg(errp, "vhost-user does not support a chardev with option %s=%s", @@ -271,6 +277,12 @@ static CharDriverState *net_vhost_parse_chardev( return NULL; } + if (props.is_reconnect && !props.is_wait) { + error_setg(errp, "chardev \"%s\" must also 'wait' with 'reconnect'", + opts->chardev); + return NULL; + } + qemu_chr_fe_claim_no_fail(chr); return chr; -- 2.5.5