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] [xen-unstable] [Xend/ACM] Provide explicit initializatio

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [Xend/ACM] Provide explicit initialization function for bootloader class
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 May 2008 03:00:12 -0700
Delivery-date: Thu, 01 May 2008 07:46:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209632145 -3600
# Node ID 2cf9a8736babe63fe1783286f666c3d6fc9af58b
# Parent  931932f5fc6d4b97ff262e8ab2aa5f77f5a938a6
[Xend/ACM] Provide explicit initialization function for bootloader class

This patch refactors the initialization code for the bootloader class
and puts it into an explicit initialization function that is called
from another class.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/python/xen/util/bootloader.py        |   25 ++++++++++++++-----------
 tools/python/xen/xend/XendXSPolicyAdmin.py |    1 +
 2 files changed, 15 insertions(+), 11 deletions(-)

diff -r 931932f5fc6d -r 2cf9a8736bab tools/python/xen/util/bootloader.py
--- a/tools/python/xen/util/bootloader.py       Thu May 01 09:55:06 2008 +0100
+++ b/tools/python/xen/util/bootloader.py       Thu May 01 09:55:45 2008 +0100
@@ -25,8 +25,6 @@ from xen.xend.XendLogging import log
 from xen.xend.XendLogging import log
 from xen.util import mkdir
 import xen.util.xsm.xsm as security
-
-__bootloader = None
 
 #
 # Functions for modifying entries in the bootloader, i.e. adding
@@ -513,8 +511,11 @@ class LatePolicyLoader(Bootloader):
         Bootloader.__init__(self)
 
     def probe(self):
-        _dir=os.path.dirname(self.FILENAME)
-        mkdir.parents(_dir, stat.S_IRWXU)
+        try:
+            _dir=os.path.dirname(self.FILENAME)
+            mkdir.parents(_dir, stat.S_IRWXU)
+        except:
+            return False
         return True
 
     def get_default_title(self):
@@ -614,10 +615,12 @@ class LatePolicyLoader(Bootloader):
 
 __bootloader = Bootloader()
 
-grub = Grub()
-if grub.probe() == True:
-    __bootloader = grub
-else:
-    late = LatePolicyLoader()
-    if late.probe() == True:
-        __bootloader = late
+def init():
+    global __bootloader
+    grub = Grub()
+    if grub.probe() == True:
+        __bootloader = grub
+    else:
+        late = LatePolicyLoader()
+        if late.probe() == True:
+            __bootloader = late
diff -r 931932f5fc6d -r 2cf9a8736bab tools/python/xen/xend/XendXSPolicyAdmin.py
--- a/tools/python/xen/xend/XendXSPolicyAdmin.py        Thu May 01 09:55:06 
2008 +0100
+++ b/tools/python/xen/xend/XendXSPolicyAdmin.py        Thu May 01 09:55:45 
2008 +0100
@@ -46,6 +46,7 @@ class XSPolicyAdmin:
         self.maxpolicies = maxpolicies
         self.policies = {}
         self.xsobjs = {}
+        bootloader.init()
 
         act_pol_name = self.get_hv_loaded_policy_name()
         initialize()

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [Xend/ACM] Provide explicit initialization function for bootloader class, Xen patchbot-unstable <=