From ad32d7616577bd28d6dcd3add7bdf810c62a1e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 15 Apr 2019 18:51:48 +0200 Subject: [PATCH] qemu: do not set wait:false for client sockets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qemu commit 767abe7 ("chardev: forbid 'wait' option with client sockets") effectively deprecates usage of "wait" with client sockets starting with qemu 4.0, and earlier versions ignored the value. Cc: Daniel P. Berrangé Signed-off-by: Marc-André Lureau Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/qemu/qemu_monitor_json.c | 14 ++++++++++---- tests/qemumonitorjsontest.c | 2 -- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 71c452b25b..e7d063a5a8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6922,8 +6922,11 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, telnet = chr->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET; - if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 || - virJSONValueObjectAppendBoolean(data, "telnet", telnet) < 0 || + if (chr->data.tcp.listen && + virJSONValueObjectAppendBoolean(data, "wait", false) < 0) + goto cleanup; + + if (virJSONValueObjectAppendBoolean(data, "telnet", telnet) < 0 || virJSONValueObjectAppendBoolean(data, "server", chr->data.tcp.listen) < 0) goto cleanup; if (chr->data.tcp.tlscreds) { @@ -6973,8 +6976,11 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, goto cleanup; addr = NULL; - if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 || - virJSONValueObjectAppendBoolean(data, "server", chr->data.nix.listen) < 0) + if (chr->data.nix.listen && + virJSONValueObjectAppendBoolean(data, "wait", false) < 0) + goto cleanup; + + if (virJSONValueObjectAppendBoolean(data, "server", chr->data.nix.listen) < 0) goto cleanup; if (qemuMonitorJSONBuildChrChardevReconnect(data, &chr->data.nix.reconnect) < 0) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 055e201611..f5ad3f6a73 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -874,7 +874,6 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt) "'data':{'addr':{'type':'inet'," "'data':{'host':'example.com'," "'port':'1234'}}," - "'wait':false," "'telnet':false," "'server':false}}}"); @@ -920,7 +919,6 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt) "'backend':{'type':'socket'," "'data':{'addr':{'type':'unix'," "'data':{'path':'/path/to/socket'}}," - "'wait':false," "'server':false}}}"); chr = (virDomainChrSourceDef) { .type = VIR_DOMAIN_CHR_TYPE_SPICEVMC }; -- GitLab