Reprt error for a existing file
PATCH 1/1 Reprt error for a existing file
Hi,
I try to make a patch which reports error for a existing file to prevent overwriting before the file.
#xm dump-core 12 a.dump
Dumping core of domain: 12 ...
Error: Cannot dump core for existing file /tmp/a.dump
Usage: xm dump-core [-L|--live] [-C|--crash] <Domain> [Filename]
Dump core for a specific domain.
-L, --live Dump core without pausing the domain
-C, --crash Crash domain after dumping core
# xm save 12 a.save Error: Cannot save for existing file /tmp/a.save Usage: xm save <Domain> <CheckpointFile>
Save a domain state to restore later.
#
tools/python/xen/xend/XendDomain.py Wed Mar 07 14:57:58 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Fri Mar 02 12:11:52 2007 +0000 +6 -0
@@ -1094,6 +1094,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot dump core for privileged domain %s" % domid) + if os.path.exists(filename): + raise XendError("Cannot dump core for existing file %s" % filename) + try: log.info("Domain core dump requested for domain %s (%d) " "live=%d crash=%d.",
@@ -1190,6 +1193,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot save privileged domain %i" % domid) + + if os.path.exists(dst): + raise XendError("Cannot save for existing file %s" % dst) oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC if hasattr(os, "O_LARGEFILE"):
PATCH RESEND 1/1 Reprt error for a existing file
Hi,
This patch prevents output file overwriting for xm save/dump-core case.
Would you give me a comment on this patch? If not, please apply it. I made it again for the current.
Quoted 9 lines
#xm dump-core 12 a.dump
Dumping core of domain: 12 ...
Error: Cannot dump core for existing file/tmp/a.dump
Usage: xm dump-core [-L|--live] [-C|--crash] <Domain> [Filename]Dump core for a specific domain.
-L, --live Dump core without pausing the domain
-C, --crash Crash domain after dumping core
Quoted 8 lines
# xm save 12 a.save Error: Cannot save for existing file /tmp/a.save Usage: xm save <Domain> <CheckpointFile>Save a domain state to restore later.
#Signed-off-by Kazuki Mizushima <[email protected]>
Thanks,
Kazuki Mizushima
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +6 -0
@@ -1094,6 +1094,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot dump core for privileged domain %s" % domid) + if os.path.exists(filename): + raise XendError("Cannot dump core for existing file %s" % filename) + try: log.info("Domain core dump requested for domain %s (%d) " "live=%d crash=%d.",
@@ -1190,6 +1193,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot save privileged domain %i" % domid) + + if os.path.exists(dst): + raise XendError("Cannot save for existing file %s" % dst) oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC if hasattr(os, "O_LARGEFILE"):
Quoted 4 lines · Kazuki Mizushima
This patch prevents output file overwriting for xm save/dump-core case.
Would you give me a comment on this patch? If not, please apply it. I made it again for the current.
Personally I like being able to overwrite state files without having to delete them. Which is why I've not applied this patch myself.
-- Keir
Quoted 15 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: 15 March 2007 10:29
To: Kazuki Mizushima; [email protected]
Subject: Re: [Xen-devel] [PATCH][XEND][RESEND]Reprt error for a existing fileQuoted 1 line · Kazuki Mizushima
This patch prevents output file overwriting for xm
Quoted 8 lines
save/dump-core case.
Quoted 3 lines
Would you give me a comment on this patch? If not, please apply it. I made it again for the current.
Personally I like being able to overwrite state files without having to
delete them. Which is why I've not applied this patch myself.
Ah, I was just writing a reply like this:
Can I add a "personal opinion": I've been using a script to save/restore for a large number of cycles - it relies on overwriting the existing save-file. Would it be possibel to add a "-f|--force" to allow overwriting of the save/dump-file?
I have no objection to the patch as such, but it would be nice not to be able to save over the existing file if the user wants to.
--
Mats
Quoted 11 lines
-- Keir
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi, Kazuki
I think renaming filename is better.
Common Linux dump features(e.g. diskdump, netdump, and so on) are rename dumpfile when the same filename exist.
For example, what do you think renaming from <time>-<dom_name>.<dom_id>.core to <time>-<dom_name>.<dom_id>.core-1?
Best Regards,
Akio Takebe
Quoted 65 lines
Hi,
This patch prevents output file overwriting for xm save/dump-core case.
Would you give me a comment on this patch? If not, please apply it. I made it again for the current.
Quoted 9 lines
#xm dump-core 12 a.dump
Dumping core of domain: 12 ...
Error: Cannot dump core for existing file/tmp/a.dump
Usage: xm dump-core [-L|--live] [-C|--crash] <Domain> [Filename]Dump core for a specific domain.
-L, --live Dump core without pausing the domain
-C, --crash Crash domain after dumping coreQuoted 8 lines
# xm save 12 a.save Error: Cannot save for existing file /tmp/a.save Usage: xm save <Domain> <CheckpointFile>Save a domain state to restore later.
#Signed-off-by Kazuki Mizushima <[email protected]>Thanks,
Kazuki Mizushimadiff -r
517e67f0fe52tools/python/xen/xend/XendDomain.pytools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +3
-0@@ -1094,6 +1094,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot dump core for privileged domain %s" % domid) + if os.path.exists(filename): + raise XendError("Cannot dump core for existing file %s" % filename) + try:log.info("Domain core dump requested for domain %s (%d) "
"live=%d crash=%d.",tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +3
-0@@ -1190,6 +1193,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot save privileged domain %i" % domid) + + if os.path.exists(dst): + raise XendError("Cannot save for existing file %s" % dst) oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC if hasattr(os, "O_LARGEFILE"):_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Akio Takebe
Sent: 15 March 2007 12:32
To: Kazuki Mizushima; [email protected]
Subject: Re: [Xen-devel] [PATCH][XEND][RESEND]Reprt error for a existing fileHi, Kazuki
Quoted 7 lines
I think renaming filename is better.
Common Linux dump features(e.g. diskdump, netdump, and so on) are rename dumpfile when the same filename exist.For example, what do you think renaming from
<time>-<dom_name>.<dom_id>.core
to <time>-<dom_name>.<dom_id>.core-1?
That's fine for dump-files. I don't think the concept is good for save-files, as there's many reasons one would want to save/restore the same domain over and over (say for example daily back-ups, after a month you'd have 30 or so files!).
--
Mats
Quoted 88 lines
Best Regards,
Akio Takebe
Quoted 3 lines
Hi,
This patch prevents output file overwriting for xm
save/dump-core case.
Quoted 12 lines
Would you give me a comment on this patch? If not, please apply it. I made it again for the current.
Quoted 7 lines
#xm dump-core 12 a.dump
Dumping core of domain: 12 ...
Error: Cannot dump core for existing file/tmp/a.dump
Usage: xm dump-core [-L|--live] [-C|--crash] <Domain> [Filename]Dump core for a specific domain.
-L, --live Dump core without pausingthe domain
Quoted 12 lines
Quoted 10 lines
-C, --crash Crash domain after dumping core
# xm save 12 a.save Error: Cannot save for existing file /tmp/a.save Usage: xm save <Domain> <CheckpointFile>Save a domain state to restore later.
#Signed-off-by Kazuki Mizushima <[email protected]>Quoted 6 lines
Thanks,
Kazuki Mizushimadiff -r
517e67f0fe52tools/python/xen/xend/XendDomain.py
---a/tools/python/xen/xend/XendDomain.pyWed Mar 1419:35:26 2007 +0000
Quoted 1 line
+++
b/tools/python/xen/xend/XendDomain.pyThu Mar 1518:41:49 2007 +0900
Review class XendDomain: · line 1095
Quoted 3 lines
(quoted diff) +0
-0@@ -1094,6 +1094,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot dump core forprivileged domain %s" %
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 class XendDomain:
Quoted 4 lines
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +2
-0domid) + if os.path.exists(filename): + raise XendError("Cannot dump core for existingfile %s" %
Quoted 4 lines
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +1
-0filename) + try:log.info("Domain core dump requested for domain
%s (%d) "
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 class XendDomain: · line 1195
Quoted 5 lines
"live=%d crash=%d.",tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +0
-0@@ -1190,6 +1193,9 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot save privilegeddomain %i" % domid)
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 class XendDomain:
Quoted 3 lines
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +3
-0+ + if os.path.exists(dst): + raise XendError("Cannot save for existingfile %s" % dst)
Quoted 8 lines
tools/python/xen/xend/XendDomain.py Thu Mar 15 18:41:49 2007 +0900 renamed from tools/python/xen/xend/XendDomain.py Wed Mar 14 19:35:26 2007 +0000 +0
-0oflags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC if hasattr(os, "O_LARGEFILE"):Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Hi, Mats
Quoted 5 lines
That's fine for dump-files. I don't think the concept is good for save-files, as there's many reasons one would want to save/restore the same domain over and over (say for example daily back-ups, after a month you'd have 30 or so files!).
I agree.
Best Regards,
Akio Takebe