From patchwork Fri Apr 1 11:16:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 8722931 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 809409F39A for ; Fri, 1 Apr 2016 11:17:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D64CF20379 for ; Fri, 1 Apr 2016 11:17:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36E5120374 for ; Fri, 1 Apr 2016 11:17:10 +0000 (UTC) Received: from localhost ([::1]:43499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alx4f-0005Xr-GK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Apr 2016 07:17:09 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=22woCkKEVWyQ1IvtxFEOrlIGpMA8Mfzptl5baO5unxk=; b=bCg0WE2mwS0m8f/g7UzQRdSHPz0kKfSiqfLk+xDm5KEZ1xoMJMFGeEfyqIYjVR+8jK JN7nWafX4n8MSI/8IRG62uJtle8LhzkjFghmivf03D3uLadST0B+941/7ItJdC18Qp1h Ac7UG/A2zIPk/8bTtOd59yOSKdah3bM3NoVznMPDB3LhH4OX8VuP38z0G52aSf1B83w0 c7dm8Xc9v5Om7egCd2+QpEf+VrErpjOML1p6vax95HF2Q8s23bI5CG8ghy082idVLoHv xNIt6dKK3yFAkCNsmx1jMdFVrny9/TJrCSftLXVLl//kY5PAbc7Q7rUxaKynxhfOm+XE +mww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=22woCkKEVWyQ1IvtxFEOrlIGpMA8Mfzptl5baO5unxk=; b=AGUuxCjEi8mgb4Ge/wpMUDU2Isk3gePqRBfOG77FMJe1JqkFcNXqdI/EkA52NkuUO0 n5iQQ+Iy7aJ4wTjG5gFRgODBIKZsBQkbHTOn2sib5syxbKnonIyZNWDd0d/s9TNlaSXT iT7QfaC8B8oBvVfF3oIXHACBicrm4PvdJm/nvcGWyBLhTOHM2tGmsv+VrbbeCADs38lo y6yNvDkB+MWjDmuJSP9ytiBi/thTf6b7exB1A9woKx6Er5aPZbsTSnOIwdZfCV63WTeo N2MY68Idlc1AdwzKRFyqaHVM3qYdqDTc2VnmePnlIx/Gnfq+CvoMlFAYJ4c1gI83Tgxl Yw7A== X-Gm-Message-State: AD7BkJKZ8SjJIcGCivtAzWQR6eRhJVzLLyvmlU9Mw63yuxCriMOzjtyMhNNuP36eD6lfWg== X-Received: by 10.55.73.68 with SMTP id w65mr17586158qka.68.1459509404660; Fri, 01 Apr 2016 04:16:44 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id k25sm5877530qkl.29.2016.04.01.04.16.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Apr 2016 04:16:43 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 1 Apr 2016 13:16:15 +0200 Message-Id: <1459509388-6185-6-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.5.5 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::232 Cc: Yuanhan Liu , "Michael S. Tsirkin" , Ilya Maximets , jonshin@cisco.com, Tetsuya Mukawa , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;