From: Thierry Parmentelat Date: Mon, 21 Apr 2008 16:32:14 +0000 (+0000) Subject: manage defaults locally X-Git-Tag: tests-4.2-4~32 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0c6c68fa26ea556e7f217130680009ac5fbeb467;p=tests.git manage defaults locally --- diff --git a/system/TestMain.py b/system/TestMain.py index 821fc32..59f2de2 100755 --- a/system/TestMain.py +++ b/system/TestMain.py @@ -14,7 +14,7 @@ class TestMain: subversion_id = "$Id$" - default_config = [ 'main' , '1vnodes' , '1testbox64' ] + default_config = [ 'default' ] default_build_url = "http://svn.planet-lab.org/svn/build/trunk" @@ -68,7 +68,9 @@ steps refer to a method in TestPlc or to a step_* module parser.add_option("-i","--ip",action="callback", callback=TestMain.optparse_list, dest="ips", nargs=1,type="string", help="Specify the set of IP addresses to use in vserver mode (disable scanning)") - parser.add_option("-s","--small",action="store_true",dest="small_test",default=False, + parser.add_option("-s","--vserver",action="store_true",dest="native",default=False, + help="deploy myplc-native rather than former chroot-based package") + parser.add_option("-1","--small",action="store_true",dest="small_test",default=False, help="run a small test -- typically only one node") parser.add_option("-d","--dbname",action="store",dest="dbname",default=None, help="Used by db_dump and db_restore") @@ -82,9 +84,9 @@ steps refer to a method in TestPlc or to a step_* module help="Force the NM to restart in check_slices step") (self.options, self.args) = parser.parse_args() - # tmp : force small test - utils.header("XXX WARNING : forcing small tests") - self.options.small_test = True +# tmp : force small test +# utils.header("XXX WARNING : forcing small tests") +# self.options.small_test = True if len(self.args) == 0: if self.options.all_steps: @@ -142,6 +144,9 @@ steps refer to a method in TestPlc or to a step_* module fsave.close() # utils.header('Saved %s into %s'%(recname,filename)) + self.options.arch = "i386" + if self.options.myplc_url.find("x86_64") >= 0: + self.options.arch="x86_64" # steps if not self.options.steps: #default (all) steps diff --git a/system/TestPlc.py b/system/TestPlc.py index db8abb6..52885b5 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -302,8 +302,12 @@ class TestPlc: repo_url = self.options.myplc_url for level in [ 'rpmname','arch' ]: repo_url = os.path.dirname(repo_url) - create_vserver="%s/vtest-init-vserver.sh %s %s -- --interface eth0:%s"%\ - (build_dir,self.vservername,repo_url,self.vserverip) + if self.options.arch == "i386": + personality="-p linux32" + else: + personality="-p linux64" + create_vserver="%s/vtest-init-vserver.sh %s %s %s -- --interface eth0:%s"%\ + (build_dir,personality,self.vservername,repo_url,self.vserverip) return self.run_in_host(create_vserver) == 0 def install(self): diff --git a/system/config_1testbox32.py b/system/config_1testbox.py similarity index 62% rename from system/config_1testbox32.py rename to system/config_1testbox.py index 7bc0935..d21e1dd 100644 --- a/system/config_1testbox32.py +++ b/system/config_1testbox.py @@ -1,18 +1,25 @@ -# +import sys + from TestMapper import TestMapper # using mapper to do the reallocation job -target = 'testbox32.one-lab.org' - def config (plcs, options): + if options.arch == "i386": + target = 'testbox32.one-lab.org' + elif options.arch == "x86_64": + target = 'testbox64.one-lab.org' + else: + print 'Unsupported arch %s'%options.arch + sys.exit(1) + mapper = {'plc': [ ('*' , {'hostname':target, 'PLC_DB_HOST':target, 'PLC_API_HOST':target, 'PLC_BOOT_HOST':target, 'PLC_WWW_HOST':target, - 'name':'%s32' } ) ], + 'name':'%s'+options.arch } ) ], 'node': [ ('*' , {'host_box': target } ) ], } diff --git a/system/config_1testbox64.py b/system/config_1testbox64.py deleted file mode 100644 index f93331f..0000000 --- a/system/config_1testbox64.py +++ /dev/null @@ -1,19 +0,0 @@ -# -from TestMapper import TestMapper - -# using mapper to do the reallocation job - -target = 'testbox64.one-lab.org' - -def config (plcs, options): - - mapper = {'plc': [ ('*' , {'hostname':target, - 'PLC_DB_HOST':target, - 'PLC_API_HOST':target, - 'PLC_BOOT_HOST':target, - 'PLC_WWW_HOST':target, - 'name':'%s64' } ) ], - 'node': [ ('*' , {'host_box': target } ) ], - } - - return TestMapper(plcs,options).map(mapper) diff --git a/system/config_default.py b/system/config_default.py new file mode 100644 index 0000000..2ca866a --- /dev/null +++ b/system/config_default.py @@ -0,0 +1,19 @@ +# the defaults +# long story short, this does +# main (standard scenario), 1vnodes (map node(s) in the onelab pool) and then +# 1testbox32 or 64 depending on the personality option + +def config (plc_specs, options): + import config_main + plcs = config_main.config([],options) + import config_1vnodes + plcs = config_1vnodes.config(plcs,options) + import config_1testbox + plcs = config_1testbox.config (plcs,options) + + if options.native: + import config_1vservers + plcs = config_1vservers.config (plcs,options) + + return plcs +