Skip to contentSkip to conversation

socket: allow wait=false for client socket

PATCH Superseded Marc-André Lureau 3 participants 3 messages Apr 15, 2019

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 socket: allow wait=false for client socket

Commit 767abe7 ("chardev: forbid 'wait' option with client sockets") is a bit too strict. Current libvirt always set wait=false, and will thus fail to add client chardev.

Make the code more permissive, allowing wait=false with client socket chardevs.

Fixes 767abe7f49e8be14d29da5db3527817b5d696a52
Cc Daniel P. Berrangé <[email protected]>
---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-socket.c +1 -1
index 3916505d67..2ad9c9eea5 100644
@@ -1262,7 +1262,7 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock,
             error_setg(errp, "%s", "Websocket client is not implemented");
             return false;
         }
-        if (sock->has_wait) {
+        if (sock->has_wait && sock->wait) {
             error_setg(errp, "%s",
                        "'wait' option is incompatible with "
                        "socket in client connect mode");
Signature · 1 line
2.21.0.313.ge35b8cb8e2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Marc-André Lureau

Commit 767abe7 ("chardev: forbid 'wait' option with client sockets") is a bit too strict. Current libvirt always set wait=false, and will thus fail to add client chardev.

Make the code more permissive, allowing wait=false with client socket chardevs.

Fixes 767abe7f49e8be14d29da5db3527817b5d696a52
Cc Daniel P. Berrangé <[email protected]>
---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-socket.c +0 -0
index 3916505d67..2ad9c9eea5 100644

chardev/char-socket.c static bool qmp_chardev_validate_socket(ChardevSocket *sock, · line 1268

Quoted 8 lines
chardev/char-socket.c +1 -1
@@ -1262,7 +1262,7 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock,
             error_setg(errp, "%s", "Websocket client is not implemented");
             return false;
         }
-        if (sock->has_wait) {
+        if (sock->has_wait && sock->wait) {
             error_setg(errp, "%s",
                        "'wait' option is incompatible with "
                        "socket in client connect mode");

Though, I think we should issue a deprecation warning if 'has_wait' is set, because this is still user error, and it would be good to make it stricter again later.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Marc-André Lureau
Quoted 7 lines · Marc-André Lureau

Commit 767abe7 ("chardev: forbid 'wait' option with client sockets") is a bit too strict. Current libvirt always set wait=false, and will thus fail to add client chardev.

Make the code more permissive, allowing wait=false with client socket chardevs.

Quoted 6 lines
Fixes 767abe7f49e8be14d29da5db3527817b5d696a52
Cc Daniel P. Berrangé <[email protected]>
---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

According to Fixes, this is a regression in 4.0. Is it worth having this fix in -rc4?

Quoted 15 lines
chardev/char-socket.c +1 -1
index 3916505d67..2ad9c9eea5 100644
@@ -1262,7 +1262,7 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock,
             error_setg(errp, "%s", "Websocket client is not implemented");
             return false;
         }
-        if (sock->has_wait) {
+        if (sock->has_wait && sock->wait) {
             error_setg(errp, "%s",
                        "'wait' option is incompatible with "
                        "socket in client connect mode");
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org