xentaur

diff xentaur.py @ 12:54c51dea92a2

rerunning dynamips and vtysh after exit
author igor
date Fri Sep 14 12:04:44 2007 +0300 (2007-09-14)
parents f7fa09a390ed
children 3f704d1f0f85
line diff
     1.1 --- a/xentaur.py	Thu Aug 30 14:45:50 2007 +0300
     1.2 +++ b/xentaur.py	Fri Sep 14 12:04:44 2007 +0300
     1.3 @@ -5,7 +5,10 @@
     1.4  import xenomips_vars
     1.5  xenomips_vars.N='1'
     1.6  sys.path.append('/etc/xen')
     1.7 -from xenomipsN import bridges,vbridges_table, hidden_bridges, domains, broken_links, temporary_links, domain_types
     1.8 +
     1.9 +xen_config_name='fabergeN'
    1.10 +from fabergeN import bridges,vbridges_table, hidden_bridges, domains, broken_links, temporary_links, domain_types
    1.11 +
    1.12  from IPython.Shell import IPShellEmbed
    1.13  
    1.14  
    1.15 @@ -35,7 +38,7 @@
    1.16  
    1.17  def create_domains_script():
    1.18      for N in range(len(domains)):
    1.19 -        print "sudo /usr/sbin/xm create xenomipsN 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"
    1.20 +        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"
    1.21  
    1.22  def destroy_domains_script():
    1.23      for N in range(len(domains)):
    1.24 @@ -46,15 +49,19 @@
    1.25      N=1
    1.26      screens=[]
    1.27      for domain in domains:
    1.28 -        screens.append("screen -t "+domain+"   "+str(N)+" xm console "+domain)
    1.29 -#        ip="192.168.80."+str(200+N)
    1.30 -#        screens.append("screen -t "+domain+"   "+str(N)+" sh -c 'while true; do ssh root@"+ip+" ; done'")
    1.31 +        screens.append("screen -t "+domain+" "+str(N)+" sh -c 'while true; do sudo xm console "+domain+" ; echo Retrying in 5 seconds...; sleep 5; done'")
    1.32          N+=1
    1.33      screenlist="\n".join(screens)
    1.34  
    1.35 +#
    1.36 +# Previous terminal acccess commands:
    1.37 +#        ip="192.168.80."+str(200+N)
    1.38 +#        screens.append("screen -t "+domain+"   "+str(N)+" sh -c 'while true; do ssh root@"+ip+" ; done'")
    1.39 +#
    1.40 +
    1.41  #hardstatus string "\%{gk}\%c \%{yk}\%M\%d \%{wk}\%?\%-Lw\%?\%{bw}\%n*\%f\%t\%?(\%u)\%?\%{wk}\%?\%+Lw\%?"
    1.42     
    1.43 -    f=open("screenrc", "w");
    1.44 +    f=open(screenrc, "w");
    1.45      f.write("""
    1.46  hardstatus on
    1.47  hardstatus alwayslastline