[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] [PATCH] Support setting vnc port



We display the vncport, but never used it when creating the Xen sexpr.
Attached fixes that.  It also adds support for "port=-1" implying "use
the first unused port"[1]

Jeremy

[1] The xen and qemu "vncunused" parameter
? tests/conftest
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.37
diff -u -u -r1.37 xml.c
--- src/xml.c	26 Aug 2006 15:30:44 -0000	1.37
+++ src/xml.c	31 Aug 2006 16:52:15 -0000
@@ -596,8 +596,20 @@
             //virBufferAdd(buf, "(display localhost:10.0)", 24);
             //virBufferAdd(buf, "(xauthority /root/.Xauthority)", 30);
         }
-        else if (xmlStrEqual(graphics_type, BAD_CAST "vnc"))
+        else if (xmlStrEqual(graphics_type, BAD_CAST "vnc")) {
+            xmlChar *vncport = NULL;
+            long port;
+
             virBufferAdd(buf, "(vnc 1)", 7);
+            vncport = xmlGetProp(node, BAD_CAST "port");
+            if (vncport != NULL) {
+                port = strtol(vncport, NULL, 10);
+                if (port == -1)
+                    virBufferAdd(buf, "(vncunused 1)", 13);
+                else if (port > 5900)
+                    virBufferVSprintf(buf, "(vncdisplay %d)", port - 5900);
+            }
+        }
         xmlFree(graphics_type);
     }
     return 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]