[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V4 21/24] xl: update domain configuration when running mem-set and mem-max
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 55 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index f891ab5..83f058e 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -2745,6 +2745,7 @@ int main_memmax(int argc, char **argv) int opt = 0; char *mem; int rc; + libxl_domain_config d_config; SWITCH_FOREACH_OPT(opt, "", NULL, "mem-max", 2) { /* No options */ @@ -2756,10 +2757,34 @@ int main_memmax(int argc, char **argv) rc = set_memory_max(domid, mem); if (rc) { fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem); - return 1; + rc = 1; + goto out; } - return 0; + libxl_domain_config_init(&d_config); + if (load_domain_config(domid, &d_config)) { + fprintf(stderr, "cannot load domain configuration from userdata store, " + "not updating configuration\n"); + rc = 1; + goto out_dispose; + } + + /* parse_mem_size_kb cannot fail, otherwise we won't be here. */ + d_config.b_info.max_memkb = parse_mem_size_kb(mem); + + if (store_domain_config(domid, &d_config)) { + fprintf(stderr, "cannot store domain configuration from userdata store, " + "not updating configuration\n"); + rc = 1; + goto out_dispose; + } + + rc = 0; + +out_dispose: + libxl_domain_config_dispose(&d_config); +out: + return rc; } static void set_memory_target(uint32_t domid, const char *mem) @@ -2780,6 +2805,8 @@ int main_memset(int argc, char **argv) uint32_t domid; int opt = 0; const char *mem; + libxl_domain_config d_config; + int rc = 1; SWITCH_FOREACH_OPT(opt, "", NULL, "mem-set", 2) { /* No options */ @@ -2789,7 +2816,29 @@ int main_memset(int argc, char **argv) mem = argv[optind + 1]; set_memory_target(domid, mem); - return 0; + + libxl_domain_config_init(&d_config); + if (load_domain_config(domid, &d_config)) { + fprintf(stderr, "cannot load domain configuration from userdata store, " + "not updating configuration\n"); + rc = 1; + goto out; + } + + /* parse_mem_size_kb cannot fail, otherwise we won't be here. */ + d_config.b_info.target_memkb = parse_mem_size_kb(mem); + + if (store_domain_config(domid, &d_config)) { + fprintf(stderr, "cannot store domain configuration from userdata store, " + "not updating configuration\n"); + rc = 1; + goto out; + } + + rc = 0; +out: + libxl_domain_config_dispose(&d_config); + return rc; } static int cd_insert(uint32_t domid, const char *virtdev, char *phys) -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |