xentaur

view xendomain.py @ 42:e006fac33f05

dynamips platform
author igor
date Wed Oct 24 13:27:53 2007 +0300 (2007-10-24)
parents 10444acb35f4
children 04f0c6694d1e
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 for i in range(len(vbridges)-1):
64 xenomips += ' -p '+str(i+1)+':PA-FE-TX'
66 for i in range(len(vbridges)):
67 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
69 if domain_types[int(N)] == 'quagga':
70 extra = "quagga"
71 else:
72 extra = "xenomips=\""+xenomips+"\""
74 on_poweroff = 'destroy'
75 on_reboot = 'restart'
76 on_crash = 'restart'