xentaur

annotate xendomain.py @ 45:9c7a4cfa9738

many platforms support
author igor
date Wed Oct 24 15:17:30 2007 +0300 (2007-10-24)
parents 04f0c6694d1e
children b67ffcdd0043
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@45 61 mac_option=' -m 00:16:3e:01:'+hex(int(N))[2:]+':01'
igor@45 62 if platform != '7200':
igor@45 63 mac_option =''
igor@34 64
igor@45 65 xenomips='/xenomips/ios/'+ios_name+platform_option+npe_option+mac_option
igor@45 66
igor@45 67 default_network_module={
igor@44 68 '7200' : 'PA-FE-TX',
igor@44 69 '3600' : 'NM-1FE-TX',
igor@44 70 '3725' : 'NM-1FE-TX',
igor@44 71 '3745' : 'NM-1FE-TX',
igor@44 72 '2691' : 'NM-1FE-TX',
igor@44 73 }
igor@44 74 network_module=default_network_module[platform]
igor@44 75
igor@45 76 for i in range(len(vbridges)):
igor@45 77 if platform!= '7200' or i!=0:
igor@45 78 xenomips += ' -p '+str(i)+':'+network_module
igor@34 79
igor@34 80 for i in range(len(vbridges)):
igor@34 81 xenomips += ' -s '+str(i)+':0:gen_eth:eth'+str(i)
igor@34 82
igor@34 83 if domain_types[int(N)] == 'quagga':
igor@34 84 extra = "quagga"
igor@34 85 else:
igor@34 86 extra = "xenomips=\""+xenomips+"\""
igor@34 87
igor@34 88 on_poweroff = 'destroy'
igor@34 89 on_reboot = 'restart'
igor@34 90 on_crash = 'restart'
igor@34 91