[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 2/3] xl/create: warn if the 'vcpu' parameter exceeds host physical CPUs.
It can be a performance disadvantage to allocate more vCPUs for a guest that there are physical CPUs. If the guest config has such setup warn the user. The warning can be silenced by the usage of '--ignore-warn' (-i) parameter. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- docs/man/xl.pod.1 | 6 ++++++ tools/libxl/xl_cmdimpl.c | 21 ++++++++++++++++++--- tools/libxl/xl_cmdtable.c | 6 ++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index e09d330..2ebeb6c 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -147,6 +147,10 @@ It is possible to pass I<key=value> pairs on the command line to provide options as if they were written in the configuration file; these override whatever is in the I<configfile>. +=item B<-i>, B<--ignore-warn> + +Silence warnings. + =back B<EXAMPLES> @@ -496,7 +500,9 @@ Attach to domain's VNC server, forking a vncviewer process. Pass VNC password to vncviewer via stdin. +=item B<-i>, B<--ignore-warn> +Silence warnings. =back diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 3d23fb4..b83676c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -132,6 +132,7 @@ struct domain_create { int vnc; int vncautopass; int console_autoconnect; + int ignore_warn; const char *config_file; const char *extra_config; /* extra config string */ const char *restore_file; @@ -657,8 +658,14 @@ static void parse_config_data(const char *config_source, b_info->sched_params.extratime = l; if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) { + unsigned int host_cpu = libxl_get_max_cpus(ctx); b_info->max_vcpus = l; + if (l > host_cpu && dom_info && !dom_info->ignore_warn) + fprintf(stderr, "WARNING: You are overcommmitting! You have %d " \ + "physical CPUs and want %d vCPUs!\n", host_cpu, + b_info->max_vcpus); + if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) { fprintf(stderr, "Unable to allocate cpumap\n"); exit(1); @@ -3741,11 +3748,13 @@ int main_restore(int argc, char **argv) const char *config_file = NULL; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, monitor = 1, - console_autoconnect = 0, vnc = 0, vncautopass = 0; + console_autoconnect = 0, vnc = 0, vncautopass = 0, + ignore_warn = 0; int opt, rc; static struct option opts[] = { {"vncviewer", 0, 0, 'V'}, {"vncviewer-autopass", 0, 0, 'A'}, + {"ignore-warn", 0, 0, 'i'}, COMMON_LONG_OPTS, {0, 0, 0, 0} }; @@ -3773,6 +3782,8 @@ int main_restore(int argc, char **argv) case 'A': vnc = vncautopass = 1; break; + case 'i': + ignore_warn = 1; } if (argc-optind == 1) { @@ -3796,7 +3807,7 @@ int main_restore(int argc, char **argv) dom_info.vnc = vnc; dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect; - + dom_info.ignore_warn = ignore_warn; rc = create_domain(&dom_info); if (rc < 0) return -rc; @@ -4139,7 +4150,7 @@ int main_create(int argc, char **argv) char extra_config[1024]; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0, - quiet = 0, monitor = 1, vnc = 0, vncautopass = 0; + quiet = 0, monitor = 1, vnc = 0, vncautopass = 0, ignore_warn = 0; int opt, rc; static struct option opts[] = { {"dryrun", 0, 0, 'n'}, @@ -4147,6 +4158,7 @@ int main_create(int argc, char **argv) {"defconfig", 1, 0, 'f'}, {"vncviewer", 0, 0, 'V'}, {"vncviewer-autopass", 0, 0, 'A'}, + {"ignore-warn", 0, 0, 'i'}, COMMON_LONG_OPTS, {0, 0, 0, 0} }; @@ -4188,6 +4200,8 @@ int main_create(int argc, char **argv) case 'A': vnc = vncautopass = 1; break; + case 'i': + ignore_warn = 1; } extra_config[0] = '\0'; @@ -4216,6 +4230,7 @@ int main_create(int argc, char **argv) dom_info.vnc = vnc; dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect; + dom_info.ignore_warn = ignore_warn; rc = create_domain(&dom_info); if (rc < 0) diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 8a98c6a..6fc8932 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -33,7 +33,8 @@ struct cmd_spec cmd_table[] = { "-e Do not wait in the background for the death of the domain.\n" "-V, --vncviewer Connect to the VNC display after the domain is created.\n" "-A, --vncviewer-autopass\n" - " Pass VNC password to viewer via stdin." + " Pass VNC password to viewer via stdin.\n" + "-i, --ignore-warn Silence the warnings.", }, { "config-update", &main_config_update, 1, 1, @@ -172,7 +173,8 @@ struct cmd_spec cmd_table[] = { "-e Do not wait in the background for the death of the domain.\n" "-d Enable debug messages.\n" "-V, --vncviewer Connect to the VNC display after the domain is created.\n" - "-A, --vncviewer-autopass Pass VNC password to viewer via stdin." + "-A, --vncviewer-autopass Pass VNC password to viewer via stdin.\n" + "-i, --ignore-warn Silence warnings.", }, { "migrate-receive", &main_migrate_receive, 0, 1, -- 1.7.7.6 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |