xentaur
changeset 35:244f1602496a
config splitted to several modules
author | igor |
---|---|
date | Tue Sep 25 22:16:24 2007 +0300 (2007-09-25) |
parents | dd8c79bc715c |
children | 7bf7abe92123 |
files | xendomain.py xentaur.py |
line diff
1.1 --- a/xendomain.py Tue Sep 25 20:12:24 2007 +0300 1.2 +++ b/xendomain.py Tue Sep 25 22:16:24 2007 +0300 1.3 @@ -1,9 +1,3 @@ 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 @@ -11,67 +5,24 @@ 1.14 # * domain 1.15 1.16 1.17 -############################################################################################ 1.18 -# Topology description 1.19 +try: 1.20 + domain 1.21 +except NameError: 1.22 + import sys 1.23 + network=sys.modules['__main__'].network 1.24 + domain=sys.modules['__main__'].domain 1.25 1.26 -network='change-default-route' 1.27 +#sys.path.append('/home/igor/xentaur') 1.28 +#try: 1.29 1.30 -domains = [ 'dyn1', 'dyn2', 'dyn3', 'qua4', 'qua5', 'qua6', 'qua7', 'qua8', 'qua9', ] 1.31 -domain_types = [ 'xenomips', 'xenomips', 'xenomips', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', 'quagga', ] 1.32 -bridges = [ 1.33 - 'vlan100', 1.34 - 'vlan101', 1.35 - 'vlan102', 1.36 - 'vlan103', 1.37 - 'vlan104', 1.38 - 'vlan105', 1.39 - 'vlan106', 1.40 - 'vlan107', 1.41 - 'vlan108', 1.42 - 'vlan109', 1.43 - 'vlan110', 1.44 - 'vlan111', 1.45 - ] 1.46 +exec 'from %s import *' % (network) 1.47 +#except: 1.48 +# print "Can't find or interpret module %s with topology description" %(network) 1.49 +# sys.exit(1) 1.50 1.51 -vbridges_table = { 1.52 - 'dyn1' : [ 'vlan101', 'vlan102' ], 1.53 - 'dyn2' : [ 'vlan101', 'vlan103' ], 1.54 - 'dyn3' : [ 'vlan102', 'vlan103', 'vlan104' ], 1.55 1.56 - 'qua4' : [ 'vlan105', 'vlan106', 'vlan111' ], 1.57 - 'qua5' : [ 'vlan110', 'vlan111' ], 1.58 - 'qua6' : [ 'vlan109', 'vlan110' ], 1.59 - 'qua7' : [ 'vlan108', 'vlan109' ], 1.60 - 'qua8' : [ 'vlan107', 'vlan108' ], 1.61 - 'qua9' : [ 'vlan106', 'vlan107' ], 1.62 - } 1.63 - 1.64 -hidden_bridges = [] 1.65 -broken_links = [] 1.66 -temporary_links = [] 1.67 - 1.68 -xenomips_dir='/xen/images/' 1.69 -ios_name='C7200-JK.BIN' 1.70 -npe_type="npe-200" 1.71 - 1.72 -name = domain 1.73 - 1.74 -# property should be specified only to override default values 1.75 -properties = { 1.76 - 'dyn1': { 1.77 - npe_type: "npe-400", 1.78 - } 1.79 - } 1.80 - 1.81 -#this instance configuration 1.82 -if domain_types[domain] == 'quagga': 1.83 - memory = 64 1.84 -else: 1.85 - memory = 400 1.86 - 1.87 -############################################################################################ 1.88 - 1.89 -N = domains.index(domain) 1.90 +N = str(domains.index(domain)) 1.91 +name=domain 1.92 1.93 pae=1 1.94 if pae:
2.1 --- a/xentaur.py Tue Sep 25 20:12:24 2007 +0300 2.2 +++ b/xentaur.py Tue Sep 25 22:16:24 2007 +0300 2.3 @@ -4,14 +4,21 @@ 2.4 import sys,os,time 2.5 import xenomips_vars 2.6 xenomips_vars.N='1' 2.7 + 2.8 +xentaur_path=os.environ['HOME']+"/xentaur" 2.9 + 2.10 sys.path.append('/etc/xen') 2.11 +sys.path.append(xentaur_path) 2.12 2.13 -xen_config_name='four_quaggasN' 2.14 -try: 2.15 - exec 'from '+xen_config_name+' import bridges,vbridges_table, hidden_bridges, domains, broken_links, temporary_links, domain_types' 2.16 -except: 2.17 - print "Can't find module: %s " % (xen_config_name) 2.18 - sys.exit(0) 2.19 +network='faberge' 2.20 +domain='dyn1' 2.21 +from xendomain import * 2.22 + 2.23 +#try: 2.24 +# exec 'from '+network+' import bridges,vbridges_table, hidden_bridges, domains, broken_links, temporary_links, domain_types' 2.25 +#except: 2.26 +# print "Can't find module: %s " % (xen_config_name) 2.27 +# sys.exit(0) 2.28 2.29 bridges_turned_down=[] 2.30 2.31 @@ -49,12 +56,12 @@ 2.32 2.33 2.34 def create_domains_script(): 2.35 - for N in range(len(domains)): 2.36 - print "sudo /usr/sbin/xm create "+xen_config_name+" N="+str(N)+" && sleep 1 && sudo /usr/sbin/xm sched-credit -d $(sudo /usr/sbin/xm list | grep "+domains[N]+" | awk '{print $2}') -c 10 && sleep 1" 2.37 + for domain in domains: 2.38 + print "sudo /usr/sbin/xm create "+xentaur_path+"/xendomain "+" domain="+domain+" && sleep 1 && sudo /usr/sbin/xm sched-credit -d $(sudo /usr/sbin/xm list | grep "+domain+" | awk '{print $2}') -c 10 && sleep 1" 2.39 2.40 def destroy_domains_script(): 2.41 - for N in range(len(domains)): 2.42 - print "sudo /usr/sbin/xm shutdown "+domains[N] 2.43 + for domain in domains: 2.44 + print "sudo /usr/sbin/xm shutdown "+domain 2.45 2.46 def create_screens_script(): 2.47 N=1