xentaur

annotate xendomain.py @ 34:dd8c79bc715c

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