xentaur

annotate xendomain.py @ 44:04f0c6694d1e

default network module
author igor
date Wed Oct 24 14:53:12 2007 +0300 (2007-10-24)
parents e006fac33f05
children 9c7a4cfa9738
rev   line source
igor@34 1 ####
igor@34 2 #
igor@34 3 # External variables:
igor@34 4 # * network
igor@34 5 # * domain
igor@34 6
igor@34 7
igor@35 8 try:
igor@35 9 domain
igor@35 10 except NameError:
igor@35 11 import sys
igor@35 12 network=sys.modules['__main__'].network
igor@35 13 domain=sys.modules['__main__'].domain
igor@34 14
nata@36 15 import os
nata@36 16 sys.path.append(os.environ['HOME']+"/xentaur")
nata@36 17 os.environ['xendomain']=domain
nata@36 18
igor@35 19 #try:
igor@34 20
igor@35 21 exec 'from %s import *' % (network)
igor@35 22 #except:
igor@35 23 # print "Can't find or interpret module %s with topology description" %(network)
igor@35 24 # sys.exit(1)
igor@34 25
igor@34 26
igor@35 27 N = str(domains.index(domain))
igor@35 28 name=domain
igor@34 29
igor@34 30 pae=1
igor@34 31 if pae:
igor@40 32 kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
igor@40 33 ramdisk = "/boot/initrd.img-2.6.18-4-xen-686"
igor@34 34 else:
igor@34 35 kernel = "/boot/vmlinuz-2.6.18-without-PAE-4-xen-686"
igor@34 36 ramdisk = "/boot/initrd.img-2.6.18-without-PAE-4-xen-686-domU"
igor@34 37
igor@34 38 #builder='linux'
igor@34 39 cpu_cap = 10
igor@34 40
igor@34 41
igor@34 42 vbridges = vbridges_table[name]
igor@34 43
igor@34 44 vif=[]
igor@34 45 x=1
igor@34 46 for i in vbridges:
igor@34 47 vif.append('bridge='+i+',mac=00:16:3e:01:'+hex(int(N))[2:]+':'+hex(int('c0',16)+x)[2:])
igor@34 48 x+=1
igor@34 49
igor@34 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' ]
igor@34 51 root = "/dev/hda1 ro"
igor@34 52
igor@42 53 platform_option=""
igor@42 54 if platform != '7200':
igor@42 55 platform_option=' -P '+platform
igor@42 56
igor@42 57 npe_option=""
igor@42 58 if platform == '7200':
igor@42 59 npe_option=" -t "+npe_type
igor@42 60
igor@42 61 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
igor@34 62
igor@44 63 defult_network_module={
igor@44 64 '7200' : 'PA-FE-TX',
igor@44 65 '3600' : 'NM-1FE-TX',
igor@44 66 '3725' : 'NM-1FE-TX',
igor@44 67 '3745' : 'NM-1FE-TX',
igor@44 68 '2691' : 'NM-1FE-TX',
igor@44 69 }
igor@44 70 network_module=default_network_module[platform]
igor@44 71
igor@34 72 for i in range(len(vbridges)-1):
igor@44 73 xenomips += ' -p '+str(i+1)+':'+network_module
igor@34 74
igor@34 75 for i in range(len(vbridges)):
igor@34 76 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
igor@34 77
igor@34 78 if domain_types[int(N)] == 'quagga':
igor@34 79 extra = "quagga"
igor@34 80 else:
igor@34 81 extra = "xenomips=\""+xenomips+"\""
igor@34 82
igor@34 83 on_poweroff = 'destroy'
igor@34 84 on_reboot = 'restart'
igor@34 85 on_crash = 'restart'
igor@34 86