[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 07/12 v4] tools/pygrub: store kernels in /var/run/xen/pygrub



On Thu, 2014-04-24 at 14:12 +0200, Olaf Hering wrote:
> Move location of temporary bootfiles from /var/run/xend/boot to
> /var/run/xen/pygrub. Create the subdirectory if does not exist, unless
> --output-directory=<dir> was specified.

I'm not at all opposed to this change but why this last condition? Any
reason not to always create the directory if it doesn't exist?

Or should there be an existence check when you specify
--output-directory?


> 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.
> 
> v4:
>  update mkdir exception handling
> v3:
>  use /var/run/xen/pygrub instead of /var/run/pygrub
> v2:
>  update exception handling for python 2.4
> 
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> ---
> 
> In case the whole series can/will go in, address a comment from Andrew.
> 
>  tools/pygrub/src/pygrub | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
> index 54fecee..8781d83 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,14 @@ if __name__ == "__main__":
>      if debug:
>       logging.basicConfig(level=logging.DEBUG)
>  
> +    if output_directory is None:
> +        output_directory = "/var/run/xen/pygrub"
> +        try:
> +            os.mkdir(output_directory, 0700)
> +        except OSError, exc:
> +            if not (exc.errno == errno.EEXIST and 
> os.path.isdir(output_directory)):
> +                raise
> +
>      if output is None or output == "-":
>          fd = sys.stdout.fileno()
>      else:



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.