[libvirt] [PATCH 2/2] qemu: graphics support for simultaneous one of each sdl, vnc, spice

Alon Levy alevy at redhat.com
Thu Nov 8 08:48:56 UTC 2012


---
 src/qemu/qemu_command.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f9e4d4d..fcdf60c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6186,9 +6186,26 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     if (def->ngraphics > 1) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("only 1 graphics device is supported"));
-        goto error;
+        int sdl = 0, vnc = 0, spice = 0;
+        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 (sdl > 1 || vnc > 1 || spice > 1) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("only 1 graphics device of each type "
+                                   "(sdl, vnc, spice) is supported"));
+            goto error;
+        }
     }
 
     for (i = 0 ; i < def->ngraphics ; ++i) {
-- 
1.8.0




More information about the libvir-list mailing list