xentaur

view xendomain.py @ 44:04f0c6694d1e

default network module
author igor
date Wed Oct 24 14:53:12 2007 +0300 (2007-10-24)
parents e006fac33f05
children 9c7a4cfa9738
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
19 #try:
21 exec 'from %s import *' % (network)
22 #except:
23 # print "Can't find or interpret module %s with topology description" %(network)
24 # sys.exit(1)
27 N = str(domains.index(domain))
28 name=domain
30 pae=1
31 if pae:
32 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
33 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
34 else:
35 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
36 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
38 #builder='linux'
39 cpu_cap = 10
42 vbridges = vbridges_table[name]
44 vif=[]
45 x=1
46 for i in vbridges:
47 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
48 x+=1
50 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' ]
51 root = "/dev/hda1 ro"
53 platform_option=""
54 if platform != '7200':
55 platform_option=' -P '+platform
57 npe_option=""
58 if platform == '7200':
59 npe_option=" -t "+npe_type
61 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
63 defult_network_module={
64 '7200' : 'PA-FE-TX',
65 '3600' : 'NM-1FE-TX',
66 '3725' : 'NM-1FE-TX',
67 '3745' : 'NM-1FE-TX',
68 '2691' : 'NM-1FE-TX',
69 }
70 network_module=default_network_module[platform]
72 for i in range(len(vbridges)-1):
73 xenomips += ' -p '+str(i+1)+':'+network_module
75 for i in range(len(vbridges)):
76 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
78 if domain_types[int(N)] == 'quagga':
79 extra = "quagga"
80 else:
81 extra = "xenomips=\""+xenomips+"\""
83 on_poweroff = 'destroy'
84 on_reboot = 'restart'
85 on_crash = 'restart'