WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Instead of using a static filename in the guest bootload

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Instead of using a static filename in the guest bootloader, use a random
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Feb 2006 11:54:07 +0000
Delivery-date: Sun, 26 Feb 2006 11:54:22 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a861cbd578f28df80e87c9f4e1ed1f33882f3da4
# Parent  b567eb77399f1b73910561e331de6b1d3f919302
Instead of using a static filename in the guest bootloader, use a random
filename so that multiple guests can start up simultaneously.

Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>

diff -r b567eb77399f -r a861cbd578f2 tools/python/xen/xend/XendBootloader.py
--- a/tools/python/xen/xend/XendBootloader.py   Sun Feb 26 09:50:15 2006
+++ b/tools/python/xen/xend/XendBootloader.py   Sun Feb 26 09:53:18 2006
@@ -1,7 +1,7 @@
 #
 # XendBootloader.py - Framework to run a boot loader for picking the kernel
 #
-# Copyright 2005 Red Hat, Inc.
+# Copyright 2005-2006 Red Hat, Inc.
 # Jeremy Katz <katzj@xxxxxxxxxx>
 #
 # This software may be freely redistributed under the terms of the GNU
@@ -13,12 +13,11 @@
 #
 
 import os, select, errno
+import random
 import sxp
 
 from XendLogging import log
 from XendError import VmError
-
-BL_FIFO = "/var/lib/xen/xenbl"
 
 def bootloader(blexec, disk, quiet = 0, vcpus = None, entry = None):
     """Run the boot loader executable on the given disk and return a
@@ -38,14 +37,18 @@
         log.error(msg)
         raise VmError(msg)
 
-    os.mkfifo(BL_FIFO, 0600)
+    while True:
+        fifo = "/var/lib/xen/xenbl.%s" %(random.randint(0, 32000),)
+        if not os.path.exists(fifo):
+            break
+    os.mkfifo(fifo, 0600)
 
     child = os.fork()
     if (not child):
         args = [ blexec ]
         if quiet:
             args.append("-q")
-        args.append("--output=%s" %(BL_FIFO,))
+        args.append("--output=%s" %(fifo,))
         if entry is not None:
             args.append("--entry=%s" %(entry,))
         args.append(disk)
@@ -59,7 +62,7 @@
 
     while 1:
         try:
-            r = os.open(BL_FIFO, os.O_RDONLY)
+            r = os.open(fifo, os.O_RDONLY)
         except OSError, e:
             if e.errno == errno.EINTR:
                 continue
@@ -74,7 +77,7 @@
         
     os.waitpid(child, 0)
     os.close(r)
-    os.unlink(BL_FIFO)
+    os.unlink(fifo)
 
     if len(ret) == 0:
         msg = "Boot loader didn't return any data!"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Instead of using a static filename in the guest bootloader, use a random, Xen patchbot -unstable <=