The patch passes the reconnect timeout to QEMU by monitor on chardev hotplug. Signed-off-by: ZhiPeng Lu <lu.zhipeng@xxxxxxxxxx> --- v1->v2: - Fix syntax errors about Curly brackets --- src/qemu/qemu_monitor_json.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index df5fb7c..290a037 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6444,6 +6444,17 @@ int qemuMonitorJSONGetTPMTypes(qemuMonitorPtr mon, return qemuMonitorJSONGetStringArray(mon, "query-tpm-types", tpmtypes); } +static int +qemuMonitorJSONBuildChrChardevReconnect(virJSONValuePtr object, + const virDomainChrSourceReconnectDef *def) +{ + int ret = 0; + + if (def->enabled == VIR_TRISTATE_BOOL_YES) + ret = virJSONValueObjectAppendNumberUint(object, "reconnect", def->timeout); + return ret; +} + static virJSONValuePtr qemuMonitorJSONAttachCharDevCommand(const char *chrID, const virDomainChrSourceDef *chr) @@ -6508,6 +6519,9 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, if (virJSONValueObjectAppendString(data, "tls-creds", tlsalias) < 0) goto cleanup; } + + if (qemuMonitorJSONBuildChrChardevReconnect(data, &chr->data.tcp.reconnect) < 0) + goto cleanup; break; case VIR_DOMAIN_CHR_TYPE_UDP: @@ -6545,6 +6559,9 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 || virJSONValueObjectAppendBoolean(data, "server", chr->data.nix.listen) < 0) goto cleanup; + + if (qemuMonitorJSONBuildChrChardevReconnect(data, &chr->data.nix.reconnect) < 0) + goto cleanup; break; case VIR_DOMAIN_CHR_TYPE_SPICEVMC: -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list