[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxenlight: do not try to set memory target with a number we haven't
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1263279794 0 # Node ID 55109e7326cc47b95eaa43f8038e18026746048d # Parent 3edbffaab2069e4eaa3f866a24819b906fa6093b libxenlight: do not try to set memory target with a number we haven't verified in set-mem. checking that memory string conversion what done properly instead of sending a request to balloon a domain to 0 memory. Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx> --- tools/libxl/xl.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) diff -r 3edbffaab206 -r 55109e7326cc tools/libxl/xl.c --- a/tools/libxl/xl.c Tue Jan 12 07:02:29 2010 +0000 +++ b/tools/libxl/xl.c Tue Jan 12 07:03:14 2010 +0000 @@ -993,6 +993,8 @@ void set_memory_target(char *p, char *me { struct libxl_ctx ctx; uint32_t domid; + uint32_t memorykb; + char *endptr; if (libxl_ctx_init(&ctx, LIBXL_VERSION)) { fprintf(stderr, "cannot init xl context\n"); @@ -1004,7 +1006,13 @@ void set_memory_target(char *p, char *me fprintf(stderr, "%s is an invalid domain identifier\n", p); exit(2); } - libxl_set_memory_target(&ctx, domid, atoi(mem)); + memorykb = strtoul(mem, &endptr, 10); + if (*endptr != '\0') { + fprintf(stderr, "invalid memory size: %s\n", mem); + exit(3); + } + printf("setting domid %d memory to : %d\n", domid, memorykb); + libxl_set_memory_target(&ctx, domid, memorykb); } int main_memset(int argc, char **argv) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |