This alone makes not much sense. But the aim is to reuse this
function in qemuBuildVhostuserCommandLine() where 'nowait' is not
supported for vhost-user devices.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ebedaef..c419ecf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4867,7 +4867,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
const virDomainDef *def,
const virDomainChrSourceDef *dev,
const char *alias,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ bool nowait)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool telnet;
@@ -4940,19 +4941,20 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
case VIR_DOMAIN_CHR_TYPE_TCP:
telnet = dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
virBufferAsprintf(&buf,
- "socket,id=char%s,host=%s,port=%s%s%s",
+ "socket,id=char%s,host=%s,port=%s%s",
alias,
dev->data.tcp.host,
dev->data.tcp.service,
- telnet ? ",telnet" : "",
- dev->data.tcp.listen ? ",server,nowait" :
"");
+ telnet ? ",telnet" : "");
+ if (dev->data.tcp.listen)
+ virBufferAdd(&buf, nowait ? ",server,nowait" :
",server", -1);
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
virBufferAsprintf(&buf, "socket,id=char%s,path=", alias);
virQEMUBuildBufferEscapeComma(&buf, dev->data.nix.path);
if (dev->data.nix.listen)
- virBufferAddLit(&buf, ",server,nowait");
+ virBufferAdd(&buf, nowait ? ",server,nowait" :
",server", -1);
break;
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
@@ -5276,7 +5278,7 @@ qemuBuildMonitorCommandLine(virLogManagerPtr logManager,
if (!(chrdev = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
monitor_chr, "monitor",
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, chrdev);
@@ -5434,7 +5436,7 @@ qemuBuildRNGBackendChrdevStr(virLogManagerPtr logManager,
case VIR_DOMAIN_RNG_BACKEND_EGD:
if (!(*chr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
rng->source.chardev,
- rng->info.alias, qemuCaps)))
+ rng->info.alias, qemuCaps, true)))
return -1;
}
@@ -8376,7 +8378,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&smartcard->data.passthru,
smartcard->info.alias,
- qemuCaps))) {
+ qemuCaps, true))) {
virBufferFreeAndReset(&opt);
return -1;
}
@@ -8490,7 +8492,7 @@ qemuBuildShmemBackendStr(virLogManagerPtr logManager,
devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&shmem->server.chr,
- shmem->info.alias, qemuCaps);
+ shmem->info.alias, qemuCaps, true);
return devstr;
}
@@ -8568,7 +8570,7 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&serial->source,
serial->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8607,7 +8609,7 @@ qemuBuildParallelsCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
¶llel->source,
parallel->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8653,7 +8655,7 @@ qemuBuildChannelsCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&channel->source,
channel->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8676,7 +8678,7 @@ qemuBuildChannelsCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&channel->source,
channel->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8719,7 +8721,7 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&console->source,
console->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8733,7 +8735,7 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&console->source,
console->info.alias,
- qemuCaps)))
+ qemuCaps, true)))
return -1;
virCommandAddArg(cmd, "-chardev");
virCommandAddArg(cmd, devstr);
@@ -8862,7 +8864,7 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager,
if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
&redirdev->source.chr,
redirdev->info.alias,
- qemuCaps))) {
+ qemuCaps, true))) {
return -1;
}
--
2.8.4