[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] pygrub tmp files should live in /var/run/ not /var/lib/, as they are
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxxx # Node ID 245f7ce8763e2f4968a4f0ce2ac7022b0eddb723 # Parent 8cddaee4a51cb0c905a87e2ef85d1a8c54e4d963 pygrub tmp files should live in /var/run/ not /var/lib/, as they are indeed runtime only. Also fix a race condition in making the pygrub fifo. Signed-off-by: John Levon <john.levon@xxxxxxx> --- tools/pygrub/Makefile | 4 ++-- tools/pygrub/src/pygrub | 6 ++++-- tools/python/xen/xend/XendBootloader.py | 16 +++++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff -r 8cddaee4a51c -r 245f7ce8763e tools/pygrub/Makefile --- a/tools/pygrub/Makefile Sat Dec 09 14:34:53 2006 +0000 +++ b/tools/pygrub/Makefile Sat Dec 09 15:04:27 2006 +0000 @@ -12,11 +12,11 @@ ifndef XEN_PYTHON_NATIVE_INSTALL ifndef XEN_PYTHON_NATIVE_INSTALL install: all CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" - $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xen + $(INSTALL_DIR) -p $(DESTDIR)/var/run/xend/boot else install: all CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" - $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xen + $(INSTALL_DIR) -p $(DESTDIR)/var/run/xend/boot endif .PHONY: clean diff -r 8cddaee4a51c -r 245f7ce8763e tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub Sat Dec 09 14:34:53 2006 +0000 +++ b/tools/pygrub/src/pygrub Sat Dec 09 15:04:27 2006 +0000 @@ -514,14 +514,16 @@ if __name__ == "__main__": fs = fsimage.open(file, offset) kernel = fs.open_file(img.kernel[1],).read() - (tfd, fn) = tempfile.mkstemp(prefix="vmlinuz.", dir="/var/lib/xen") + (tfd, fn) = tempfile.mkstemp(prefix="boot_kernel.", + dir="/var/run/xend/boot") os.write(tfd, kernel) os.close(tfd) sxp = "linux (kernel %s)" %(fn,) if img.initrd: initrd = fs.open_file(img.initrd[1],).read() - (tfd, fn) = tempfile.mkstemp(prefix="initrd.", dir="/var/lib/xen") + (tfd, fn) = tempfile.mkstemp(prefix="boot_ramdisk.", + dir="/var/run/xend/boot") os.write(tfd, initrd) os.close(tfd) sxp += "(ramdisk %s)" %(fn,) diff -r 8cddaee4a51c -r 245f7ce8763e tools/python/xen/xend/XendBootloader.py --- a/tools/python/xen/xend/XendBootloader.py Sat Dec 09 14:34:53 2006 +0000 +++ b/tools/python/xen/xend/XendBootloader.py Sat Dec 09 15:04:27 2006 +0000 @@ -12,11 +12,12 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import os, select, errno +import os, select, errno, stat import random import shlex from xen.xend import sxp +from xen.util import mkdir from XendLogging import log from XendError import VmError @@ -37,11 +38,16 @@ def bootloader(blexec, disk, quiet = 0, log.error(msg) raise VmError(msg) + mkdir.parents("/var/run/xend/boot/", stat.S_IRWXU) + while True: - fifo = "/var/lib/xen/xenbl.%s" % random.randint(0, 32000) - if not os.path.exists(fifo): - break - os.mkfifo(fifo, 0600) + fifo = "/var/run/xend/boot/xenbl.%s" %(random.randint(0, 32000),) + try: + os.mkfifo(fifo, 0600) + except OSError, e: + if (e.errno != errno.EEXIST): + raise + break child = os.fork() if (not child): _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |