WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: Implement xl dump-core

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]: Implement xl dump-core
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Mon, 19 Jul 2010 15:23:46 +0100
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Mon, 19 Jul 2010 07:25:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Implements dump-core command which is similar to xm dump-core except
that it requires an additional argument which is the target filename.

 libxl.c            |    7 +++++++
 libxl.h            |    2 ++
 xl.h               |    1 +
 xl_cmdimpl.c       |   18 ++++++++++++++++++
 xl_cmdtable.c      |    5 +++++
 6 files changed, 35 insertions(+), 2 deletions(-)

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>

diff -r 12f0618400de tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Jul 16 13:54:44 2010 +0100
+++ b/tools/libxl/libxl.c       Mon Jul 19 15:22:06 2010 +0100
@@ -523,6 +523,13 @@
     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;
+}
+
 int libxl_domain_unpause(struct libxl_ctx *ctx, uint32_t domid)
 {
     char *path;
diff -r 12f0618400de tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Fri Jul 16 13:54:44 2010 +0100
+++ b/tools/libxl/libxl.h       Mon Jul 19 15:22:06 2010 +0100
@@ -395,6 +395,8 @@
 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 12f0618400de tools/libxl/xl.h
--- a/tools/libxl/xl.h  Fri Jul 16 13:54:44 2010 +0100
+++ b/tools/libxl/xl.h  Mon Jul 19 15:22:06 2010 +0100
@@ -37,6 +37,7 @@
 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 12f0618400de tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Jul 16 13:54:44 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jul 19 15:22:06 2010 +0100
@@ -2262,6 +2262,14 @@
     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;
@@ -2531,6 +2539,16 @@
     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);
+}
+
 int main_pause(int argc, char **argv)
 {
     int opt;
diff -r 12f0618400de tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Fri Jul 16 13:54:44 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c Mon Jul 19 15:22:06 2010 +0100
@@ -102,6 +102,11 @@
       "-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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>