xentaur
view xendomain.py @ 46:85794a582ef5
naming pics as configs
author | igor |
---|---|
date | Wed Oct 24 15:30:43 2007 +0300 (2007-10-24) |
parents | 04f0c6694d1e |
children | b67ffcdd0043 |
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 mac_option=' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
62 if platform != '7200':
63 mac_option =''
65 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+mac_option
67 default_network_module={
68 '7200' : 'PA-FE-TX',
69 '3600' : 'NM-1FE-TX',
70 '3725' : 'NM-1FE-TX',
71 '3745' : 'NM-1FE-TX',
72 '2691' : 'NM-1FE-TX',
73 }
74 network_module=default_network_module[platform]
76 for i in range(len(vbridges)):
77 if platform!= '7200' or i!=0:
78 xenomips += ' -p '+str(i)+':'+network_module
80 for i in range(len(vbridges)):
81 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
83 if domain_types[int(N)] == 'quagga':
84 extra = "quagga"
85 else:
86 extra = "xenomips=\""+xenomips+"\""
88 on_poweroff = 'destroy'
89 on_reboot = 'restart'
90 on_crash = 'restart'