cleanup qemu starter; hopefully the qemu instances could keep on running after the...
[tests.git] / system / config_1testbox.py
index 64f6eee..d891b37 100644 (file)
@@ -1,35 +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":
-        testbox1 = 'testbox1.inria.fr'
-        testbox2 = 'testbox1.inria.fr'
-        target=testbox1
-    elif options.arch == "x86_64":
-#        testbox1 = 'testbox64-1.onelab.eu'
-#        testbox2 = 'testbox64-2.onelab.eu'
-        testbox1 = 'testbox2.inria.fr'
-        testbox2 = 'testbox4.inria.fr'
-        target=testbox1
-    else:
-        print 'Unsupported arch %s'%options.arch
-        sys.exit(1)
+    # all plcs on the same vserver box
+    plc_box   ='speedball.inria.fr'
+    # 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 } ) 
+    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': [ ('deferred01' , {'host_box': testbox1 } ),
-                        ('deferred02' , {'host_box': testbox2 } ),
-                        ],
+              'node': node_map,
               }
     
     return TestMapper(plcs,options).map(mapper)