libxl: disable usbredirection if spice is disabled
authorFabio Fantoni <fabio.fantoni@m2r.biz>
Tue, 27 May 2014 15:01:39 +0000 (17:01 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 18 Jun 2014 16:12:11 +0000 (17:12 +0100)
Now if usbredirection is enabled in domU's xl cfg is added also
if spice is disabled and then usbredirection remain unused.
This patch if usbredirection is enabled but spice not disable
usbredirection and show a warning.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- simplified log message ]

tools/libxl/libxl_create.c

index da1517c9f1dc9d4617e9425369741c81dfedde14..d6b8a29914e1ea193b3a2e79ff3910d2974f3f78 100644 (file)
@@ -292,6 +292,13 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         libxl_defbool_setdefault(&b_info->u.hvm.usb,                false);
         libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci,   true);
 
+        libxl_defbool_setdefault(&b_info->u.hvm.spice.enable, false);
+        if (!libxl_defbool_val(b_info->u.hvm.spice.enable) &&
+            (b_info->u.hvm.spice.usbredirection > 0) ){
+            b_info->u.hvm.spice.usbredirection = 0;
+            LOG(WARN, "spice disabled, disabling usbredirection");
+        }
+
         if (!b_info->u.hvm.usbversion &&
             (b_info->u.hvm.spice.usbredirection > 0) )
             b_info->u.hvm.usbversion = 2;
@@ -324,7 +331,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
             libxl_defbool_setdefault(&b_info->u.hvm.sdl.opengl, false);
         }
 
-        libxl_defbool_setdefault(&b_info->u.hvm.spice.enable, false);
         if (libxl_defbool_val(b_info->u.hvm.spice.enable)) {
             libxl_defbool_setdefault(&b_info->u.hvm.spice.disable_ticketing,
                                      false);