annotate xendomain.py @ 35:244f1602496a
config splitted to several modules
author |
igor |
date |
Tue Sep 25 22:16:24 2007 +0300 (2007-09-25) |
parents |
dd8c79bc715c |
children |
7bf7abe92123 |
rev |
line source |
igor@34
|
1 ####
|
igor@34
|
2 #
|
igor@34
|
3 # External variables:
|
igor@34
|
4 # * network
|
igor@34
|
5 # * domain
|
igor@34
|
6
|
igor@34
|
7
|
igor@35
|
8 try:
|
igor@35
|
9 domain
|
igor@35
|
10 except NameError:
|
igor@35
|
11 import sys
|
igor@35
|
12 network=sys.modules['__main__'].network
|
igor@35
|
13 domain=sys.modules['__main__'].domain
|
igor@34
|
14
|
igor@35
|
15 #sys.path.append('/home/igor/xentaur')
|
igor@35
|
16 #try:
|
igor@34
|
17
|
igor@35
|
18 exec 'from %s import *' % (network)
|
igor@35
|
19 #except:
|
igor@35
|
20 # print "Can't find or interpret module %s with topology description" %(network)
|
igor@35
|
21 # sys.exit(1)
|
igor@34
|
22
|
igor@34
|
23
|
igor@35
|
24 N = str(domains.index(domain))
|
igor@35
|
25 name=domain
|
igor@34
|
26
|
igor@34
|
27 pae=1
|
igor@34
|
28 if pae:
|
igor@34
|
29 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
|
igor@34
|
30 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
|
igor@34
|
31 else:
|
igor@34
|
32 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
|
igor@34
|
33 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
|
igor@34
|
34
|
igor@34
|
35 #builder='linux'
|
igor@34
|
36 cpu_cap = 10
|
igor@34
|
37
|
igor@34
|
38
|
igor@34
|
39 vbridges = vbridges_table[name]
|
igor@34
|
40
|
igor@34
|
41 vif=[]
|
igor@34
|
42 x=1
|
igor@34
|
43 for i in vbridges:
|
igor@34
|
44 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
|
igor@34
|
45 x+=1
|
igor@34
|
46
|
igor@34
|
47 disk = [ 'file:'+xenomips_dir+'xenomips1.img,hda1,r', 'file:'+xenomips_dir+'xenomips-ios1.img,hda2,r', 'file:'+xenomips_dir+'xenomips-config'+N+'.img,hda3,w' ]
|
igor@34
|
48 root = "/dev/hda1 ro"
|
igor@34
|
49
|
igor@34
|
50 xenomips='/xenomips/ios/'+ios_name+' -t '+npe_type+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
|
igor@34
|
51
|
igor@34
|
52 for i in range(len(vbridges)-1):
|
igor@34
|
53 xenomips += ' -p '+str(i+1)+':PA-FE-TX'
|
igor@34
|
54
|
igor@34
|
55 for i in range(len(vbridges)):
|
igor@34
|
56 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
|
igor@34
|
57
|
igor@34
|
58 if domain_types[int(N)] == 'quagga':
|
igor@34
|
59 extra = "quagga"
|
igor@34
|
60 else:
|
igor@34
|
61 extra = "xenomips=\""+xenomips+"\""
|
igor@34
|
62
|
igor@34
|
63 on_poweroff = 'destroy'
|
igor@34
|
64 on_reboot = 'restart'
|
igor@34
|
65 on_crash = 'restart'
|
igor@34
|
66
|