PATCH: Remove duplicate graphics for HVM on 3.0.5

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

 



In the Xen 3.0.5 series, the HVM graphics config was moved to use the same
syntax as Paravirt (ie the pvfb devices). I previously added support for 
this, but didn't realize that the old syntax was kept as back-compat when
doing 'xm list --long' or equiv. So we're ending up with 2 <graphics>
elements with the same information. This patch makes us ignore the old 
style config if running on new XenD.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
Index: xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.113
diff -u -p -r1.113 xend_internal.c
--- xend_internal.c	2 May 2007 17:36:25 -0000	1.113
+++ xend_internal.c	3 May 2007 16:47:31 -0000
@@ -1689,35 +1689,38 @@ xend_parse_sexp_desc(virConnectPtr conn,
         }
     }
 
-    /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.4) vnc config */
-    tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
-    if (tmp != NULL) {
-        if (tmp[0] == '1') {
-            int port = xenStoreDomainGetVNCPort(conn, domid);
-            const char *listenAddr = sexpr_fmt_node(root, "domain/image/%s/vnclisten", hvm ? "hvm" : "linux");
-            const char *keymap = sexpr_fmt_node(root, "domain/image/%s/keymap", hvm ? "hvm" : "linux");
-            /* For Xen >= 3.0.3, don't generate a fixed port mapping
-             * because it will almost certainly be wrong ! Just leave
-             * it as -1 which lets caller see that the VNC server isn't
-             * present yet. Subsquent dumps of the XML will eventually
-             * find the port in XenStore once VNC server has started
-             */
-            if (port == -1 && xendConfigVersion < 2)
-                port = 5900 + domid;
-            virBufferVSprintf(&buf, "    <graphics type='vnc' port='%d'", port);
-            if (listenAddr)
-                virBufferVSprintf(&buf, " listen='%s'", listenAddr);
-            if (keymap)
-                virBufferVSprintf(&buf, " keymap='%s'", keymap);
-            virBufferAdd(&buf, "/>\n", 3);
+    /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
+    if ((hvm && xendConfigVersion < 4) ||
+        (!hvm && xendConfigVersion < 3)) {
+        tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
+        if (tmp != NULL) {
+            if (tmp[0] == '1') {
+                int port = xenStoreDomainGetVNCPort(conn, domid);
+                const char *listenAddr = sexpr_fmt_node(root, "domain/image/%s/vnclisten", hvm ? "hvm" : "linux");
+                const char *keymap = sexpr_fmt_node(root, "domain/image/%s/keymap", hvm ? "hvm" : "linux");
+                /* For Xen >= 3.0.3, don't generate a fixed port mapping
+                 * because it will almost certainly be wrong ! Just leave
+                 * it as -1 which lets caller see that the VNC server isn't
+                 * present yet. Subsquent dumps of the XML will eventually
+                 * find the port in XenStore once VNC server has started
+                 */
+                if (port == -1 && xendConfigVersion < 2)
+                    port = 5900 + domid;
+                virBufferVSprintf(&buf, "    <graphics type='vnc' port='%d'", port);
+                if (listenAddr)
+                    virBufferVSprintf(&buf, " listen='%s'", listenAddr);
+                if (keymap)
+                    virBufferVSprintf(&buf, " keymap='%s'", keymap);
+                virBufferAdd(&buf, "/>\n", 3);
+            }
         }
-    }
 
-    /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
-    tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
-    if (tmp != NULL) {
-        if (tmp[0] == '1')
-            virBufferAdd(&buf, "    <graphics type='sdl'/>\n", 27 );
+        /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
+        tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
+        if (tmp != NULL) {
+            if (tmp[0] == '1')
+                virBufferAdd(&buf, "    <graphics type='sdl'/>\n", 27 );
+        }
     }
 
     tty = xenStoreDomainGetConsolePath(conn, domid);

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]