]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
qemu: graphics support for simultaneous one of each sdl, vnc, spice
authorAlon Levy <alevy@redhat.com>
Sat, 10 Nov 2012 01:40:24 +0000 (02:40 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 20 Nov 2012 18:57:39 +0000 (19:57 +0100)
src/qemu/qemu_command.c

index 432fce314fec4e60619308aae511f34c37bef94b..37693bc8ccc5f66f72ff9d01c2d7908b4a882edb 100644 (file)
@@ -4787,6 +4787,9 @@ qemuBuildCommandLine(virConnectPtr conn,
     bool hasHwVirt = false;
     virCommandPtr cmd = NULL;
     bool emitBootindex = false;
+    int sdl = 0;
+    int vnc = 0;
+    int spice = 0;
     int usbcontroller = 0;
     bool usblegacy = false;
     uname_normalize(&ut);
@@ -6201,9 +6204,28 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (def->ngraphics > 1) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("only 1 graphics device is supported"));
+    for (i = 0 ; i < def->ngraphics ; ++i) {
+        switch (def->graphics[i]->type) {
+        case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+            ++sdl;
+            break;
+        case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+            ++vnc;
+            break;
+        case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+            ++spice;
+            break;
+        }
+    }
+    if (!qemuCapsGet(caps, QEMU_CAPS_0_10) && sdl + vnc + spice > 1) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("only 1 graphics device is supported"));
+        goto error;
+    }
+    if (sdl > 1 || vnc > 1 || spice > 1) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("only 1 graphics device of each type "
+                         "(sdl, vnc, spice) is supported"));
         goto error;
     }