[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxenlight: implement pause and unpause
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1259246980 0 # Node ID 2b5aafac93912b0ead8ce51d0595a905122398c0 # Parent 749b5d46e7a9ee2e23d23030f8d7fddb88cc8997 libxenlight: implement pause and unpause this patch adds domain pause and unpause commands to xl, implementing them using the already exiting functions libxl_domain_pause and libxl_domain_unpause. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- tools/libxl/xl.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+) diff -r 749b5d46e7a9 -r 2b5aafac9391 tools/libxl/xl.c --- a/tools/libxl/xl.c Thu Nov 26 13:51:16 2009 +0000 +++ b/tools/libxl/xl.c Thu Nov 26 14:49:40 2009 +0000 @@ -711,6 +711,8 @@ static void help(char *command) printf(" pci-attach insert a new pass-through pci device\n\n"); printf(" pci-detach remove a domain's pass-through pci device\n\n"); printf(" pci-list list pass-through pci devices for a domain\n\n"); + printf(" pause pause execution of a domain\n\n"); + printf(" unpause unpause a paused domain\n\n"); } else if(!strcmp(command, "create")) { printf("Usage: xl create <ConfigFile> [options] [vars]\n\n"); printf("Create a domain based on <ConfigFile>.\n\n"); @@ -729,6 +731,12 @@ static void help(char *command) } else if(!strcmp(command, "pci-list")) { printf("Usage: xl pci-list <Domain>\n\n"); printf("List pass-through pci devices for a domain.\n\n"); + } else if(!strcmp(command, "pause")) { + printf("Usage: xl pause <Domain>\n\n"); + printf("Pause execution of a domain.\n\n"); + } else if(!strcmp(command, "unpause")) { + printf("Usage: xl unpause <Domain>\n\n"); + printf("Unpause a paused domain.\n\n"); } else if(!strcmp(command, "destroy")) { printf("Usage: xl destroy <Domain>\n\n"); printf("Terminate a domain immediately.\n\n"); @@ -881,6 +889,35 @@ int main_pciattach(int argc, char **argv exit(0); } +void pause_domain(char *p) +{ + struct libxl_ctx ctx; + uint32_t domid; + + libxl_ctx_init(&ctx); + libxl_ctx_set_log(&ctx, log_callback, NULL); + + if (libxl_param_to_domid(&ctx, p, &domid) < 0) { + fprintf(stderr, "%s is an invalid domain identifier\n", p); + exit(2); + } + libxl_domain_pause(&ctx, domid); +} + +void unpause_domain(char *p) +{ + struct libxl_ctx ctx; + uint32_t domid; + + libxl_ctx_init(&ctx); + libxl_ctx_set_log(&ctx, log_callback, NULL); + + if (libxl_param_to_domid(&ctx, p, &domid) < 0) { + fprintf(stderr, "%s is an invalid domain identifier\n", p); + exit(2); + } + libxl_domain_unpause(&ctx, domid); +} void destroy_domain(char *p) { @@ -930,6 +967,60 @@ void list_domains(void) free(info); } +int main_pause(int argc, char **argv) +{ + int opt; + char *p; + + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("pause"); + exit(0); + default: + fprintf(stderr, "option not supported\n"); + break; + } + } + if (optind >= argc) { + help("pause"); + exit(2); + } + + p = argv[optind]; + + pause_domain(p); + exit(0); +} + +int main_unpause(int argc, char **argv) +{ + int opt; + char *p; + + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("unpause"); + exit(0); + default: + fprintf(stderr, "option not supported\n"); + break; + } + } + if (optind >= argc) { + help("unpause"); + exit(2); + } + + p = argv[optind]; + + unpause_domain(p); + exit(0); +} + int main_destroy(int argc, char **argv) { int opt; @@ -1024,6 +1115,10 @@ int main(int argc, char **argv) main_pcidetach(argc - 1, argv + 1); } else if (!strcmp(argv[1], "pci-list")) { main_pcilist(argc - 1, argv + 1); + } else if (!strcmp(argv[1], "pause")) { + main_pause(argc - 1, argv + 1); + } else if (!strcmp(argv[1], "unpause")) { + main_unpause(argc - 1, argv + 1); } else if (!strcmp(argv[1], "help")) { if (argc > 2) help(argv[2]); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |