# HG changeset patch # User john.levon@sun.com # Date 1165607792 28800 # Node ID 4485a53cd801f1982ababdd9a7119bdd8d0b4cce # Parent 95c016afec4d72385b8627617ef81f697834c50d 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@sun.com> diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile --- a/tools/pygrub/Makefile +++ b/tools/pygrub/Makefile @@ -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) $(DESTDIR)/var/lib/xen + $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot else install: all CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" - $(INSTALL_DIR) $(DESTDIR)/var/lib/xen + $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot endif .PHONY: clean diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -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 --git a/tools/python/xen/xend/XendBootloader.py b/tools/python/xen/xend/XendBootloader.py --- a/tools/python/xen/xend/XendBootloader.py +++ b/tools/python/xen/xend/XendBootloader.py @@ -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-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel