mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[XEND] Do not attempt core dump to directories.
- Abort core dump if destination is a directory. - Throw appropriate XendError expection on failure. Reported by Masaki Kanno <kanno.masaki@jp.fujitsu.com>. Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
15473a42cf
commit
cef39afbe9
1 file changed
+7
-3
@@ -988,14 +988,18 @@ class XendDomainInfo:
|
||||
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)
|
||||
|
||||
if os.path.isdir(corefile):
|
||||
raise XendError("Cannot dump core in a directory: %s" %
|
||||
corefile)
|
||||
|
||||
xc.domain_dumpcore(self.domid, corefile)
|
||||
|
||||
except:
|
||||
except RuntimeError, ex:
|
||||
corefile_incomp = corefile+'-incomplete'
|
||||
os.rename(corefile, corefile_incomp)
|
||||
log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s",
|
||||
self.domid, self.info['name'])
|
||||
|
||||
raise XendError("Failed to dump core: %s" % str(ex))
|
||||
|
||||
## public:
|
||||
|
||||
|
||||