From 336d4a71feb1cd68df13e1812e86971c61553522 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 16 Aug 2016 13:06:46 +0200 Subject: [PATCH] qemuBuildChrChardevStr: Introduce @nowait argument 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 --- src/qemu/qemu_command.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5213e9704f..ff4e977a18 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4850,7 +4850,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; @@ -4923,12 +4924,14 @@ 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); if (cfg->chardevTLS) { char *objalias = NULL; @@ -4950,7 +4953,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, 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: @@ -5274,7 +5277,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); @@ -5432,7 +5435,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; } @@ -8334,7 +8337,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager, if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def, &smartcard->data.passthru, smartcard->info.alias, - qemuCaps))) { + qemuCaps, true))) { virBufferFreeAndReset(&opt); return -1; } @@ -8423,7 +8426,7 @@ qemuBuildShmemBackendChrStr(virLogManagerPtr logManager, devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def, &shmem->server.chr, - shmem->info.alias, qemuCaps); + shmem->info.alias, qemuCaps, true); return devstr; } @@ -8527,7 +8530,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); @@ -8566,7 +8569,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); @@ -8612,7 +8615,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); @@ -8635,7 +8638,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); @@ -8678,7 +8681,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); @@ -8692,7 +8695,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); @@ -8821,7 +8824,7 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager, if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def, &redirdev->source.chr, redirdev->info.alias, - qemuCaps))) { + qemuCaps, true))) { return -1; }