[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info.
This enum give the ability to select between the MiniOS based stubdomain and the Linux based stubdomain. It can be written in a VM config file via "stubdomain_version" variable, but will be automatically filled by the appropriate value depending on the device_model_version. To use the stubdomain, it's the same config option "devive_model_stubdomain_override=1" to force the stubdomain. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- tools/libxl/libxl_create.c | 34 +++++++++++++++++++++++++++++----- tools/libxl/libxl_types.idl | 7 +++++++ tools/libxl/xl_cmdimpl.c | 14 ++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index ae72f21..8a6a254 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -166,12 +166,36 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, } 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->stubdomain_version) { + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_MINIOS; + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_LINUX; + break; + default: abort(); + } + } + + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + if (b_info->stubdomain_version != LIBXL_STUBDOMAIN_VERSION_MINIOS) { + LIBXL__LOG(CTX, XTL_ERROR, + "\"qemu-xen-traditional\" require \"minios\" as stubdomain"); + return ERROR_INVAL; + } + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + if (b_info->stubdomain_version != LIBXL_STUBDOMAIN_VERSION_LINUX) { + LIBXL__LOG(CTX, XTL_ERROR, + "\"qemu-xen\" require \"linux\" as stubdomain"); + return ERROR_INVAL; + } + break; + default: abort(); + } } if (!b_info->max_vcpus) diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index fcb1ecd..9aeb677 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -39,6 +39,12 @@ libxl_device_model_version = Enumeration("device_model_version", [ (2, "QEMU_XEN"), # Upstream based qemu-xen device model ]) +# Give the kernel running in the stub-domain +libxl_stubdomain_version = Enumeration("stubdomain_version", [ + (1, "MINIOS"), + (2, "LINUX"), + ]) + libxl_console_type = Enumeration("console_type", [ (1, "SERIAL"), (2, "PV"), @@ -278,6 +284,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", libxl_defbool), + ("stubdomain_version", libxl_stubdomain_version), # if you set device_model you must set device_model_version too ("device_model", string), ("device_model_ssidref", uint32), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 98ecf67..75340c7 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1451,8 +1451,22 @@ skip_vfb: } } else if (b_info->device_model) fprintf(stderr, "WARNING: device model override given without specific DM version\n"); + xlu_cfg_get_defbool (config, "device_model_stubdomain_override", &b_info->device_model_stubdomain, 0); + if (!xlu_cfg_get_string (config, "stubdomain_version", &buf, 0)) { + if (!strcmp(buf, "minios")) { + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_MINIOS; + libxl_defbool_set(&b_info->device_model_stubdomain, true); + } else if (!strcmp(buf, "linux")) { + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_LINUX; + libxl_defbool_set(&b_info->device_model_stubdomain, true); + } else { + fprintf(stderr, + "Unknown stubdomain_version \"%s\" specified\n", buf); + exit(1); + } + } if (!xlu_cfg_get_string (config, "device_model_stubdomain_seclabel", &buf, 0)) { -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |