[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [Xend/ACM] Provide explicit initialization function for bootloader class
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |