File libvirt-qemu-Don-t-force-port-0-for-SPICE.patch of Package libvirt
From 1ec47b90d8b0e346f7556b479a37d11bcaebdd41 Mon Sep 17 00:00:00 2001
Message-Id: <1ec47b90d8b0e346f7556b479a37d11bcaebdd41.1373885145.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 8 Jul 2013 09:26:41 +0200
Subject: [PATCH] qemu: Don't force port=0 for SPICE
https://bugzilla.redhat.com/show_bug.cgi?id=975751
If domain uses only TLS port we don't want to add
'port=0' explicitly to command line.
(cherry picked from commit 9f872472357cc014f6aa6068c26d7cf971343439)
---
src/qemu/qemu_command.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01dee16..c34614f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6096,6 +6096,8 @@ qemuBuildCommandLine(virConnectPtr conn,
char *netAddr = NULL;
int ret;
int defaultMode = def->graphics[0]->data.spice.defaultMode;
+ int port = def->graphics[0]->data.spice.port;
+ int tlsPort = def->graphics[0]->data.spice.tlsPort;
if (!qemuCapsGet(caps, QEMU_CAPS_SPICE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -6103,17 +6105,19 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
}
- virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port);
+ if (port > 0 || tlsPort <= 0)
+ virBufferAsprintf(&opt, "port=%u", port);
- if (def->graphics[0]->data.spice.tlsPort > 0) {
+ if (tlsPort > 0) {
if (!driver->spiceTLS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("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);
+ if (port > 0)
+ virBufferAddChar(&opt, ',');
+ virBufferAsprintf(&opt, "tls-port=%u", tlsPort);
}
switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) {
--
1.8.3.2