On Wed, Mar 16, 2016 at 05:45:05PM +0100, Christophe Fergeau wrote:
If a <graphics type='spice'> has no port nor tlsPort
set, the generated
QEMU command line will contain -spice port=0.
This is later going to be ignored by spice-server, but it's better not
to add it at all in this situation.
As an empty -spice is not allowed, we still need to append port=0 if we
did not add any other argument.
---
src/qemu/qemu_command.c | 11 +++++++++--
.../qemuxml2argv-graphics-spice-no-args.args | 21 +++++++++++++++++++++
.../qemuxml2argv-graphics-spice-no-args.xml | 22 ++++++++++++++++++++++
.../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +-
tests/qemuxml2argvtest.c | 2 ++
5 files changed, 55 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.xml
ACK
@@ -7234,7 +7234,14 @@
qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
virBufferTrim(&opt, ",", -1);
virCommandAddArg(cmd, "-spice");
- virCommandAddArgBuffer(cmd, &opt);
+ /* If we did not add any SPICE arguments, add a dummy 'port=0' one
+ * as -spice alone is not allowed on QEMU command line and will be
+ * ignored by libvirt
I am confused by the "will be ignored by libvirt" part.
Jan
+ */
+ if (virBufferUse(&opt) == 0)
+ virCommandAddArg(cmd, "port=0");
+ else
+ virCommandAddArgBuffer(cmd, &opt);
if (graphics->data.spice.keymap)