]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Don't force port=0 for SPICE
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 12 Nov 2012 17:03:24 +0000 (18:03 +0100)
committerCole Robinson <crobinso@redhat.com>
Sun, 9 Dec 2012 21:27:30 +0000 (16:27 -0500)
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

index d6fc0fc1b7e0c9a7e5de1ed8ce47e910a7460824..13e1c6fd339515b6ccb4362200c75b5fdb9586d0 100644 (file)
@@ -6045,6 +6045,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",
@@ -6052,17 +6054,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)) {