xm dump command add on (TAKE 3)
PATCH 1/1 xm dump command add on (TAKE 3)
Take 3 on xm dump-core that takes a core dump of a domain.
The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00913.html
The only difference now, is that at xc_core.c@tools/libxc, when an mmap fails and a page cannot be copied to the dump file, the missing page will be filled with 0s instead of writing nonsense to prevent confusion.
Reference:
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00181.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00259.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00483.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00742.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00831.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00982.html
tools/libxc/xc_core.c +12 -1
@@ -37,6 +37,7 @@ xc_domain_dumpcore_via_callback(int xc_hchar dummy[PAGE_SIZE ];int dummy_len;int sts; +unsigned int cpy_err_cnt =0 ;if ( (dump_mem_start =malloc (DUMP_INCREMENT *PAGE_SIZE )) ==NULL ) {
@@ -103,7 +104,13 @@ xc_domain_dumpcore_via_callback(int xc_hfor ( dump_mem = dump_mem_start, i =0 ; i < nr_pages; i++ ) { -copy_from_domain_page (xc_handle, domid, page_array[i], dump_mem); + sts =copy_from_domain_page (xc_handle, domid, page_array[i], dump_mem); + +if ( sts !=0 ){ + cpy_err_cnt++; +memset (dump_mem,0 ,PAGE_SIZE ); + } + dump_mem +=PAGE_SIZE ;if ( ((i +1 ) %DUMP_INCREMENT ==0 ) || ((i +1 ) == nr_pages) ) {
@@ -112,6 +119,10 @@ xc_domain_dumpcore_via_callback(int xc_h goto error_out; dump_mem = dump_mem_start; } + } +if ( cpy_err_cnt !=0 ){ +IPRINTF ("Could not copy from domid=%d (%d)pages\n" , domid, cpy_err_cnt); + goto error_out; }free (dump_mem_start);
tools/python/xen/xend/XendDomain.py +16 -0
@@ -390,6 +390,22 @@ class XendDomain: except Exception, ex: raise XendError(str(ex)) + def domain_dump(self, domid, filename): + """Dump domain core.""" + + dominfo = self.domain_lookup_by_name_or_id_nr(domid) + if not dominfo: + raise XendInvalidDomain(str(domid)) + + if dominfo.getDomid() == PRIV_DOMAIN: + raise XendError("Cannot dump core for privileged domain %s" % domid) + + try: + log.info("Dumping Core for Domain %s (%d).", dominfo.getName(), + dominfo.getDomid()) + return dominfo.dumpCore(filename) + except Exception, ex: + raise XendError(str(ex)) def domain_destroy(self, domid): """Terminate domain immediately."""
tools/python/xen/xend/XendDomainInfo.py +3 -2
@@ -967,11 +967,12 @@ class XendDomainInfo: self.restart(True) - def dumpCore(self): + def dumpCore(self,corefile=None): """Create a core dump for this domain. Nothrow guarantee.""" try: - corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'], + if not corefile: + corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'], self.domid) xc.domain_dumpcore(self.domid, corefile)
tools/python/xen/xm/main.py +44 -0
74 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi, Ken
Chainging in TAKE2 is not reflected to your TAKE3's patch. So I update your patch.
And I modify messages of xend.log to report -LC option.
Best Regards,
Akio Takebe
Quoted 20 lines
Take 3 on xm dump-core that takes a core dump of a domain.
The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00913.htmlThe only difference now, is that at xc_core.c@tools/libxc, when an mmap fails and a page cannot be copied to the dump file, the missing page will be filled with 0s instead of writing nonsense to prevent confusion.
Signed-off-by Ken Hironaka <[email protected]>Reference:
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00181.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00259.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00483.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00742.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00831.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00982.html
Quoted 5 lines
-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
# HG changeset patch
# User root@procyon
# Node ID a9e921cf08212ad25ec8966314530482f4bcbf8f # Parent ec03b24a2d83273ec62db8596506b80577a0e41e xm dump command add on
xm dump-core [-L|--live][-C| --crash] <domID> [output path]
-L| --live Live dump:
By default, xm dump does an xm pause, unpause before and after taking the dump, respectively. This option disables the pause/unpause and simply takes the dump.
-C :| --crash crash dump:
This executes an xm destroy after the dump file is complete.
The output path is optional, and if it is not specified, the path will be /var/xen/dump/<domU name>.<domU ID>.core
This command uses the existant dumpCore(), which has been used for coredump when a domU crashed.
In this patch, the xc_domain_dumpcore_via_callback() in xc_core.c of libxc is also modified. Previously, the xc_domain_dumpcore_via_callback() did not respond to error when copy_from_domain_page() failed. In other words, the dump core remained silent even if mapping the domain memory failed and its page could not be copied. When this happened, erroneous data had been dumped to the file without the user realizing it. Now, it has been modified so that if copy_from_domain_page fails, this fact is recorded in the logfile.
However even in such cases, the dumping will continue as before.
tools/libxc/xc_core.c +12 -1
@@ -37,6 +37,7 @@ xc_domain_dumpcore_via_callback(int xc_hchar dummy[PAGE_SIZE ];int dummy_len;int sts; +unsigned int cpy_err_cnt =0 ;if ( (dump_mem_start =malloc (DUMP_INCREMENT *PAGE_SIZE )) ==NULL ) {
@@ -103,7 +104,13 @@ xc_domain_dumpcore_via_callback(int xc_hfor ( dump_mem = dump_mem_start, i =0 ; i < nr_pages; i++ ) { -copy_from_domain_page (xc_handle, domid, page_array[i], dump_mem); + sts =copy_from_domain_page (xc_handle, domid, page_array[i], dump_mem); + +if ( sts !=0 ){ +memset (dump_mem,0 ,PAGE_SIZE ); + cpy_err_cnt++; + } + dump_mem +=PAGE_SIZE ;if ( ((i +1 ) %DUMP_INCREMENT ==0 ) || ((i +1 ) == nr_pages) ) {
@@ -112,6 +119,10 @@ xc_domain_dumpcore_via_callback(int xc_h goto error_out; dump_mem = dump_mem_start; } + } +if ( cpy_err_cnt !=0 ){ +IPRINTF ("Could not copy from domid=%d (%d)pages\n" , domid, cpy_err_cnt); + goto error_out; }free (dump_mem_start);
tools/python/xen/xend/XendDomain.py +16 -0
@@ -390,6 +390,22 @@ class XendDomain: except Exception, ex: raise XendError(str(ex)) + def domain_dump(self, domid, filename, live, crash): + """Dump domain core.""" + + dominfo = self.domain_lookup_by_name_or_id_nr(domid) + if not dominfo: + raise XendInvalidDomain(str(domid)) + + if dominfo.getDomid() == PRIV_DOMAIN: + raise XendError("Cannot dump core for privileged domain %s" % domid) + + try: + log.info("Domain core dump requested for domain %s (%d) live=%d crash=%d.", + dominfo.getName(), dominfo.getDomid(), live, crash) + return dominfo.dumpCore(filename) + except Exception, ex: + raise XendError(str(ex)) def domain_destroy(self, domid): """Terminate domain immediately."""
tools/python/xen/xend/XendDomainInfo.py +3 -2
@@ -967,11 +967,12 @@ class XendDomainInfo: self.restart(True) - def dumpCore(self): + def dumpCore(self,corefile=None): """Create a core dump for this domain. Nothrow guarantee.""" try: - corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'], + if not corefile: + corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'], self.domid) xc.domain_dumpcore(self.domid, corefile)
tools/python/xen/xm/main.py +43 -0
73 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
ah, thank you Akio,
best regards,
Ken
Quoted 38 lines · Akio Takebe
Hi, Ken
Chainging in TAKE2 is not reflected to your TAKE3's patch. So I update your patch.
And I modify messages of xend.log to report -LC option.Signed-off-by Ken Hironaka <[email protected]>Signed-off-by Akio Takebe <[email protected]>Best Regards,
Akio Takebe
Quoted 25 lines
Take 3 on xm dump-core that takes a core dump of a domain.
The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00913.htmlThe only difference now, is that at xc_core.c@tools/libxc, when an mmap fails and a page cannot be copied to the dump file, the missing page will be filled with 0s instead of writing nonsense to prevent confusion.
Signed-off-by Ken Hironaka <[email protected]>Reference:
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00181.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00259.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00483.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00742.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00831.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00982.html-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi,
I update my patch to add localtime into corefile name.
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00929.html
This patch depend on xmdump.v4.patch
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg01036.html
Best Regards,
Akio Takebe
Quoted 39 lines
Hi, Ken
Chainging in TAKE2 is not reflected to your TAKE3's patch. So I update your patch.
And I modify messages of xend.log to report -LC option.Signed-off-by Ken Hironaka <[email protected]>Signed-off-by Akio Takebe <[email protected]>Best Regards,
Akio Takebe
Quoted 20 lines
Take 3 on xm dump-core that takes a core dump of a domain.
The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00913.htmlThe only difference now, is that at xc_core.c@tools/libxc, when an mmap fails and a page cannot be copied to the dump file, the missing page will be filled with 0s instead of writing nonsense to prevent confusion.
Signed-off-by Ken Hironaka <[email protected]>Reference:
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00181.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00259.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00483.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00742.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00831.html
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00982.htmlQuoted 5 lines
-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines
-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
tools/python/xen/xend/XendDomainInfo.py +5 -2
@@ -972,11 +972,14 @@ class XendDomainInfo: try: if not corefile: - 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