All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][XEND]Reprt error for a existing file
@ 2007-03-07 10:47 Kazuki Mizushima
  2007-03-15 10:18 ` [PATCH][XEND][RESEND]Reprt " Kazuki Mizushima
  0 siblings, 1 reply; 7+ messages in thread
From: Kazuki Mizushima @ 2007-03-07 10:47 UTC (permalink / raw)
  To: xen-devel

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.
#

Signed-off-by: Kazuki Mizushima <mizushima.kazuk@jp.fujitsu.com>


diff -r 3ac19fda0bc2 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Mar 02 12:11:52 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Wed Mar 07 14:57:58 2007 +0900
@@ -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"):

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-07 10:47 [PATCH][XEND]Reprt error for a existing file Kazuki Mizushima
@ 2007-03-15 10:18 ` Kazuki Mizushima
  2007-03-15 10:28   ` Keir Fraser
  2007-03-15 12:31   ` Akio Takebe
  0 siblings, 2 replies; 7+ messages in thread
From: Kazuki Mizushima @ 2007-03-15 10:18 UTC (permalink / raw)
  To: xen-devel

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.


> #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.
> #
> 
> Signed-off-by: Kazuki Mizushima <mizushima.kazuk@jp.fujitsu.com>


Thanks,
Kazuki Mizushima


diff -r 517e67f0fe52 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Mar 14 19:35:26 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Thu Mar 15 18:41:49 2007 +0900
@@ -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"):

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-15 10:18 ` [PATCH][XEND][RESEND]Reprt " Kazuki Mizushima
@ 2007-03-15 10:28   ` Keir Fraser
  2007-03-15 10:31     ` Petersson, Mats
  2007-03-15 12:31   ` Akio Takebe
  1 sibling, 1 reply; 7+ messages in thread
From: Keir Fraser @ 2007-03-15 10:28 UTC (permalink / raw)
  To: Kazuki Mizushima, xen-devel

On 15/3/07 10:18, "Kazuki Mizushima" <mizushima.kazuk@jp.fujitsu.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-15 10:28   ` Keir Fraser
@ 2007-03-15 10:31     ` Petersson, Mats
  0 siblings, 0 replies; 7+ messages in thread
From: Petersson, Mats @ 2007-03-15 10:31 UTC (permalink / raw)
  To: Keir Fraser, Kazuki Mizushima, xen-devel

 

> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of 
> Keir Fraser
> Sent: 15 March 2007 10:29
> To: Kazuki Mizushima; xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH][XEND][RESEND]Reprt error for 
> a existing file
> 
> On 15/3/07 10:18, "Kazuki Mizushima" 
> <mizushima.kazuk@jp.fujitsu.com> wrote:
> 
> > 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.

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
> 
>  -- Keir
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-15 10:18 ` [PATCH][XEND][RESEND]Reprt " Kazuki Mizushima
  2007-03-15 10:28   ` Keir Fraser
@ 2007-03-15 12:31   ` Akio Takebe
  2007-03-15 12:44     ` Petersson, Mats
  1 sibling, 1 reply; 7+ messages in thread
From: Akio Takebe @ 2007-03-15 12:31 UTC (permalink / raw)
  To: Kazuki Mizushima, 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

>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.
>
>
>> #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.
>> #
>> 
>> Signed-off-by: Kazuki Mizushima <mizushima.kazuk@jp.fujitsu.com>
>
>
>Thanks,
>Kazuki Mizushima
>
>
>diff -r 517e67f0fe52 tools/python/xen/xend/XendDomain.py
>--- a/tools/python/xen/xend/XendDomain.py       Wed Mar 14 19:35:26 2007 +0000
>+++ b/tools/python/xen/xend/XendDomain.py       Thu Mar 15 18:41:49 2007 +0900
>@@ -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"):
>
>
>
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-15 12:31   ` Akio Takebe
@ 2007-03-15 12:44     ` Petersson, Mats
  2007-03-16  1:37       ` Akio Takebe
  0 siblings, 1 reply; 7+ messages in thread
From: Petersson, Mats @ 2007-03-15 12:44 UTC (permalink / raw)
  To: Akio Takebe, Kazuki Mizushima, xen-devel

 

> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of 
> Akio Takebe
> Sent: 15 March 2007 12:32
> To: Kazuki Mizushima; xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH][XEND][RESEND]Reprt error for 
> a existing file
> 
> 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?

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
> 
> Best Regards,
> 
> Akio Takebe
> 
> >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.
> >
> >
> >> #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.
> >> #
> >> 
> >> Signed-off-by: Kazuki Mizushima <mizushima.kazuk@jp.fujitsu.com>
> >
> >
> >Thanks,
> >Kazuki Mizushima
> >
> >
> >diff -r 517e67f0fe52 tools/python/xen/xend/XendDomain.py
> >--- a/tools/python/xen/xend/XendDomain.py       Wed Mar 14 
> 19:35:26 2007 +0000
> >+++ b/tools/python/xen/xend/XendDomain.py       Thu Mar 15 
> 18:41:49 2007 +0900
> >@@ -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"):
> >
> >
> >
> >
> >
> >_______________________________________________
> >Xen-devel mailing list
> >Xen-devel@lists.xensource.com
> >http://lists.xensource.com/xen-devel
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH][XEND][RESEND]Reprt error for a existing file
  2007-03-15 12:44     ` Petersson, Mats
@ 2007-03-16  1:37       ` Akio Takebe
  0 siblings, 0 replies; 7+ messages in thread
From: Akio Takebe @ 2007-03-16  1:37 UTC (permalink / raw)
  To: Petersson, Mats, Kazuki Mizushima, xen-devel; +Cc: Akio Takebe

Hi, Mats

>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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-16  1:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-07 10:47 [PATCH][XEND]Reprt error for a existing file Kazuki Mizushima
2007-03-15 10:18 ` [PATCH][XEND][RESEND]Reprt " Kazuki Mizushima
2007-03-15 10:28   ` Keir Fraser
2007-03-15 10:31     ` Petersson, Mats
2007-03-15 12:31   ` Akio Takebe
2007-03-15 12:44     ` Petersson, Mats
2007-03-16  1:37       ` Akio Takebe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.