[PATCH v2 2/3] qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr

Peter Krempa pkrempa at redhat.com
Fri Nov 19 12:57:43 UTC 2021


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 <pkrempa at redhat.com>
---
 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 0c66086598..508d56994c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6602,10 +6602,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 *
-- 
2.31.1




More information about the libvir-list mailing list