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

[Xen-devel] [PATCH 1/3] libxl:refactor stdvga option support v2



changeset:   25453:7bd08f83a2ce
user:        Zhou Peng <ailvpeng25@xxxxxxxxx>
date:        Tue Jun 05 17:39:37 2012 +0800
files:       tools/libxl/libxl.h tools/libxl/libxl_create.c
tools/libxl/libxl_dm.c tools/libxl/libxl_types.idl
tools/libxl/xl_cmdimpl.c tools/libxl/xl_sxp.c
description:
tools:libxl: refactor stdvga opinon support.

Be ready to add and describe new vga interface

Signed-off-by: Zhou Peng <ailvpeng25@xxxxxxxxx>


diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl.h       Tue Jun 05 17:39:37 2012 +0800
@@ -342,6 +342,7 @@ typedef struct libxl__ctx libxl_ctx;

 #define LIBXL_TIMER_MODE_DEFAULT -1
 #define LIBXL_MEMKB_DEFAULT ~0ULL
+#define LIBXL_VGA_INTERFACE_TYPE_DEFAULT -1

 #include "_libxl_types.h"

diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl_create.c        Tue Jun 05 17:39:37 2012 +0800
@@ -193,7 +193,8 @@ int libxl__domain_build_info_setdefault(
             if (!b_info->u.hvm.boot) return ERROR_NOMEM;
         }

-        libxl_defbool_setdefault(&b_info->u.hvm.stdvga, false);
+        if (b_info->u.hvm.vga.type == LIBXL_VGA_INTERFACE_TYPE_DEFAULT)
+            b_info->u.hvm.vga.type = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
         libxl_defbool_setdefault(&b_info->u.hvm.vnc.enable, true);
         if (libxl_defbool_val(b_info->u.hvm.vnc.enable)) {
             libxl_defbool_setdefault(&b_info->u.hvm.vnc.findunused, true);
diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl_dm.c    Tue Jun 05 17:39:37 2012 +0800
@@ -175,8 +175,13 @@ static char ** libxl__build_device_model
                                    libxl__sizekb_to_mb(b_info->video_memkb)),
                     NULL);
         }
-        if (libxl_defbool_val(b_info->u.hvm.stdvga)) {
+
+        switch (b_info->u.hvm.vga.type) {
+        case LIBXL_VGA_INTERFACE_TYPE_STD:
             flexarray_append(dm_args, "-std-vga");
+            break;
+        case LIBXL_VGA_INTERFACE_TYPE_CIRRUS:
+            break;
         }

         if (b_info->u.hvm.boot) {
@@ -418,8 +423,13 @@ static char ** libxl__build_device_model
             flexarray_append(dm_args, spiceoptions);
         }

-        if (libxl_defbool_val(b_info->u.hvm.stdvga)) {
-                flexarray_vappend(dm_args, "-vga", "std", NULL);
+        switch (b_info->u.hvm.vga.type) {
+        case LIBXL_VGA_INTERFACE_TYPE_STD:
+            flexarray_vappend(dm_args, "-vga", "std", NULL);
+            break;
+        case LIBXL_VGA_INTERFACE_TYPE_CIRRUS:
+            flexarray_vappend(dm_args, "-vga", "cirrus", NULL);
+            break;
         }

         if (b_info->u.hvm.boot) {
diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/libxl_types.idl       Tue Jun 05 17:39:37 2012 +0800
@@ -125,9 +125,19 @@ libxl_shutdown_reason = Enumeration("shu
     (4, "watchdog"),
     ])

+libxl_vga_interface_type = Enumeration("vga_interface_type", [
+    (0, "CIRRUS"),
+    (1, "STD"),
+    ], init_val = "LIBXL_VGA_INTERFACE_TYPE_DEFAULT")
+
 #
 # Complex libxl types
 #
+
+libxl_vga_interface_info = Struct("vga_interface_info", [
+    ("type",    libxl_vga_interface_type),
+    ])
+
 libxl_vnc_info = Struct("vnc_info", [
     ("enable",        libxl_defbool),
     # "address:port" that should be listened on
@@ -281,7 +291,7 @@ libxl_domain_build_info = Struct("domain
                                        ("nested_hvm",       libxl_defbool),
                                        ("incr_generationid",libxl_defbool),
                                        ("nographic",        libxl_defbool),
-                                       ("stdvga",           libxl_defbool),
+                                       ("vga",
libxl_vga_interface_info),
                                        ("vnc",              libxl_vnc_info),
                                        # keyboard layout, default is
en-us keyboard
                                        ("keymap",           string),
diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jun 05 17:39:37 2012 +0800
@@ -1256,7 +1256,10 @@ skip_vfb:
 #undef parse_extra_args

     if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) {
-        xlu_cfg_get_defbool(config, "stdvga", &b_info->u.hvm.stdvga, 0);
+        if (!xlu_cfg_get_long(config, "stdvga", &l, 0))
+            if (l)
+                b_info->u.hvm.vga.type = LIBXL_VGA_INTERFACE_TYPE_STD;
+
         xlu_cfg_get_defbool(config, "vnc", &b_info->u.hvm.vnc.enable, 0);
         xlu_cfg_replace_string (config, "vnclisten",
                                 &b_info->u.hvm.vnc.listen, 0);
diff -r 6bea63e6c780 -r 7bd08f83a2ce tools/libxl/xl_sxp.c
--- a/tools/libxl/xl_sxp.c      Sat Jun 02 08:39:45 2012 +0100
+++ b/tools/libxl/xl_sxp.c      Tue Jun 05 17:39:37 2012 +0800
@@ -110,8 +110,9 @@ void printf_info_sexp(int domid, libxl_d
                libxl_defbool_to_string(b_info->u.hvm.nested_hvm));
         printf("\t\t\t(no_incr_generationid %s)\n",
                libxl_defbool_to_string(b_info->u.hvm.incr_generationid));
-        printf("\t\t\t(stdvga %s)\n",
-               libxl_defbool_to_string(b_info->u.hvm.stdvga));
+        printf("\t\t\t(stdvga %s)\n", b_info->u.hvm.vga.type ==
+                                      LIBXL_VGA_INTERFACE_TYPE_STD ?
+                                      "True" : "False");
         printf("\t\t\t(vnc %s)\n",
                libxl_defbool_to_string(b_info->u.hvm.vnc.enable));
         printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen);


-- 
Zhou Peng

Attachment: spice.tools.libxl.stdvga.refactor.v2.diff
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.