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@eu.citrix.com>
This commit is contained in:
Keir Fraser committed 2010-01-12 07:03:14 +00:00
1 parent f777e25427
commit 0d8907b049
1 file changed
+9 -1
+9 -1
View File
@@ -993,6 +993,8 @@ void set_memory_target(char *p, char *mem)
{
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 *mem)
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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.