* [PATCH] tools/pygrub: store kernels in /var/run/pygrub
@ 2014-04-17 10:52 Olaf Hering
2014-04-17 10:57 ` Andrew Cooper
2014-04-17 18:18 ` Ian Jackson
0 siblings, 2 replies; 8+ messages in thread
From: Olaf Hering @ 2014-04-17 10:52 UTC (permalink / raw)
To: xen-devel; +Cc: Olaf Hering, Ian.Jackson, Ian.Campbell
Move location of temporary bootfiles from /var/run/xend/boot to
/var/run/pygrub. If the directory does not exist create it, unless
--output-directory=<dir> was specified.
The reason for this change is that all entrys below /var/run have to be
created at runtime in case /var/run is cleared on every boot.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
New code not runtime tested as pygrub, just as hello_world.py...
tools/pygrub/src/pygrub | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 54fecee..a89fd49 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -14,6 +14,7 @@
#
import os, sys, string, struct, tempfile, re, traceback
+import errno
import copy
import logging
import platform
@@ -757,7 +758,7 @@ if __name__ == "__main__":
debug = False
not_really = False
output_format = "sxp"
- output_directory = "/var/run/xend/boot"
+ output_directory = None
# what was passed in
incfg = { "kernel": None, "ramdisk": None, "args": "" }
@@ -813,6 +814,16 @@ if __name__ == "__main__":
if debug:
logging.basicConfig(level=logging.DEBUG)
+ if output_directory is None:
+ output_directory = "/var/run/pygrub"
+ try:
+ os.mkdir(output_directory, 0700)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST and os.path.isdir(output_directory):
+ pass
+ else:
+ raise
+
if output is None or output == "-":
fd = sys.stdout.fileno()
else:
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 10:52 [PATCH] tools/pygrub: store kernels in /var/run/pygrub Olaf Hering
@ 2014-04-17 10:57 ` Andrew Cooper
2014-04-17 11:07 ` Olaf Hering
2014-04-17 11:33 ` David Vrabel
2014-04-17 18:18 ` Ian Jackson
1 sibling, 2 replies; 8+ messages in thread
From: Andrew Cooper @ 2014-04-17 10:57 UTC (permalink / raw)
To: Olaf Hering; +Cc: Ian.Jackson, Ian.Campbell, xen-devel
On 17/04/14 11:52, Olaf Hering wrote:
> Move location of temporary bootfiles from /var/run/xend/boot to
> /var/run/pygrub. If the directory does not exist create it, unless
> --output-directory=<dir> was specified.
>
> The reason for this change is that all entrys below /var/run have to be
> created at runtime in case /var/run is cleared on every boot.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> ---
>
> New code not runtime tested as pygrub, just as hello_world.py...
I don't think it is valid in the slightest for programs like this to be
mkdir()ing their environment. It is very much a packaging responsibility.
>
> tools/pygrub/src/pygrub | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
> index 54fecee..a89fd49 100644
> --- a/tools/pygrub/src/pygrub
> +++ b/tools/pygrub/src/pygrub
> @@ -14,6 +14,7 @@
> #
>
> import os, sys, string, struct, tempfile, re, traceback
> +import errno
> import copy
> import logging
> import platform
> @@ -757,7 +758,7 @@ if __name__ == "__main__":
> debug = False
> not_really = False
> output_format = "sxp"
> - output_directory = "/var/run/xend/boot"
> + output_directory = None
>
> # what was passed in
> incfg = { "kernel": None, "ramdisk": None, "args": "" }
> @@ -813,6 +814,16 @@ if __name__ == "__main__":
> if debug:
> logging.basicConfig(level=logging.DEBUG)
>
> + if output_directory is None:
> + output_directory = "/var/run/pygrub"
> + try:
> + os.mkdir(output_directory, 0700)
> + except OSError as exc:
This is only valid for python 2.5 (or possibly 2.6). You want
except OSError,exc:
for 2.4 compatibility.
~Andrew
> + if exc.errno == errno.EEXIST and os.path.isdir(output_directory):
> + pass
> + else:
> + raise
> +
> if output is None or output == "-":
> fd = sys.stdout.fileno()
> else:
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 10:57 ` Andrew Cooper
@ 2014-04-17 11:07 ` Olaf Hering
2014-04-17 11:33 ` David Vrabel
1 sibling, 0 replies; 8+ messages in thread
From: Olaf Hering @ 2014-04-17 11:07 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Ian.Jackson, Ian.Campbell, xen-devel
On Thu, Apr 17, Andrew Cooper wrote:
> I don't think it is valid in the slightest for programs like this to be
> mkdir()ing their environment. It is very much a packaging responsibility.
So the startup scripts have to do that mkdir once at bootup?
Olaf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 10:57 ` Andrew Cooper
2014-04-17 11:07 ` Olaf Hering
@ 2014-04-17 11:33 ` David Vrabel
1 sibling, 0 replies; 8+ messages in thread
From: David Vrabel @ 2014-04-17 11:33 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Olaf Hering, Ian.Jackson, Ian.Campbell, xen-devel
On 17/04/14 11:57, Andrew Cooper wrote:
> On 17/04/14 11:52, Olaf Hering wrote:
>> Move location of temporary bootfiles from /var/run/xend/boot to
>> /var/run/pygrub. If the directory does not exist create it, unless
>> --output-directory=<dir> was specified.
>>
>> The reason for this change is that all entrys below /var/run have to be
>> created at runtime in case /var/run is cleared on every boot.
>>
>> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>> ---
>>
>> New code not runtime tested as pygrub, just as hello_world.py...
>
> I don't think it is valid in the slightest for programs like this to be
> mkdir()ing their environment. It is very much a packaging responsibility.
/var/run may not be persistent so this can't be done by the packaging.
David
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 10:52 [PATCH] tools/pygrub: store kernels in /var/run/pygrub Olaf Hering
2014-04-17 10:57 ` Andrew Cooper
@ 2014-04-17 18:18 ` Ian Jackson
2014-04-22 8:45 ` Ian Campbell
2014-04-22 12:55 ` Olaf Hering
1 sibling, 2 replies; 8+ messages in thread
From: Ian Jackson @ 2014-04-17 18:18 UTC (permalink / raw)
To: Olaf Hering; +Cc: Ian.Campbell, xen-devel
Olaf Hering writes ("[PATCH] tools/pygrub: store kernels in /var/run/pygrub"):
> Move location of temporary bootfiles from /var/run/xend/boot to
> /var/run/pygrub. If the directory does not exist create it, unless
> --output-directory=<dir> was specified.
>
> The reason for this change is that all entrys below /var/run have to be
> created at runtime in case /var/run is cleared on every boot.
I don't understand why this necessitates changing the directory.
Surely it should just be created.
Also, I think pygrub is a piece of Xen and we should be using
/var/run/xen (not xend as xend is obsolete).
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 18:18 ` Ian Jackson
@ 2014-04-22 8:45 ` Ian Campbell
2014-04-22 12:55 ` Olaf Hering
1 sibling, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-04-22 8:45 UTC (permalink / raw)
To: Ian Jackson; +Cc: Olaf Hering, xen-devel
On Thu, 2014-04-17 at 19:18 +0100, Ian Jackson wrote:
> Olaf Hering writes ("[PATCH] tools/pygrub: store kernels in /var/run/pygrub"):
> > Move location of temporary bootfiles from /var/run/xend/boot to
> > /var/run/pygrub. If the directory does not exist create it, unless
> > --output-directory=<dir> was specified.
> >
> > The reason for this change is that all entrys below /var/run have to be
> > created at runtime in case /var/run is cleared on every boot.
>
> I don't understand why this necessitates changing the directory.
> Surely it should just be created.
>
> Also, I think pygrub is a piece of Xen and we should be using
> /var/run/xen (not xend as xend is obsolete).
Yes.
FWIW libxl (the only remaining automated caller of this code) always
passes --output-directory=
${XEN_RUN_DIR:-/var/run/xen}/bootloader.$domid/dir
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-17 18:18 ` Ian Jackson
2014-04-22 8:45 ` Ian Campbell
@ 2014-04-22 12:55 ` Olaf Hering
2014-04-22 13:55 ` Ian Jackson
1 sibling, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2014-04-22 12:55 UTC (permalink / raw)
To: Ian Jackson; +Cc: Ian.Campbell, xen-devel
On Thu, Apr 17, Ian Jackson wrote:
> Also, I think pygrub is a piece of Xen and we should be using
> /var/run/xen (not xend as xend is obsolete).
So I will adjust this patch to use /var/run/xen/pygrub/.
Or should pygrub put its files right into "/var/run/xen/"?
Olaf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
2014-04-22 12:55 ` Olaf Hering
@ 2014-04-22 13:55 ` Ian Jackson
0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2014-04-22 13:55 UTC (permalink / raw)
To: Olaf Hering; +Cc: Ian.Campbell, xen-devel
Olaf Hering writes ("Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub"):
> On Thu, Apr 17, Ian Jackson wrote:
>
> > Also, I think pygrub is a piece of Xen and we should be using
> > /var/run/xen (not xend as xend is obsolete).
>
> So I will adjust this patch to use /var/run/xen/pygrub/.
I think that is good.
> Or should pygrub put its files right into "/var/run/xen/"?
The subdir is probably useful.
Thanks,
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-22 13:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17 10:52 [PATCH] tools/pygrub: store kernels in /var/run/pygrub Olaf Hering
2014-04-17 10:57 ` Andrew Cooper
2014-04-17 11:07 ` Olaf Hering
2014-04-17 11:33 ` David Vrabel
2014-04-17 18:18 ` Ian Jackson
2014-04-22 8:45 ` Ian Campbell
2014-04-22 12:55 ` Olaf Hering
2014-04-22 13:55 ` Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).