[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxenlight: add a list-vm options to xl that only list vms uuid, domid, name
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1263751532 0 # Node ID ff2d29e6ab9cc37e7785fc1758fa9c4b565356d5 # Parent abc717dc6c2ad1fb371d72d20380c5b6e9f146d3 libxenlight: add a list-vm options to xl that only list vms uuid, domid, name Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx> --- tools/libxl/xl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+) diff -r abc717dc6c2a -r ff2d29e6ab9c tools/libxl/xl.c --- a/tools/libxl/xl.c Sun Jan 17 18:05:03 2010 +0000 +++ b/tools/libxl/xl.c Sun Jan 17 18:05:32 2010 +0000 @@ -1433,6 +1433,36 @@ void list_domains(void) free(info); } +void list_vm(void) +{ + struct libxl_ctx ctx; + struct libxl_vminfo *info; + int nb_vm, i; + + if (libxl_ctx_init(&ctx, LIBXL_VERSION)) { + fprintf(stderr, "cannot init xl context\n"); + return; + } + libxl_ctx_set_log(&ctx, log_callback, NULL); + + info = libxl_list_vm(&ctx, &nb_vm); + + if (info < 0) { + fprintf(stderr, "libxl_domain_infolist failed.\n"); + exit(1); + } + printf("UUID ID name\n"); + for (i = 0; i < nb_vm; i++) { + printf(UUID_FMT " %d %-30s\n", + info[i].uuid[0], info[i].uuid[1], info[i].uuid[2], info[i].uuid[3], + info[i].uuid[4], info[i].uuid[5], info[i].uuid[6], info[i].uuid[7], + info[i].uuid[8], info[i].uuid[9], info[i].uuid[10], info[i].uuid[11], + info[i].uuid[12], info[i].uuid[13], info[i].uuid[14], info[i].uuid[15], + info[i].domid, libxl_domid_to_name(&ctx, info[i].domid)); + } + free(info); +} + int save_domain(char *p, char *filename, int checkpoint) { struct libxl_ctx ctx; @@ -1633,6 +1663,25 @@ int main_list(int argc, char **argv) exit(0); } +int main_list_vm(int argc, char **argv) +{ + int opt; + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("list-vm"); + exit(0); + default: + fprintf(stderr, "option not supported\n"); + break; + } + } + + list_vm(); + exit(0); +} + int main_create(int argc, char **argv) { char *filename = NULL; @@ -1679,6 +1728,8 @@ int main(int argc, char **argv) main_create(argc - 1, argv + 1); } else if (!strcmp(argv[1], "list")) { main_list(argc - 1, argv + 1); + } else if (!strcmp(argv[1], "list-vm")) { + main_list_vm(argc - 1, argv + 1); } else if (!strcmp(argv[1], "destroy")) { main_destroy(argc - 1, argv + 1); } else if (!strcmp(argv[1], "pci-attach")) { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |