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

Re: [libvirt] [PATCH 2/2] support for multiple graphics devices



On Thu, Apr 30, 2009 at 11:28:31AM +0200, Pritesh Kothari wrote:
> Hi All,
> 
> I have added support for multiple graphics devices, the patches are as below.
> I have checked them against current cvs head and works fine
> 
> PATCH 1/2: contains changes in libvirt for multiple graphics devices
> PATCH 2/2: contains corresponding changes in qemu driver.

  Okay, both patches looks sane, but can't be applied until the Xen
drivers are updated too, patch enclosed,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
Index: src/xm_internal.c
===================================================================
RCS file: /data/cvs/libxen/src/xm_internal.c,v
retrieving revision 1.125
diff -u -r1.125 xm_internal.c
--- src/xm_internal.c	24 Apr 2009 12:17:50 -0000	1.125
+++ src/xm_internal.c	6 May 2009 16:07:11 -0000
@@ -1257,7 +1257,10 @@
             if (xenXMConfigCopyStringOpt(conn, conf, "keymap", &graphics->data.vnc.keymap) < 0)
                 goto cleanup;
 
-            def->graphics = graphics;
+            if (VIR_ALLOC_N(def->graphics, 1) < 0)
+                goto no_memory;
+            def->graphics[0] = graphics;
+            def->ngraphics = 1;
             graphics = NULL;
         } else {
             if (xenXMConfigGetBool(conn, conf, "sdl", &val, 0) < 0)
@@ -1270,7 +1273,10 @@
                     goto cleanup;
                 if (xenXMConfigCopyStringOpt(conn, conf, "xauthority", &graphics->data.sdl.xauth) < 0)
                     goto cleanup;
-                def->graphics = graphics;
+                if (VIR_ALLOC_N(def->graphics, 1) < 0)
+                    goto no_memory;
+                def->graphics[0] = graphics;
+                def->ngraphics = 1;
                 graphics = NULL;
             }
         }
@@ -1339,7 +1345,10 @@
                     nextkey++;
                 key = nextkey;
             }
-            def->graphics = graphics;
+            if (VIR_ALLOC_N(def->graphics, 1) < 0)
+                goto no_memory;
+            def->graphics[0] = graphics;
+            def->ngraphics = 1;
             graphics = NULL;
         }
     }
@@ -2305,20 +2314,20 @@
         }
     }
 
-    if (def->graphics) {
+    if (def->ngraphics == 1) {
         if (priv->xendConfigVersion < (hvm ? 4 : XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)) {
-            if (def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+            if (def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
                 if (xenXMConfigSetInt(conf, "sdl", 1) < 0)
                     goto no_memory;
                 if (xenXMConfigSetInt(conf, "vnc", 0) < 0)
                     goto no_memory;
-                if (def->graphics->data.sdl.display &&
+                if (def->graphics[0]->data.sdl.display &&
                     xenXMConfigSetString(conf, "display",
-                                         def->graphics->data.sdl.display) < 0)
+                                     def->graphics[0]->data.sdl.display) < 0)
                     goto no_memory;
-                if (def->graphics->data.sdl.xauth &&
+                if (def->graphics[0]->data.sdl.xauth &&
                     xenXMConfigSetString(conf, "xauthority",
-                                         def->graphics->data.sdl.xauth) < 0)
+                                         def->graphics[0]->data.sdl.xauth) < 0)
                     goto no_memory;
             } else {
                 if (xenXMConfigSetInt(conf, "sdl", 0) < 0)
@@ -2326,53 +2335,53 @@
                 if (xenXMConfigSetInt(conf, "vnc", 1) < 0)
                     goto no_memory;
                 if (xenXMConfigSetInt(conf, "vncunused",
-                                      def->graphics->data.vnc.autoport ? 1 : 0) < 0)
+                              def->graphics[0]->data.vnc.autoport ? 1 : 0) < 0)
                     goto no_memory;
-                if (!def->graphics->data.vnc.autoport &&
+                if (!def->graphics[0]->data.vnc.autoport &&
                     xenXMConfigSetInt(conf, "vncdisplay",
-                                      def->graphics->data.vnc.port - 5900) < 0)
+                                  def->graphics[0]->data.vnc.port - 5900) < 0)
                     goto no_memory;
-                if (def->graphics->data.vnc.listenAddr &&
+                if (def->graphics[0]->data.vnc.listenAddr &&
                     xenXMConfigSetString(conf, "vnclisten",
-                                         def->graphics->data.vnc.listenAddr) < 0)
+                                    def->graphics[0]->data.vnc.listenAddr) < 0)
                     goto no_memory;
-                if (def->graphics->data.vnc.passwd &&
+                if (def->graphics[0]->data.vnc.passwd &&
                     xenXMConfigSetString(conf, "vncpasswd",
-                                         def->graphics->data.vnc.passwd) < 0)
+                                        def->graphics[0]->data.vnc.passwd) < 0)
                     goto no_memory;
-                if (def->graphics->data.vnc.keymap &&
+                if (def->graphics[0]->data.vnc.keymap &&
                     xenXMConfigSetString(conf, "keymap",
-                                         def->graphics->data.vnc.keymap) < 0)
+                                        def->graphics[0]->data.vnc.keymap) < 0)
                     goto no_memory;
             }
         } else {
             virConfValuePtr vfb, disp;
             char *vfbstr = NULL;
             virBuffer buf = VIR_BUFFER_INITIALIZER;
-            if (def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+            if (def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
                 virBufferAddLit(&buf, "type=sdl");
-                if (def->graphics->data.sdl.display)
+                if (def->graphics[0]->data.sdl.display)
                     virBufferVSprintf(&buf, ",display=%s",
-                                      def->graphics->data.sdl.display);
-                if (def->graphics->data.sdl.xauth)
+                                      def->graphics[0]->data.sdl.display);
+                if (def->graphics[0]->data.sdl.xauth)
                     virBufferVSprintf(&buf, ",xauthority=%s",
-                                      def->graphics->data.sdl.xauth);
+                                      def->graphics[0]->data.sdl.xauth);
             } else {
                 virBufferAddLit(&buf, "type=vnc");
                 virBufferVSprintf(&buf, ",vncunused=%d",
-                                  def->graphics->data.vnc.autoport ? 1 : 0);
-                if (!def->graphics->data.vnc.autoport)
+                                  def->graphics[0]->data.vnc.autoport ? 1 : 0);
+                if (!def->graphics[0]->data.vnc.autoport)
                     virBufferVSprintf(&buf, ",vncdisplay=%d",
-                                      def->graphics->data.vnc.port - 5900);
-                if (def->graphics->data.vnc.listenAddr)
+                                      def->graphics[0]->data.vnc.port - 5900);
+                if (def->graphics[0]->data.vnc.listenAddr)
                     virBufferVSprintf(&buf, ",vnclisten=%s",
-                                      def->graphics->data.vnc.listenAddr);
-                if (def->graphics->data.vnc.passwd)
+                                      def->graphics[0]->data.vnc.listenAddr);
+                if (def->graphics[0]->data.vnc.passwd)
                     virBufferVSprintf(&buf, ",vncpasswd=%s",
-                                      def->graphics->data.vnc.passwd);
-                if (def->graphics->data.vnc.keymap)
+                                      def->graphics[0]->data.vnc.passwd);
+                if (def->graphics[0]->data.vnc.keymap)
                     virBufferVSprintf(&buf, ",keymap=%s",
-                                      def->graphics->data.vnc.keymap);
+                                      def->graphics[0]->data.vnc.keymap);
             }
             if (virBufferError(&buf))
                 goto no_memory;
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libxen/src/xend_internal.c,v
retrieving revision 1.260
diff -u -r1.260 xend_internal.c
--- src/xend_internal.c	24 Apr 2009 12:17:50 -0000	1.260
+++ src/xend_internal.c	6 May 2009 16:07:11 -0000
@@ -2023,7 +2023,11 @@
             !(graphics->data.vnc.keymap = strdup(keymap)))
             goto no_memory;
 
-        def->graphics = graphics;
+        if (VIR_ALLOC_N(def->graphics, 1) < 0)
+            goto no_memory;
+        def->graphics[0] = graphics;
+        def->ngraphics = 1;
+        graphics = NULL;
     } else if ((tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux")) &&
                tmp[0] == '1') {
         /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
@@ -2041,7 +2045,11 @@
             !(graphics->data.sdl.xauth = strdup(xauth)))
             goto no_memory;
 
-        def->graphics = graphics;
+        if (VIR_ALLOC_N(def->graphics, 1) < 0)
+            goto no_memory;
+        def->graphics[0] = graphics;
+        def->ngraphics = 1;
+        graphics = NULL;
     }
 
     return 0;
@@ -2130,7 +2138,11 @@
                     goto no_memory;
             }
 
-            def->graphics = graphics;
+            if (VIR_ALLOC_N(def->graphics, 1) < 0)
+                goto no_memory;
+            def->graphics[0] = graphics;
+            def->ngraphics = 1;
+            graphics = NULL;
             break;
         }
     }
@@ -2447,7 +2459,7 @@
         goto error;
 
     /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
-    if (!def->graphics &&
+    if ((def->ngraphics == 0) &&
         xenDaemonParseSxprGraphicsOld(conn, def, root, hvm, xendConfigVersion) < 0)
         goto error;
 
@@ -5731,8 +5743,9 @@
         /* PV graphics for xen <= 3.0.4, or HVM graphics for xen <= 3.1.0 */
         if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF) ||
             (hvm && xendConfigVersion < 4)) {
-            if (def->graphics &&
-                xenDaemonFormatSxprGraphicsOld(conn, def->graphics, &buf, xendConfigVersion) < 0)
+            if ((def->ngraphics == 1) &&
+                xenDaemonFormatSxprGraphicsOld(conn, def->graphics[0],
+                                               &buf, xendConfigVersion) < 0)
                 goto error;
         }
 
@@ -5756,8 +5769,8 @@
      * or HVM graphics config xen >= 3.0.5 */
     if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) ||
         (xendConfigVersion >= 4 && hvm)) {
-        if (def->graphics &&
-            xenDaemonFormatSxprGraphicsNew(conn, def->graphics, &buf) < 0)
+        if ((def->ngraphics == 1) &&
+            xenDaemonFormatSxprGraphicsNew(conn, def->graphics[0], &buf) < 0)
             goto error;
     }
 

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