
On Wed, Mar 16, 2016 at 05:45:03PM +0100, Christophe Fergeau wrote:
The end goal is to avoid adding -spice port=0,addr=127.0.0.1 to QEMU command line when no SPICE port is specified in libvirt XML.
Currently, the code relies on port=xx to always be present, so subsequent args can be unconditionally appended with a leading ','. Since port=0 will no longer be added in a subsequent commit, we append a ',' to every arg instead of prepending, and remove the last one before adding it to the arg list. --- src/qemu/qemu_command.c | 68 +++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 30 deletions(-)
ACK
- if (graphics->data.spice.playback) - virBufferAsprintf(&opt, ",playback-compression=%s", + } + if (graphics->data.spice.playback) { + virBufferAsprintf(&opt, "playback-compression=%s,", virTristateSwitchTypeToString(graphics->data.spice.playback)); - if (graphics->data.spice.streaming) - virBufferAsprintf(&opt, ",streaming-video=%s", + } + if (graphics->data.spice.streaming) { + virBufferAsprintf(&opt, "streaming-video=%s,", virDomainGraphicsSpiceStreamingModeTypeToString(graphics->data.spice.streaming)); - if (graphics->data.spice.copypaste == VIR_TRISTATE_BOOL_NO) - virBufferAddLit(&opt, ",disable-copy-paste"); + } + if (graphics->data.spice.copypaste == VIR_TRISTATE_BOOL_NO) { + virBufferAddLit(&opt, "disable-copy-paste,"); + }
This breaks make syntax-check: Curly brackets around single-line body: src/qemu/qemu_command.c:7559-7561: if (graphics->data.spice.copypaste == VIR_TRISTATE_BOOL_NO) { virBufferAddLit(&opt, "disable-copy-paste,"); } Jan