use a pool for qemu boxes as well
[tests.git] / system / config_1testbox.py
1 import sys
2
3 from TestMapper import TestMapper
4 from TestPool import TestPoolQemu
5
6 # a small qemu pool for now
7 onelab_qemus_pool = [ 
8     ( 'kruder.inria.fr', None, None),
9     ( 'estran.inria.fr', None, None),
10 # cut here
11     ( 'blitz.inria.fr', None, None),
12 ]
13     
14 def config (plcs, options):
15
16     # all plcs on the same vserver box
17     plc_box   ='speedball.inria.fr'
18     # informative
19     label=options.personality.replace("linux","")
20
21     # all qemus on a unique pool of 64bits boxes
22     node_map = []
23     qemu_pool = TestPoolQemu (onelab_qemus_pool,options)
24     for index in range(options.size):
25         index += 1
26         if options.ips_qemu:
27             ip_or_hostname=options.ips_qemu.pop()
28             (hostname,ip,unused)=qemu_pool.locate_entry(ip_or_hostname)
29         else:
30             (hostname,ip,unused) = qemu_pool.next_free()
31         node_map += [ ('node%d'%index, {'host_box':hostname},) ]
32
33     mapper = {'plc': [ ('*' , {'hostname':plc_box,
34                                'PLC_DB_HOST':plc_box,
35                                'PLC_API_HOST':plc_box,
36                                'PLC_BOOT_HOST':plc_box,
37                                'PLC_WWW_HOST':plc_box,
38                                'name':'%s-'+label } ) 
39                        ],
40               'node': node_map,
41               }
42     
43     return TestMapper(plcs,options).map(mapper)