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-changelog

[Xen-changelog] [xen-unstable] xend: make a crash dump directory per Dom

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: make a crash dump directory per DomU
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Jul 2009 09:10:58 -0700
Delivery-date: Tue, 28 Jul 2009 09:13:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1248795830 -3600
# Node ID 6ba0f519a9fa1bc9fc4dbb6b644186aa2967b46a
# Parent  7faf35a248c0cffa133347bae01a22e92345fd28
xend: make a crash dump directory per DomU

Currently, xend dumps a core file of a DomU
in the directory "/var/xen/dump/", when the DomU has crashed.

The patch modifies this directory to "/var/xen/dump/<domain name>/".

It enables you to select HDD partition per DomU to dump core by using
mount command.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff -r 7faf35a248c0 -r 6ba0f519a9fa tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Jul 28 16:42:12 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Jul 28 16:43:50 2009 +0100
@@ -31,6 +31,7 @@ import re
 import re
 import copy
 import os
+import stat
 import traceback
 from types import StringTypes
 
@@ -39,6 +40,7 @@ from xen.util.blkif import blkdev_uname_
 from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype
 import xen.util.xsm.xsm as security
 from xen.util import xsconstants
+from xen.util import mkdir
 from xen.util.pci import serialise_pci_opts, pci_opts_list_to_sxp, \
                          pci_dict_to_bdf_str, pci_dict_to_xc_str, \
                          pci_convert_sxp_to_dict, pci_convert_dict_to_sxp, \
@@ -2151,9 +2153,23 @@ class XendDomainInfo:
         """
         
         if not corefile:
+            # To prohibit directory traversal
+            based_name = os.path.basename(self.info['name_label'])
+            
+            coredir = "/var/xen/dump/%s" % (based_name)
+            if not os.path.exists(coredir):
+                try:
+                    mkdir.parents(coredir, stat.S_IRWXU)
+                except Exception, ex:
+                    log.error("Cannot create directory: %s" % str(ex))
+
+            if not os.path.isdir(coredir):
+                # Use former directory to dump core
+                coredir = '/var/xen/dump'
+
             this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())
-            corefile = "/var/xen/dump/%s-%s.%s.core" % (this_time,
-                              self.info['name_label'], self.domid)
+            corefile = "%s/%s-%s.%s.core" % (coredir, this_time,
+                                             self.info['name_label'], 
self.domid)
                 
         if os.path.isdir(corefile):
             raise XendError("Cannot dump core in a directory: %s" %

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: make a crash dump directory per DomU, Xen patchbot-unstable <=