[libvirt] [PATCH] qemu: Don't emit tls-port spice option if port is -1

Bug introduced by commit eda0fc7a. --- src/qemu/qemu_command.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 01adf0d..5e0ca95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5345,13 +5345,16 @@ qemuBuildCommandLine(virConnectPtr conn, virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port); - if (def->graphics[0]->data.spice.tlsPort != -1) + if (def->graphics[0]->data.spice.tlsPort != -1) { if (!driver->spiceTLS) { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spice TLS port set in XML configuration, but TLS is disabled in qemu.conf")); + _("spice TLS port set in XML configuration," + " but TLS is disabled in qemu.conf")); goto error; } - virBufferAsprintf(&opt, ",tls-port=%u", def->graphics[0]->data.spice.tlsPort); + virBufferAsprintf(&opt, ",tls-port=%u", + def->graphics[0]->data.spice.tlsPort); + } switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) { case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: -- 1.7.8.5

On Tue, Feb 28, 2012 at 02:16:56PM +0100, Jiri Denemark wrote:
Bug introduced by commit eda0fc7a. --- src/qemu/qemu_command.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 01adf0d..5e0ca95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5345,13 +5345,16 @@ qemuBuildCommandLine(virConnectPtr conn,
virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port);
- if (def->graphics[0]->data.spice.tlsPort != -1) + if (def->graphics[0]->data.spice.tlsPort != -1) { if (!driver->spiceTLS) { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spice TLS port set in XML configuration, but TLS is disabled in qemu.conf")); + _("spice TLS port set in XML configuration," + " but TLS is disabled in qemu.conf")); goto error; } - virBufferAsprintf(&opt, ",tls-port=%u", def->graphics[0]->data.spice.tlsPort); + virBufferAsprintf(&opt, ",tls-port=%u", + def->graphics[0]->data.spice.tlsPort); + }
switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) { case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
Is it possible to get this checked by the test cases, so we don't risk messing it up again ? Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Tue, Feb 28, 2012 at 13:21:21 +0000, Daniel P. Berrange wrote:
On Tue, Feb 28, 2012 at 02:16:56PM +0100, Jiri Denemark wrote:
Bug introduced by commit eda0fc7a. --- src/qemu/qemu_command.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 01adf0d..5e0ca95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5345,13 +5345,16 @@ qemuBuildCommandLine(virConnectPtr conn,
virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port);
- if (def->graphics[0]->data.spice.tlsPort != -1) + if (def->graphics[0]->data.spice.tlsPort != -1) { if (!driver->spiceTLS) { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spice TLS port set in XML configuration, but TLS is disabled in qemu.conf")); + _("spice TLS port set in XML configuration," + " but TLS is disabled in qemu.conf")); goto error; } - virBufferAsprintf(&opt, ",tls-port=%u", def->graphics[0]->data.spice.tlsPort); + virBufferAsprintf(&opt, ",tls-port=%u", + def->graphics[0]->data.spice.tlsPort); + }
switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) { case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
Is it possible to get this checked by the test cases, so we don't risk messing it up again ?
Possibly, although it won't save us from forgetting to add {} if we expand the body of such statements anywhere else in the code. Jirka
participants (3)
-
Daniel P. Berrange
-
Jiri Denemark
-
Michal Privoznik