ia64/xen-unstable
changeset 12894:245f7ce8763e
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>
indeed runtime only.
Also fix a race condition in making the pygrub fifo.
Signed-off-by: John Levon <john.levon@sun.com>
author | kaf24@localhost.localdomain |
---|---|
date | Sat Dec 09 15:04:27 2006 +0000 (2006-12-09) |
parents | 8cddaee4a51c |
children | f5121d001d1a |
files | tools/pygrub/Makefile tools/pygrub/src/pygrub tools/python/xen/xend/XendBootloader.py |
line diff
1.1 --- a/tools/pygrub/Makefile Sat Dec 09 14:34:53 2006 +0000 1.2 +++ b/tools/pygrub/Makefile Sat Dec 09 15:04:27 2006 +0000 1.3 @@ -12,11 +12,11 @@ build: 1.4 ifndef XEN_PYTHON_NATIVE_INSTALL 1.5 install: all 1.6 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" 1.7 - $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xen 1.8 + $(INSTALL_DIR) -p $(DESTDIR)/var/run/xend/boot 1.9 else 1.10 install: all 1.11 CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)" 1.12 - $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xen 1.13 + $(INSTALL_DIR) -p $(DESTDIR)/var/run/xend/boot 1.14 endif 1.15 1.16 .PHONY: clean
2.1 --- a/tools/pygrub/src/pygrub Sat Dec 09 14:34:53 2006 +0000 2.2 +++ b/tools/pygrub/src/pygrub Sat Dec 09 15:04:27 2006 +0000 2.3 @@ -514,14 +514,16 @@ if __name__ == "__main__": 2.4 fs = fsimage.open(file, offset) 2.5 2.6 kernel = fs.open_file(img.kernel[1],).read() 2.7 - (tfd, fn) = tempfile.mkstemp(prefix="vmlinuz.", dir="/var/lib/xen") 2.8 + (tfd, fn) = tempfile.mkstemp(prefix="boot_kernel.", 2.9 + dir="/var/run/xend/boot") 2.10 os.write(tfd, kernel) 2.11 os.close(tfd) 2.12 sxp = "linux (kernel %s)" %(fn,) 2.13 2.14 if img.initrd: 2.15 initrd = fs.open_file(img.initrd[1],).read() 2.16 - (tfd, fn) = tempfile.mkstemp(prefix="initrd.", dir="/var/lib/xen") 2.17 + (tfd, fn) = tempfile.mkstemp(prefix="boot_ramdisk.", 2.18 + dir="/var/run/xend/boot") 2.19 os.write(tfd, initrd) 2.20 os.close(tfd) 2.21 sxp += "(ramdisk %s)" %(fn,)
3.1 --- a/tools/python/xen/xend/XendBootloader.py Sat Dec 09 14:34:53 2006 +0000 3.2 +++ b/tools/python/xen/xend/XendBootloader.py Sat Dec 09 15:04:27 2006 +0000 3.3 @@ -12,11 +12,12 @@ 3.4 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 3.5 # 3.6 3.7 -import os, select, errno 3.8 +import os, select, errno, stat 3.9 import random 3.10 import shlex 3.11 from xen.xend import sxp 3.12 3.13 +from xen.util import mkdir 3.14 from XendLogging import log 3.15 from XendError import VmError 3.16 3.17 @@ -37,11 +38,16 @@ def bootloader(blexec, disk, quiet = 0, 3.18 log.error(msg) 3.19 raise VmError(msg) 3.20 3.21 + mkdir.parents("/var/run/xend/boot/", stat.S_IRWXU) 3.22 + 3.23 while True: 3.24 - fifo = "/var/lib/xen/xenbl.%s" % random.randint(0, 32000) 3.25 - if not os.path.exists(fifo): 3.26 - break 3.27 - os.mkfifo(fifo, 0600) 3.28 + fifo = "/var/run/xend/boot/xenbl.%s" %(random.randint(0, 32000),) 3.29 + try: 3.30 + os.mkfifo(fifo, 0600) 3.31 + except OSError, e: 3.32 + if (e.errno != errno.EEXIST): 3.33 + raise 3.34 + break 3.35 3.36 child = os.fork() 3.37 if (not child):