From: Marc Fiuczynski Date: Thu, 13 Jul 2006 17:14:50 +0000 (+0000) Subject: Cleaned up model option processing X-Git-Tag: planetlab-4_0-rc1~35 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=bb5fbc8ba39ef808bff8f2ec5c2eda7c11b5304e Cleaned up model option processing --- diff --git a/source/ModelOptions.py b/source/ModelOptions.py new file mode 100644 index 0000000..ccd64eb --- /dev/null +++ b/source/ModelOptions.py @@ -0,0 +1,30 @@ +import string + +MINHW = 0x001 +SMP = 0x002 +X86_64 = 0x004 +INTEL = 0x008 +AMD = 0x010 +NUMA = 0x020 +GEODE = 0x040 +LAST = 0x100 + +modeloptions = {'smp':SMP, + 'x64':X86_64, + 'i64':X86_64|INTEL, + 'a64':X86_64|AMD, + 'i32':INTEL, + 'a32':AMD, + 'numa':NUMA, + 'geode':GEODE, + 'minhw':MINHW} + +def Get(model): + modelinfo = string.split(model,'/') + options= 0 + for mi in modelinfo: + info = string.strip(mi) + info = info.lower() + options = options | modeloptions.get(info,0) + + return options diff --git a/source/steps/ChainBootNode.py b/source/steps/ChainBootNode.py index 55beeb2..e2d2e89 100644 --- a/source/steps/ChainBootNode.py +++ b/source/steps/ChainBootNode.py @@ -11,8 +11,7 @@ from systeminfo import systeminfo import BootAPI import notify_messages -from GetAndUpdateNodeDetails import SMP_OPT - +import ModelOptions def Run( vars, log ): """ @@ -128,7 +127,7 @@ def Run( vars, log ): # get the kernel version option = '' - if NODE_MODEL_OPTIONS & SMP_OPT: + if NODE_MODEL_OPTIONS & ModelOptions.SMP: option = 'smp' log.write( "Copying kernel and initrd for booting.\n" ) @@ -244,6 +243,8 @@ def Run( vars, log ): kargs = "root=/dev/mapper/planetlab-root ramdisk_size=8192" + if NODE_MODEL_OPTIONS & ModelOptions.SMP: + kargs = kargs + " " + "acpi=off" try: kargsfb = open("/kargs.txt","r") moreargs = kargsfb.readline() diff --git a/source/steps/GetAndUpdateNodeDetails.py b/source/steps/GetAndUpdateNodeDetails.py index b3d3ab0..be39ef8 100644 --- a/source/steps/GetAndUpdateNodeDetails.py +++ b/source/steps/GetAndUpdateNodeDetails.py @@ -2,23 +2,7 @@ import string from Exceptions import * import BootAPI - -MINHW_OPT = 0x001 -SMP_OPT = 0x002 -X86_64_OPT = 0x004 -INTEL_OPT = 0x008 -AMD_OPT = 0x010 -NUMA_OPT = 0x020 -LAST_OPT = 0x040 - -modeloptions = {'smp':SMP_OPT, - 'x64':X86_64_OPT, - 'i64':X86_64_OPT|INTEL_OPT, - 'a64':X86_64_OPT|AMD_OPT, - 'i32':INTEL_OPT, - 'a32':AMD_OPT, - 'numa':NUMA_OPT, - 'minhw':MINHW_OPT} +import ModelOptions def Run( vars, log ): """ @@ -92,19 +76,11 @@ def Run( vars, log ): # parse in the model options from the node_model string model= vars['NODE_MODEL'] - modelinfo = string.split(model,'/') - options= 0 - for mi in modelinfo: - info = string.strip(mi) - info = info.lower() - options = options | modeloptions.get(info,0) - - print "node model options = %d" % options + options= ModelOptions.Get(model) vars['NODE_MODEL_OPTIONS']=options - # if the end of NODE_MODEL string contains the minhw string, skip hardware - # requirement checks (overrides configuration) - if options & MINHW_OPT: + # Check if we should skip hardware requirement check + if options & ModelOptions.MINHW: vars['SKIP_HARDWARE_REQUIREMENT_CHECK']=1 log.write( "node model indicates override to hardware requirements.\n" ) diff --git a/source/steps/InstallWriteConfig.py b/source/steps/InstallWriteConfig.py index b6038c9..f059507 100644 --- a/source/steps/InstallWriteConfig.py +++ b/source/steps/InstallWriteConfig.py @@ -46,8 +46,7 @@ from Exceptions import * import utils from systeminfo import systeminfo import BootAPI - -from GetAndUpdateNodeDetails import SMP_OPT +import ModelOptions def Run( vars, log ): @@ -231,7 +230,7 @@ def Run( vars, log ): rootdev.close() option = '' - if NODE_MODEL_OPTIONS & SMP_OPT: + if NODE_MODEL_OPTIONS & ModelOptions.SMP: option = 'smp' initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) ) kernel_version= initrd.replace("initrd-", "").replace(".img", "") @@ -421,7 +420,7 @@ def write_modprobeconf_file( vars, log, filename = "/etc/modprobe.conf"): # get the kernel version option = '' - if NODE_MODEL_OPTIONS & SMP_OPT: + if NODE_MODEL_OPTIONS & ModelOptions.SMP: option = 'smp' initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) ) kernel_version= initrd.replace("initrd-", "").replace(".img", "") diff --git a/source/steps/ValidateNodeInstall.py b/source/steps/ValidateNodeInstall.py index d5de397..2e80714 100644 --- a/source/steps/ValidateNodeInstall.py +++ b/source/steps/ValidateNodeInstall.py @@ -4,7 +4,7 @@ from Exceptions import * import utils from systeminfo import systeminfo import compatibility -from GetAndUpdateNodeDetails import SMP_OPT +import ModelOptions def Run( vars, log ): @@ -96,7 +96,7 @@ def Run( vars, log ): # get the kernel version option = '' - if NODE_MODEL_OPTIONS & SMP_OPT: + if NODE_MODEL_OPTIONS & ModelOptions.SMP: option = 'smp' files = ("kernel-boot%s" % option, "initrd-boot%s" % option)