[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 22 of 26 V3] libxl: switch device model selection over to libxl_defbool
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330000278 0 # Node ID 1953cd5c411dfbf2f83f17b7de7063e05e441045 # Parent 518c794143bb6d7f5a7c512096e06657a9bbb837 libxl: switch device model selection over to libxl_defbool This allows it to be set via the _init/_setdefault methods. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> [since last v -- ERROR_INVAL on stubdomains + !traditional qemu] diff -r 518c794143bb -r 1953cd5c411d tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Feb 23 12:31:17 2012 +0000 +++ b/tools/libxl/libxl.c Thu Feb 23 12:31:18 2012 +0000 @@ -2714,7 +2714,7 @@ int libxl_domain_need_memory(libxl_ctx * switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY; - if (b_info->device_model_stubdomain) + if (libxl_defbool_val(b_info->device_model_stubdomain)) *need_memkb += 32 * 1024; break; case LIBXL_DOMAIN_TYPE_PV: diff -r 518c794143bb -r 1953cd5c411d tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Thu Feb 23 12:31:17 2012 +0000 +++ b/tools/libxl/libxl_create.c Thu Feb 23 12:31:18 2012 +0000 @@ -80,9 +80,6 @@ void libxl_domain_build_info_init(libxl_ b_info->shadow_memkb = LIBXL_MEMKB_DEFAULT; b_info->video_memkb = LIBXL_MEMKB_DEFAULT; - b_info->device_model_stubdomain = false; - b_info->device_model = NULL; - switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: b_info->u.hvm.timer_mode = LIBXL_TIMER_MODE_DEFAULT; @@ -102,6 +99,17 @@ int libxl__domain_build_info_setdefault( b_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; + libxl_defbool_setdefault(&b_info->device_model_stubdomain, false); + + if (b_info->type == LIBXL_DOMAIN_TYPE_HVM && + b_info->device_model_version != + LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL && + libxl_defbool_val(b_info->device_model_stubdomain)) { + LIBXL__LOG(CTX, XTL_ERROR, + "device model stubdomains require \"qemu-xen-traditional\""); + return ERROR_INVAL; + } + if (!b_info->max_vcpus) b_info->max_vcpus = 1; if (!b_info->cur_vcpus) diff -r 518c794143bb -r 1953cd5c411d tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Thu Feb 23 12:31:17 2012 +0000 +++ b/tools/libxl/libxl_dm.c Thu Feb 23 12:31:18 2012 +0000 @@ -39,7 +39,7 @@ const char *libxl__domain_device_model(l libxl_ctx *ctx = libxl__gc_owner(gc); const char *dm; - if (info->device_model_stubdomain) + if (libxl_defbool_val(info->device_model_stubdomain)) return NULL; if (info->device_model) { @@ -909,7 +909,7 @@ int libxl__create_device_model(libxl__gc char **pass_stuff; const char *dm; - if (b_info->device_model_stubdomain) { + if (libxl_defbool_val(b_info->device_model_stubdomain)) { rc = libxl__create_stubdom(gc, domid, guest_config, state, starting_r); goto out; } diff -r 518c794143bb -r 1953cd5c411d tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Thu Feb 23 12:31:17 2012 +0000 +++ b/tools/libxl/libxl_types.idl Thu Feb 23 12:31:18 2012 +0000 @@ -234,8 +234,8 @@ libxl_domain_build_info = Struct("domain ("type", libxl_domain_type), ("device_model_version", libxl_device_model_version), - ("device_model_stubdomain", bool), - # you set device_model you must set device_model_version too + ("device_model_stubdomain", libxl_defbool), + # if you set device_model you must set device_model_version too ("device_model", string), ("device_model_ssidref", uint32), diff -r 518c794143bb -r 1953cd5c411d tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Feb 23 12:31:17 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Thu Feb 23 12:31:18 2012 +0000 @@ -1120,8 +1120,8 @@ skip_vfb: } } else if (b_info->device_model) fprintf(stderr, "WARNING: device model override given without specific DM version\n"); - if (!xlu_cfg_get_long (config, "device_model_stubdomain_override", &l, 0)) - b_info->device_model_stubdomain = l; + xlu_cfg_get_defbool (config, "device_model_stubdomain_override", + &b_info->device_model_stubdomain, 0); if (!xlu_cfg_get_string (config, "device_model_stubdomain_seclabel", &buf, 0)) { _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |