[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 28 of 32 RFC] libxl: initialise NULL==default members of build info later
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1326712734 0 # Node ID 90fe4b95bdc935b2d5328603aa77d4de37253c36 # Parent b8426902efa002b6941aee6dff109aa33a4372c8 libxl: initialise NULL==default members of build info later. Specifically do it at setdefaults time instead of init time. I'm not entirely sure if video_memkb can legitimately be 0. Hopefully this corresponds to 'nographics' instead. I think the rest are reasonable although it's not clear that shadow_memkb doesn't belong in u.hvm I didn't change that here. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r b8426902efa0 -r 90fe4b95bdc9 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Fri Jan 13 17:04:57 2012 +0000 +++ b/tools/libxl/libxl_create.c Mon Jan 16 11:18:54 2012 +0000 @@ -82,12 +82,6 @@ int libxl_init_build_info(libxl_ctx *ctx const libxl_domain_create_info *c_info) { memset(b_info, '\0', sizeof(*b_info)); - b_info->max_vcpus = 1; - b_info->cur_vcpus = 1; - b_info->max_memkb = 32 * 1024; - b_info->target_memkb = b_info->max_memkb; - b_info->cpuid = NULL; - b_info->shadow_memkb = 0; b_info->type = c_info->type; b_info->device_model_version = @@ -97,16 +91,7 @@ int libxl_init_build_info(libxl_ctx *ctx switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: - b_info->video_memkb = 8 * 1024; - b_info->u.hvm.firmware = NULL; b_info->u.hvm.timer_mode = 1; - - b_info->u.hvm.vnc.listen = strdup("127.0.0.1"); - b_info->u.hvm.vnc.display = 0; - b_info->u.hvm.keymap = NULL; - b_info->u.hvm.serial = NULL; - b_info->u.hvm.boot = strdup("cda"); - b_info->u.hvm.usbdevice = NULL; break; case LIBXL_DOMAIN_TYPE_PV: b_info->u.pv.slack_memkb = 8 * 1024; @@ -123,9 +108,21 @@ int libxl_init_build_info(libxl_ctx *ctx int libxl__domain_build_info_setdefaults(libxl__gc *gc, libxl_domain_build_info *b_info) { + if (!b_info->max_vcpus) + b_info->max_vcpus = 1; + if (!b_info->cur_vcpus) + b_info->cur_vcpus = 1; + if (!b_info->max_memkb) + b_info->max_memkb = 32 * 1024; + if (!b_info->target_memkb) + b_info->target_memkb = b_info->max_memkb; + libxl_defbool_setdefault(&b_info->disable_migrate, false); switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: + if (!b_info->video_memkb) + b_info->video_memkb = 8 * 1024; + libxl_defbool_setdefault(&b_info->u.hvm.pae, true); libxl_defbool_setdefault(&b_info->u.hvm.apic, true); libxl_defbool_setdefault(&b_info->u.hvm.acpi, true); @@ -139,10 +136,15 @@ int libxl__domain_build_info_setdefaults libxl_defbool_setdefault(&b_info->u.hvm.usb, false); libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true); + if (!b_info->u.hvm.boot) + b_info->u.hvm.boot = strdup("cda"); + libxl_defbool_setdefault(&b_info->u.hvm.stdvga, false); 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); + if (!b_info->u.hvm.vnc.listen) + b_info->u.hvm.vnc.listen = strdup("127.0.0.1"); } libxl_defbool_setdefault(&b_info->u.hvm.sdl.enable, false); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |