From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 07/12] tools/pygrub: store kernels in /var/run/xen/pygrub Date: Thu, 24 Apr 2014 10:41:01 +0100 Message-ID: <5358DC2D.8090908@citrix.com> References: <1398328615-28461-1-git-send-email-olaf@aepfle.de> <1398328615-28461-8-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398328615-28461-8-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 24/04/14 09:36, 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= 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. > > v3: > use /var/run/xen/pygrub instead of /var/run/pygrub > v2: > update exception handling for python 2.4 > > Signed-off-by: Olaf Hering > --- > 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..7759b1a 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/xen/pygrub" > + try: > + os.mkdir(output_directory, 0700) > + except OSError, exc: > + if exc.errno == errno.EEXIST and os.path.isdir(output_directory): > + pass > + else: > + raise if not (exc.errno == errno.EEXIST and os.path.isdir(output_directory)): raise There is no need for the pass statement. ~Andrew