From 03cab99ca5cbddfa51467b3173a97741a5070a96 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 19 Nov 2021 13:25:00 +0100 Subject: [PATCH] qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When formatting the commandline we explicitly set the reconnect timeout to 0 when it's disabled even when that's the default. Do the same in the monitor/hotplug code. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_monitor_json.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8132ff0dca..437550a2fc 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6600,10 +6600,22 @@ static int qemuMonitorJSONBuildChrChardevReconnect(virJSONValue *object, const virDomainChrSourceReconnectDef *def) { - if (def->enabled != VIR_TRISTATE_BOOL_YES) + int timeout = 0; + + switch (def->enabled) { + case VIR_TRISTATE_BOOL_ABSENT: + case VIR_TRISTATE_BOOL_LAST: return 0; - return virJSONValueObjectAppendNumberUint(object, "reconnect", def->timeout); + case VIR_TRISTATE_BOOL_YES: + timeout = def->timeout; + break; + + case VIR_TRISTATE_BOOL_NO: + break; + } + + return virJSONValueObjectAppendNumberUint(object, "reconnect", timeout); } static virJSONValue *