Skip to contentSkip to conversation

Change dumpcore filename

PATCH New Akio Takebe 1 participant 1 message Aug 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Change dumpcore filename

Hi,

This patch add localtime to dumpcore filename.
And it add '-imcomplete' if failed.

Best Regards,

Akio Takebe

# HG changeset patch
# User root@procyon
# Node ID 4700d7ec2c53bee848bd22b535b1a69811a14e9a # Parent ec03b24a2d83273ec62db8596506b80577a0e41e Change dumpcore filename
- add localtime
- add "-incomplete" if failed

tools/python/xen/xend/XendDomainInfo.py +5 -2
diff -r ec03b24a2d83 -r 4700d7ec2c53 tools/python/xen/xend/XendDomainInfo.py
@@ -971,11 +971,14 @@ class XendDomainInfo:
         """Create a core dump for this domain.  Nothrow guarantee."""
         
         try:
-            corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'],
-                                                     self.domid)
+            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'], self.domid)
             xc.domain_dumpcore(self.domid, corefile)
 
         except:
+            corefile_incomp = corefile+'-incomplete'
+            os.rename(corefile, corefile_incomp)
             log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s",
                           self.domid, self.info['name'])
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel