xen-drbd

diff xen-drbd-install.py @ 54:f7d6a94aa307

cleaning up
author root@linux10
date Fri Oct 10 22:30:16 2008 +0000 (2008-10-10)
parents 21f21fa8f106
children 8afb0999f562
line diff
     1.1 --- a/xen-drbd-install.py	Fri Oct 10 18:43:08 2008 +0000
     1.2 +++ b/xen-drbd-install.py	Fri Oct 10 22:30:16 2008 +0000
     1.3 @@ -19,7 +19,7 @@
     1.4  
     1.5  Options:
     1.6      --help         (-h)   -- show usage information
     1.7 -    --network=name (-n)   -- the network descriptions is in the file name.py (default: network.py)
     1.8 +    --network=name (-n)   -- the network descriptions is in the file name (default: network)
     1.9  """
    1.10  
    1.11  
    1.12 @@ -364,24 +364,33 @@
    1.13  def make_bridges():
    1.14      ip=get_management_ip()
    1.15      gw=get_default_gateway()
    1.16 -    print "ifconfig %s 0.0.0.0 down" % (trunk)
    1.17      
    1.18 +    trunk_bridge=trunk
    1.19 +
    1.20      # tagged interfaces
    1.21      for bridge in bridges:
    1.22          vlan=vlans[bridges.index(bridge)]
    1.23          if vlan == 'tagged': 
    1.24 -            print "/etc/xen/scripts/network-bridge-for-xen-drbd start vifnum=%s bridge=%s netdev=%s" % (bridges.index(bridge)+2,bridge,trunk)
    1.25 -            print "ip link set %s up" % (trunk)
    1.26 +            if trunk_bridge != trunk:
    1.27 +                print "\n=====\nERROR: No more than one tagged bridge allowed.\nYou have defined the tagged bridge already, %s "  % trunk_bridge
    1.28 +		sys.exit(1)
    1.29 +            trunk_bridge=bridge
    1.30 +	    print "ifconfig %s 0.0.0.0 down" % (trunk)
    1.31 +            print "/etc/xen/scripts/network-bridge start vifnum=%s bridge=%s netdev=%s" % (bridges.index(bridge)+2,bridge,trunk)
    1.32 +            print "ip link set %s up" % (trunk_bridge)
    1.33 +
    1.34 +    if trunk_bridge==trunk:
    1.35 +	    print "ifconfig %s up" % (trunk)
    1.36  
    1.37      # untagged interfaces
    1.38      for bridge in bridges:
    1.39          vlan=vlans[bridges.index(bridge)]
    1.40          if vlan != 'tagged': 
    1.41 -            print "vconfig add %s %s" % (trunk,vlan)
    1.42 -            print "/etc/xen/scripts/network-bridge-for-xen-drbd start vifnum=%s bridge=%s netdev=%s.%s" % (bridges.index(bridge)+2,bridge,trunk,vlan)
    1.43 -            print "ip link set %s.%s up" % (trunk,vlan)
    1.44 +            print "vconfig add %s %s" % (trunk_bridge,vlan)
    1.45 +            print "/etc/xen/scripts/network-bridge start vifnum=%s bridge=%s netdev=%s.%s" % (bridges.index(bridge)+2,bridge,trunk_bridge,vlan)
    1.46 +            print "ip link set %s up" % (bridge)
    1.47  
    1.48 -    print "ifconfig %s.%s %s netmask %s" % (trunk,management_vlan,management_ip,management_netmask)
    1.49 +    print "ifconfig %s %s netmask %s" % (management_interface,management_ip,management_netmask)
    1.50      if management_gw:
    1.51              print "route add default gw %s" % (management_gw)
    1.52