xentaur

diff xentaur.py @ 28:d22ff6f55dc5

autoredraw + link state fix
author igor
date Fri Sep 21 20:48:40 2007 +0300 (2007-09-21)
parents 9821c9a972cd
children 87f19c6d1514
line diff
     1.1 --- a/xentaur.py	Fri Sep 21 20:22:10 2007 +0300
     1.2 +++ b/xentaur.py	Fri Sep 21 20:48:40 2007 +0300
     1.3 @@ -104,8 +104,8 @@
     1.4          for this_bridge in bridges_raw:
     1.5              if this_bridge in hidden_bridges or not this_bridge:
     1.6                  continue 
     1.7 -            if not [ host, this_bridge ] in temporary_links:
     1.8 -                links.append(host+" -- "+this_bridge+" [taillabel=\"fa"+str(i)+"/0\"]")
     1.9 +            if not [ host, bridges_raw.index(this_bridge), this_bridge ] in temporary_links:
    1.10 +                links.append(host+" -- "+this_bridge+" [taillabel=\"fa"+str(bridges_raw.index(this_bridge))+"/0\"]")
    1.11                  i+=1
    1.12         #         if [ host, this_bridge ] in broken_links:
    1.13         #             links.append(host+" -- "+this_bridge+" [taillabel=\"fa"+str(i)+"/0\",style=dashed]")
    1.14 @@ -113,10 +113,10 @@
    1.15         #             links.append(host+" -- "+this_bridge+" [taillabel=\"fa"+str(i)+"/0\"]")
    1.16  
    1.17      for link in temporary_links:
    1.18 -        links.append(link[0]+" -- "+link[1]+" [color=blue,len=10,w=5,weight=5]")
    1.19 +        links.append(link[0]+" -- "+link[2]+" [taillabel=\"fa"+str(link[1])+"/0\",color=blue,len=10,w=5,weight=5]")
    1.20  
    1.21      for link in broken_links:
    1.22 -        links.append(link[0]+" -- "+link[1]+" [taillabel=\"fa"+str(i)+"/0\",style=dashed]")
    1.23 +        links.append(link[0]+" -- "+link[2]+" [taillabel=\"fa"+str(link[1])+"/0\",style=dashed]")
    1.24  
    1.25      linklist=";\n    ".join(links)
    1.26  
    1.27 @@ -231,10 +231,10 @@
    1.28          return 1
    1.29      run_command("sudo brctl delif %s vif%s.%s" % (bridge, dom_id, int_number))
    1.30      vbridges_table[domain][int_number]=''
    1.31 -    if [ domain, bridge ] in temporary_links:
    1.32 -        temporary_links.remove([ domain, bridge ])
    1.33 +    if [ domain, int_number, bridge ] in temporary_links:
    1.34 +        temporary_links.remove([ domain, int_number, bridge ])
    1.35      else:
    1.36 -        broken_links.append([ domain, bridge ])
    1.37 +        broken_links.append([ domain, int_number, bridge ])
    1.38      autoredraw()
    1.39  
    1.40  def int_connect(domain, int_number, bridge):
    1.41 @@ -249,10 +249,10 @@
    1.42          return 1
    1.43      run_command("sudo brctl addif %s vif%s.%s" % (bridge, dom_id, int_number))
    1.44      vbridges_table[domain][int_number]=bridge
    1.45 -    if [ domain, bridge ] in broken_links:
    1.46 -        broken_links.remove([ domain, bridge ])
    1.47 +    if [ domain, int_number, bridge ] in broken_links:
    1.48 +        broken_links.remove([ domain, int_number, bridge ])
    1.49      else:
    1.50 -        temporary_links.append([ domain, bridge ])
    1.51 +        temporary_links.append([ domain, int_number, bridge ])
    1.52      autoredraw()
    1.53  
    1.54  def int_reconnect(domain, int_number, bridge):
    1.55 @@ -271,6 +271,13 @@
    1.56      """
    1.57      return vbridges_table[domain][int_number]
    1.58  
    1.59 +
    1.60 +def dump_start(bridge, filter=""):
    1.61 +    return 0
    1.62 +
    1.63 +def dump_stop():
    1.64 +    return 0
    1.65 +     
    1.66  #-----------------------------------------------------------------------
    1.67  
    1.68