xentaur

view xendomain.py @ 34:dd8c79bc715c

xendomain.py added
author igor
date Tue Sep 25 20:12:24 2007 +0300 (2007-09-25)
parents
children 244f1602496a
line source
1 try:
2 from xenomips_vars import N
3 except:
4 print "can't find xenomips_vars module"
7 ####
8 #
9 # External variables:
10 # * network
11 # * domain
14 ############################################################################################
15 # Topology description
17 network='change-default-route'
19 domains = [ 'dyn1', 'dyn2', 'dyn3', 'qua4', 'qua5', 'qua6', 'qua7', 'qua8', 'qua9', ]
20 domain_types = [ 'xenomips', 'xenomips', 'xenomips', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', ]
21 bridges = [
22 'vlan100',
23 'vlan101',
24 'vlan102',
25 'vlan103',
26 'vlan104',
27 'vlan105',
28 'vlan106',
29 'vlan107',
30 'vlan108',
31 'vlan109',
32 'vlan110',
33 'vlan111',
34 ]
36 vbridges_table = {
37 'dyn1' : [ 'vlan101', 'vlan102' ],
38 'dyn2' : [ 'vlan101', 'vlan103' ],
39 'dyn3' : [ 'vlan102', 'vlan103', 'vlan104' ],
41 'qua4' : [ 'vlan105', 'vlan106', 'vlan111' ],
42 'qua5' : [ 'vlan110', 'vlan111' ],
43 'qua6' : [ 'vlan109', 'vlan110' ],
44 'qua7' : [ 'vlan108', 'vlan109' ],
45 'qua8' : [ 'vlan107', 'vlan108' ],
46 'qua9' : [ 'vlan106', 'vlan107' ],
47 }
49 hidden_bridges = []
50 broken_links = []
51 temporary_links = []
53 xenomips_dir='/xen/images/'
54 ios_name='C7200-JK.BIN'
55 npe_type="npe-200"
57 name = domain
59 # property should be specified only to override default values
60 properties = {
61 'dyn1': {
62 npe_type: "npe-400",
63 }
64 }
66 #this instance configuration
67 if domain_types[domain] == 'quagga':
68 memory = 64
69 else:
70 memory = 400
72 ############################################################################################
74 N = domains.index(domain)
76 pae=1
77 if pae:
78 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
79 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
80 else:
81 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
82 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
84 #builder='linux'
85 cpu_cap = 10
88 vbridges = vbridges_table[name]
90 vif=[]
91 x=1
92 for i in vbridges:
93 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
94 x+=1
96 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' ]
97 root = "/dev/hda1 ro"
99 xenomips='/xenomips/ios/'+ios_name+' -t '+npe_type+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
101 for i in range(len(vbridges)-1):
102 xenomips += ' -p '+str(i+1)+':PA-FE-TX'
104 for i in range(len(vbridges)):
105 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
107 if domain_types[int(N)] == 'quagga':
108 extra = "quagga"
109 else:
110 extra = "xenomips=\""+xenomips+"\""
112 on_poweroff = 'destroy'
113 on_reboot = 'restart'
114 on_crash = 'restart'