[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Implement xl dump-core



# HG changeset patch
# User Stefano Stabellini <sstabellini@xxxxxxxxxxxxx>
# Date 1279550018 -3600
# Node ID e81454d7c8a1ffb0090641d39f33d55788567df8
# Parent  317bf978887c58c05a8b6643b8abb4ea1f1bc3b7
Implement xl dump-core

Implements dump-core command which is similar to xm dump-core except
that it requires an additional argument which is the target filename.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
---
 tools/libxl/libxl.c       |    7 +++++++
 tools/libxl/libxl.h       |    2 ++
 tools/libxl/xl.h          |    1 +
 tools/libxl/xl_cmdimpl.c  |   18 ++++++++++++++++++
 tools/libxl/xl_cmdtable.c |    5 +++++
 5 files changed, 33 insertions(+)

diff -r 317bf978887c -r e81454d7c8a1 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jul 19 15:15:32 2010 +0100
+++ b/tools/libxl/libxl.c       Mon Jul 19 15:33:38 2010 +0100
@@ -520,6 +520,13 @@ int libxl_domain_pause(struct libxl_ctx 
 int libxl_domain_pause(struct libxl_ctx *ctx, uint32_t domid)
 {
     xc_domain_pause(ctx->xch, domid);
+    return 0;
+}
+
+int libxl_domain_core_dump(struct libxl_ctx *ctx, uint32_t domid, const char 
*filename)
+{
+    if ( xc_domain_dumpcore(ctx->xch, domid, filename) )
+        return ERROR_FAIL;
     return 0;
 }
 
diff -r 317bf978887c -r e81454d7c8a1 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Mon Jul 19 15:15:32 2010 +0100
+++ b/tools/libxl/libxl.h       Mon Jul 19 15:33:38 2010 +0100
@@ -395,6 +395,8 @@ int libxl_domain_pause(struct libxl_ctx 
 int libxl_domain_pause(struct libxl_ctx *ctx, uint32_t domid);
 int libxl_domain_unpause(struct libxl_ctx *ctx, uint32_t domid);
 
+int libxl_domain_core_dump(struct libxl_ctx *ctx, uint32_t domid, const char 
*filename);
+
 int libxl_domain_setmaxmem(struct libxl_ctx *ctx, uint32_t domid, uint32_t 
target_memkb);
 int libxl_set_memory_target(struct libxl_ctx *ctx, uint32_t domid, uint32_t 
target_memkb, int enforce);
 
diff -r 317bf978887c -r e81454d7c8a1 tools/libxl/xl.h
--- a/tools/libxl/xl.h  Mon Jul 19 15:15:32 2010 +0100
+++ b/tools/libxl/xl.h  Mon Jul 19 15:33:38 2010 +0100
@@ -37,6 +37,7 @@ int main_migrate_receive(int argc, char 
 int main_migrate_receive(int argc, char **argv);
 int main_save(int argc, char **argv);
 int main_migrate(int argc, char **argv);
+int main_dump_core(int argc, char **argv);
 int main_pause(int argc, char **argv);
 int main_unpause(int argc, char **argv);
 int main_destroy(int argc, char **argv);
diff -r 317bf978887c -r e81454d7c8a1 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Jul 19 15:15:32 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jul 19 15:33:38 2010 +0100
@@ -2264,6 +2264,14 @@ static void migrate_domain(char *domain_
     exit(-ERROR_BADFAIL);
 }
 
+static void core_dump_domain(const char *domain_spec, const char *filename)
+{
+    int rc;
+    find_domain(domain_spec);
+    rc=libxl_domain_core_dump(&ctx, domid, filename);
+    if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n.",rc);exit(-1); }
+}
+
 static void migrate_receive(int debug, int daemonize)
 {
     int rc, rc2;
@@ -2530,6 +2538,16 @@ int main_migrate(int argc, char **argv)
     }
 
     migrate_domain(p, rune, config_filename);
+    exit(0);
+}
+
+int main_dump_core(int argc, char **argv)
+{
+    if ( argc-optind < 2 ) {
+        help("dump-core");
+        exit(2);
+    }
+    core_dump_domain(argv[optind], argv[optind + 1]);
     exit(0);
 }
 
diff -r 317bf978887c -r e81454d7c8a1 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Mon Jul 19 15:15:32 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c Mon Jul 19 15:33:38 2010 +0100
@@ -102,6 +102,11 @@ struct cmd_spec cmd_table[] = {
       "-e              Do not wait in the background (on <host>) for the 
death\n"
       "                of the domain."
     },
+    { "dump-core",
+      &main_dump_core,
+      "Core dump a domain",
+      "<Domain> <filename>"
+    },
     { "restore",
       &main_restore,
       "Restore a domain from a saved state",

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.