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

Re: [Xen-devel] [PATCH 06/46] tools/pygrub: store kernels in /var/run/xen/pygrub



On Mon, 2014-09-22 at 16:29 +0100, Andrew Cooper wrote:
> On 22/09/14 13:59, 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.
> > The <dir> argument --output-directory must be an existing 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.
> >
> > Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > ---
> >  tools/pygrub/src/pygrub | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
> > index 2618e11..e73a174 100644
> > --- a/tools/pygrub/src/pygrub
> > +++ b/tools/pygrub/src/pygrub
> > @@ -778,7 +778,7 @@ if __name__ == "__main__":
> >      debug = False
> >      not_really = False
> >      output_format = "sxp"
> > -    output_directory = "/var/run/xend/boot"
> > +    output_directory = "/var/run/xen/pygrub"
> >  
> >      # what was passed in
> >      incfg = { "kernel": None, "ramdisk": None, "args": "" }
> > @@ -829,11 +829,17 @@ if __name__ == "__main__":
> >                  sys.exit(1)
> >              output_format = a
> >          elif o in ("--output-directory",):
> > +            if not os.path.isdir(a):
> > +                print "%s is not an existing directory" % a
> > +                sys.exit(1)
> >              output_directory = a
> >  
> >      if debug:
> >     logging.basicConfig(level=logging.DEBUG)
> >  
> > +    if not os.path.isdir(output_directory):
> > +        os.mkdir(output_directory, 0700)
> 
> This can fail if output_directory exists but is not a directory.  It
> needs wrapping to catch OSError and provide a more useful error to the user.

It'll already log something like
OSError: [Errno 17] File exists: '/tmp/notadir'

Not sure what else could be logged.

Ian.


_______________________________________________
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®.