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

[Xen-devel] [PATCH 14 of 32 RFC] libxl: HVM device configuration info build_info->u.hvm



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1326367397 0
# Node ID 540c9fa96606437f319762663b0892af9e79a6f3
# Parent  0ef52f0b6c58344ee371d668ea343628aaecb714
libxl: HVM device configuration info build_info->u.hvm

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 0ef52f0b6c58 -r 540c9fa96606 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Jan 12 11:19:52 2012 +0000
+++ b/tools/libxl/libxl_create.c        Thu Jan 12 11:23:17 2012 +0000
@@ -109,6 +109,11 @@ int libxl_init_build_info(libxl_ctx *ctx
         b_info->u.hvm.sdl.enable = 0;
         b_info->u.hvm.sdl.opengl = 0;
         b_info->u.hvm.nographic = 0;
+        b_info->u.hvm.serial = NULL;
+        b_info->u.hvm.boot = strdup("cda");
+        b_info->u.hvm.usb = 0;
+        b_info->u.hvm.usbdevice = NULL;
+        b_info->u.hvm.xen_platform_pci = 1;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         b_info->u.pv.slack_memkb = 8 * 1024;
@@ -135,11 +140,6 @@ int libxl_init_dm_info(libxl_ctx *ctx,
     dm_info->device_model_stubdomain = false;
     dm_info->device_model = NULL;
 
-    dm_info->serial = NULL;
-    dm_info->boot = strdup("cda");
-    dm_info->usb = 0;
-    dm_info->usbdevice = NULL;
-    dm_info->xen_platform_pci = 1;
     return 0;
 }
 
diff -r 0ef52f0b6c58 -r 540c9fa96606 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Jan 12 11:19:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Thu Jan 12 11:23:17 2012 +0000
@@ -179,12 +179,13 @@ static char ** libxl__build_device_model
     if (keymap) {
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -199,17 +200,18 @@ static char ** libxl__build_device_model
             flexarray_append(dm_args, "-std-vga");
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", info->boot, NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot", b_info->u.hvm.boot, NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, 
NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, 
NULL);
         }
         if (b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-acpi");
@@ -406,12 +408,13 @@ static char ** libxl__build_device_model
         flexarray_vappend(dm_args, "-k", keymap, NULL);
     }
 
-    if (info->serial) {
-        flexarray_vappend(dm_args, "-serial", info->serial, NULL);
-    }
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         int ioemu_vifs = 0;
 
+        if (b_info->u.hvm.serial) {
+            flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
+        }
+
         if (b_info->u.hvm.nographic && (!sdl && !vnc)) {
             flexarray_append(dm_args, "-nographic");
         }
@@ -430,17 +433,19 @@ static char ** libxl__build_device_model
                 flexarray_vappend(dm_args, "-vga", "std", NULL);
         }
 
-        if (info->boot) {
-            flexarray_vappend(dm_args, "-boot", libxl__sprintf(gc, "order=%s", 
info->boot), NULL);
+        if (b_info->u.hvm.boot) {
+            flexarray_vappend(dm_args, "-boot",
+                    libxl__sprintf(gc, "order=%s", b_info->u.hvm.boot), NULL);
         }
-        if (info->usb || info->usbdevice) {
+        if (b_info->u.hvm.usb || b_info->u.hvm.usbdevice) {
             flexarray_append(dm_args, "-usb");
-            if (info->usbdevice) {
-                flexarray_vappend(dm_args, "-usbdevice", info->usbdevice, 
NULL);
+            if (b_info->u.hvm.usbdevice) {
+                flexarray_vappend(dm_args,
+                                  "-usbdevice", b_info->u.hvm.usbdevice, NULL);
             }
         }
-        if (info->soundhw) {
-            flexarray_vappend(dm_args, "-soundhw", info->soundhw, NULL);
+        if (b_info->u.hvm.soundhw) {
+            flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, 
NULL);
         }
         if (!b_info->u.hvm.acpi) {
             flexarray_append(dm_args, "-no-acpi");
@@ -788,7 +793,7 @@ retry_transaction:
     if (ret)
         goto out_free;
 
-    if (info->serial)
+    if (guest_config->b_info.u.hvm.serial)
         num_console++;
 
     console = libxl__calloc(gc, num_console, sizeof(libxl_device_console));
@@ -916,7 +921,8 @@ int libxl__create_device_model(libxl__gc
 
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
-    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), 
"%d", !info->xen_platform_pci);
+    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path),
+                    "%d", !guest_config->b_info.u.hvm.xen_platform_pci);
 
     libxl_create_logfile(ctx,
                          libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
diff -r 0ef52f0b6c58 -r 540c9fa96606 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Thu Jan 12 11:19:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Thu Jan 12 11:23:17 2012 +0000
@@ -226,6 +226,16 @@ libxl_domain_build_info = Struct("domain
                                        ("keymap",           string),
                                        ("sdl",              libxl_sdl_info),
                                        ("spice",            libxl_spice_info),
+                                       
+                                       ("serial",           string),
+                                       ("boot",             string),
+                                       ("usb",              bool),
+                                       # usbdevice:
+                                       # - "tablet" for absolute mouse,
+                                       # - "mouse" for PS/2 protocol relative 
mouse
+                                       ("usbdevice",        string),
+                                       ("soundhw",          string),
+                                       ("xen_platform_pci", bool),
                                        ])),
                  ("pv", Struct(None, [("kernel", libxl_file_reference),
                                       ("slack_memkb", uint32),
@@ -255,13 +265,6 @@ libxl_device_model_info = Struct("device
     ("saved_state",      string),
     ("type",             libxl_domain_type),
     ("gfx_passthru",     bool),
-    ("serial",           string),
-    ("boot",             string),
-    ("usb",              bool),
-    # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol 
relative mouse
-    ("usbdevice",        string),
-    ("soundhw",          string),
-    ("xen_platform_pci", bool),
     # extra parameters pass directly to qemu, NULL terminated
     ("extra",            libxl_string_list),
     # extra parameters pass directly to qemu for PV guest, NULL terminated
diff -r 0ef52f0b6c58 -r 540c9fa96606 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Jan 12 11:19:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Jan 12 11:23:17 2012 +0000
@@ -380,10 +380,10 @@ static void printf_info(int domid,
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model ? : 
"default");
         printf("\t\t\t(gfx_passthru %d)\n", dm_info->gfx_passthru);
-        printf("\t\t\t(serial %s)\n", dm_info->serial);
-        printf("\t\t\t(boot %s)\n", dm_info->boot);
-        printf("\t\t\t(usb %d)\n", dm_info->usb);
-        printf("\t\t\t(usbdevice %s)\n", dm_info->usbdevice);
+        printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial);
+        printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot);
+        printf("\t\t\t(usb %d)\n", b_info->u.hvm.usb);
+        printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice);
         printf("\t\t)\n");
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -1209,14 +1209,14 @@ skip_vfb:
             b_info->u.hvm.nographic = l;
         if (!xlu_cfg_get_long (config, "gfx_passthru", &l, 0))
             dm_info->gfx_passthru = l;
-        xlu_cfg_replace_string (config, "serial", &dm_info->serial, 0);
-        xlu_cfg_replace_string (config, "boot", &dm_info->boot, 0);
+        xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
+        xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
         if (!xlu_cfg_get_long (config, "usb", &l, 0))
-            dm_info->usb = l;
-        xlu_cfg_replace_string (config, "usbdevice", &dm_info->usbdevice, 0);
-        xlu_cfg_replace_string (config, "soundhw", &dm_info->soundhw, 0);
+            b_info->u.hvm.usb = l;
+        xlu_cfg_replace_string (config, "usbdevice", &b_info->u.hvm.usbdevice, 
0);
+        xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 0);
         if (!xlu_cfg_get_long (config, "xen_platform_pci", &l, 0))
-            dm_info->xen_platform_pci = l;
+            b_info->u.hvm.xen_platform_pci = l;
     }
 
     dm_info->type = c_info->type;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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