[Qemu-devel] [PATCH 1/3] char-socket: correctly set has_reconnect when parsing QemuOpts

Marc-André Lureau posted 3 patches 7 years, 3 months ago
[Qemu-devel] [PATCH 1/3] char-socket: correctly set has_reconnect when parsing QemuOpts
Posted by Marc-André Lureau 7 years, 3 months ago
qemu_chr_parse_socket() fills all ChardevSocket fields, but that
doesn't reflect correctly the arguments given with the options / on
the command line. "reconnect" takes a number as argument, and the
default value is 0, which doesn't help to identify the missing
option. The other arguments have default values that are less
problematic, leave them set by default for now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index efbad6ee7c..8950f36317 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -1111,7 +1111,7 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
     sock->tn3270 = is_tn3270;
     sock->has_wait = true;
     sock->wait = is_waitconnect;
-    sock->has_reconnect = true;
+    sock->has_reconnect = qemu_opt_find(opts, "reconnect");
     sock->reconnect = reconnect;
     sock->tls_creds = g_strdup(tls_creds);
 
-- 
2.18.0.129.ge3331758f1


Re: [Qemu-devel] [PATCH 1/3] char-socket: correctly set has_reconnect when parsing QemuOpts
Posted by Daniel P. Berrangé 7 years, 3 months ago
On Tue, Jul 17, 2018 at 02:52:37PM +0200, Marc-André Lureau wrote:
> qemu_chr_parse_socket() fills all ChardevSocket fields, but that
> doesn't reflect correctly the arguments given with the options / on
> the command line. "reconnect" takes a number as argument, and the
> default value is 0, which doesn't help to identify the missing
> option. The other arguments have default values that are less
> problematic, leave them set by default for now.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  chardev/char-socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index efbad6ee7c..8950f36317 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -1111,7 +1111,7 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
>      sock->tn3270 = is_tn3270;
>      sock->has_wait = true;
>      sock->wait = is_waitconnect;
> -    sock->has_reconnect = true;
> +    sock->has_reconnect = qemu_opt_find(opts, "reconnect");
>      sock->reconnect = reconnect;
>      sock->tls_creds = g_strdup(tls_creds);

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: 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 :|