From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
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é <berrange(a)redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
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 };
--
2.21.0.313.ge35b8cb8e2