xentaur

view xendomain.py @ 48:7a1b67a60fce

fix
author igor
date Wed Oct 24 19:28:37 2007 +0300 (2007-10-24)
parents b67ffcdd0043
children 308b524d9a70
line source
1 ####
2 #
3 # External variables:
4 # * network
5 # * domain
8 try:
9 domain
10 except NameError:
11 import sys
12 network=sys.modules['__main__'].network
13 domain=sys.modules['__main__'].domain
15 import os
16 sys.path.append(os.environ['HOME']+"/xentaur")
17 os.environ['xendomain']=domain
20 ############################
21 # default values:
22 platform='7200'
23 npe_type='npe-400'
24 bridge_bridge_table = {
25 }
27 hidden_bridges = []
28 broken_links = []
29 temporary_links = []
31 real_bridges=[]
32 real_nodes=[]
33 ############################
35 # overriden by network config
36 #try:
37 exec 'from %s import *' % (network)
38 #except:
39 # print "Can't find or interpret module %s with topology description" %(network)
40 # sys.exit(1)
43 N = str(domains.index(domain))
44 name=domain
46 pae=1
47 if pae:
48 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
49 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
50 else:
51 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
52 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
54 #builder='linux'
55 cpu_cap = 10
58 vbridges = vbridges_table[name]
60 vif=[]
61 x=1
62 for i in vbridges:
63 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
64 x+=1
66 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' ]
67 root = "/dev/hda1 ro"
69 platform_option=""
70 if platform != '7200':
71 platform_option=' -P '+platform
73 npe_option=""
74 if platform == '7200':
75 npe_option=" -t "+npe_type
77 mac_option=' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
78 if platform != '7200':
79 mac_option =''
81 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+mac_option
83 default_network_module={
84 '7200' : 'PA-FE-TX',
85 '3600' : 'NM-1FE-TX',
86 '3725' : 'NM-1FE-TX',
87 '3745' : 'NM-1FE-TX',
88 '2691' : 'NM-1FE-TX',
89 }
90 network_module=default_network_module[platform]
92 if platform== '7200':
93 for i in range(len(vbridges)-1):
94 xenomips += ' -p '+str(i+1)+':'+network_module
95 else:
96 for i in range(len(vbridges)-1):
97 xenomips += ' -p '+str(i+1)+':'+network_module
100 for i in range(len(vbridges)):
101 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
103 if domain_types[int(N)] == 'quagga':
104 extra = "quagga"
105 else:
106 extra = "xenomips=\""+xenomips+"\""
108 on_poweroff = 'destroy'
109 on_reboot = 'restart'
110 on_crash = 'restart'