qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait


From: marcandre . lureau
Subject: [Qemu-devel] [PATCH 05/18] vhost-user: check reconnect comes with wait
Date: Fri, 1 Apr 2016 13:16:15 +0200

From: Marc-André Lureau <address@hidden>

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]