1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

qemuMonitorJSONBuildChrChardevReconnect: Unify with qemuBuildChrChardevReconnectStr

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>
This commit is contained in:
Peter Krempa 2021-11-19 13:25:00 +01:00
parent dd138ea402
commit 03cab99ca5

View 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 *