oops
[tests.git] / system / config_1testbox.py
index aa44e7d..b8a4ea4 100644 (file)
@@ -1,26 +1,38 @@
 import sys
 
 from TestMapper import TestMapper
+from TestPool import TestPoolQemu
 
-# using mapper to do the reallocation job
-
+# a small qemu pool for now
+onelab_qemus_pool = [ ( 'testqemu%d.onelab.eu'%i, None, None) for i in range(1,4) ]
+    
 def config (plcs, options):
 
-    if options.arch == "i386":
-        target = 'testbox32.onelab.eu'
-    elif options.arch == "x86_64":
-        target = 'testbox64.onelab.eu'
-    else:
-        print 'Unsupported arch %s'%options.arch
-        sys.exit(1)
+    # all plcs on the same vserver box
+    plc_box   ='testbox-plc.onelab.eu'
+    # informative
+    label=options.personality.replace("linux","")
+
+    # all qemus on a unique pool of 64bits boxes
+    node_map = []
+    qemu_pool = TestPoolQemu (onelab_qemus_pool,options)
+    for index in range(options.size):
+        index += 1
+        if options.ips_qemu:
+            ip_or_hostname=options.ips_qemu.pop()
+            (hostname,ip,unused)=qemu_pool.locate_entry(ip_or_hostname)
+        else:
+            (hostname,ip,unused) = qemu_pool.next_free()
+        node_map += [ ('node%d'%index, {'host_box':hostname},) ]
 
-    mapper = {'plc': [ ('*' , {'hostname':target,
-                               'PLC_DB_HOST':target,
-                               'PLC_API_HOST':target,
-                               'PLC_BOOT_HOST':target,
-                               'PLC_WWW_HOST':target,
-                               'name':'%s-'+options.arch } ) ],
-              'node': [ ('*' , {'host_box': target } ) ],
+    mapper = {'plc': [ ('*' , {'hostname':plc_box,
+                               'PLC_DB_HOST':plc_box,
+                               'PLC_API_HOST':plc_box,
+                               'PLC_BOOT_HOST':plc_box,
+                               'PLC_WWW_HOST':plc_box,
+                               'name':'%s-'+label } ) 
+                       ],
+              'node': node_map,
               }
     
     return TestMapper(plcs,options).map(mapper)