xentaur

changeset 34:dd8c79bc715c

xendomain.py added
author igor
date Tue Sep 25 20:12:24 2007 +0300 (2007-09-25)
parents c68d804c3017
children 244f1602496a
files xendomain.py
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xendomain.py	Tue Sep 25 20:12:24 2007 +0300
     1.3 @@ -0,0 +1,115 @@
     1.4 +try:
     1.5 +    from xenomips_vars import N
     1.6 +except:
     1.7 +    print "can't find xenomips_vars module"
     1.8 +
     1.9 +
    1.10 +####
    1.11 +#
    1.12 +# External variables:
    1.13 +# * network 
    1.14 +# * domain
    1.15 +
    1.16 +
    1.17 +############################################################################################
    1.18 +# Topology description
    1.19 +
    1.20 +network='change-default-route'
    1.21 +
    1.22 +domains =       [ 'dyn1',     'dyn2',     'dyn3',     'qua4',   'qua5',   'qua6',   'qua7',   'qua8',   'qua9',   ]
    1.23 +domain_types =  [ 'xenomips', 'xenomips', 'xenomips', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', ]
    1.24 +bridges =       [
    1.25 +                  'vlan100',
    1.26 +                  'vlan101',
    1.27 +                  'vlan102',
    1.28 +                  'vlan103',
    1.29 +                  'vlan104',
    1.30 +                  'vlan105',
    1.31 +                  'vlan106',
    1.32 +                  'vlan107',
    1.33 +                  'vlan108',
    1.34 +                  'vlan109',
    1.35 +                  'vlan110',
    1.36 +                  'vlan111',
    1.37 +                ]
    1.38 +
    1.39 +vbridges_table = {
    1.40 +                  'dyn1'    : [ 'vlan101', 'vlan102' ],
    1.41 +                  'dyn2'    : [ 'vlan101', 'vlan103' ],
    1.42 +                  'dyn3'    : [ 'vlan102', 'vlan103', 'vlan104' ],
    1.43 +
    1.44 +                  'qua4'    : [ 'vlan105', 'vlan106', 'vlan111' ],
    1.45 +                  'qua5'    : [ 'vlan110', 'vlan111' ],
    1.46 +                  'qua6'    : [ 'vlan109',  'vlan110' ],
    1.47 +                  'qua7'    : [ 'vlan108',  'vlan109'  ],
    1.48 +                  'qua8'    : [ 'vlan107',  'vlan108' ],
    1.49 +                  'qua9'    : [ 'vlan106',  'vlan107' ],
    1.50 +                 }
    1.51 +
    1.52 +hidden_bridges  = []
    1.53 +broken_links    = []
    1.54 +temporary_links = []
    1.55 +
    1.56 +xenomips_dir='/xen/images/'
    1.57 +ios_name='C7200-JK.BIN'
    1.58 +npe_type="npe-200"
    1.59 +
    1.60 +name = domain
    1.61 +
    1.62 +# property should be specified only to override default values
    1.63 +properties       = {
    1.64 +                    'dyn1': {
    1.65 +                                npe_type: "npe-400",
    1.66 +                            }
    1.67 +                   }
    1.68 +
    1.69 +#this instance configuration
    1.70 +if domain_types[domain] == 'quagga':
    1.71 +    memory = 64
    1.72 +else:
    1.73 +    memory = 400
    1.74 +
    1.75 +############################################################################################
    1.76 +
    1.77 +N = domains.index(domain)
    1.78 +
    1.79 +pae=1
    1.80 +if pae:
    1.81 +    kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
    1.82 +    ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
    1.83 +else:
    1.84 +    kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
    1.85 +    ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
    1.86 +
    1.87 +#builder='linux'
    1.88 +cpu_cap = 10
    1.89 +
    1.90 +
    1.91 +vbridges = vbridges_table[name]
    1.92 +
    1.93 +vif=[]
    1.94 +x=1
    1.95 +for i in vbridges:
    1.96 + vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
    1.97 + x+=1
    1.98 +
    1.99 +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' ]
   1.100 +root = "/dev/hda1 ro"
   1.101 +
   1.102 +xenomips='/xenomips/ios/'+ios_name+' -t '+npe_type+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
   1.103 +
   1.104 +for i in range(len(vbridges)-1):
   1.105 + xenomips += ' -p '+str(i+1)+':PA-FE-TX'
   1.106 +
   1.107 +for i in range(len(vbridges)):
   1.108 + xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
   1.109 +
   1.110 +if domain_types[int(N)] == 'quagga':
   1.111 +    extra = "quagga"
   1.112 +else:
   1.113 +    extra = "xenomips=\""+xenomips+"\""
   1.114 +
   1.115 +on_poweroff = 'destroy'
   1.116 +on_reboot   = 'restart'
   1.117 +on_crash    = 'restart'
   1.118 +