]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr
authorPeter Krempa <pkrempa@redhat.com>
Fri, 19 Nov 2021 12:25:00 +0000 (13:25 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 22 Nov 2021 11:51:18 +0000 (12:51 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index 8132ff0dca04224d09b9545188e22c06433b4597..437550a2fccdfe813dcdc7a68f4b7a772f6e9058 100644 (file)
@@ -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 *