mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[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@us.ibm.com>
This commit is contained in:
1 parent
f0dc96dc71
commit
a2f23ae851
2 files changed
+15
-11
No files matched your search
@@ -26,8 +26,6 @@ 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
|
||||
# a module to boot the system with a policy.
|
||||
@@ -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
|
||||
@@ -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()
|
||||
|
||||