xenserver: Fix typo in adding static routes in interface-reconfigure.
[sliver-openvswitch.git] / xenserver / opt_xensource_libexec_interface-reconfigure
index 5f19ff3..49b306f 100755 (executable)
@@ -267,7 +267,7 @@ def get_netdev_tx_queue_len(device):
 def get_netdev_by_mac(mac):
     maybe = None
     for device in os.listdir("/sys/class/net"):
-        dev_mac = get_netdev_by_mac(device)
+        dev_mac = get_netdev_mac(device)
         if dev_mac and mac.lower() == dev_mac.lower():
             if get_netdev_tx_queue_len(device):
                 return device
@@ -788,7 +788,7 @@ def configure_netdev(pif):
         for line in oc['static-routes'].split(','):
             network, masklen, gateway = line.split('/')
             run_command(['/sbin/ip', 'route', 'add',
-                         '%s/%s' % (netmask, masklen), 'via', gateway,
+                         '%s/%s' % (network, masklen), 'via', gateway,
                          'dev', ipdev])
 
     settings, offload = ethtool_settings(oc)
@@ -829,6 +829,7 @@ def configure_bond(pif):
     argv = ['--del-match=bonding.%s.[!0-9]*' % interface]
     argv += ["--add=bonding.%s.slave=%s" % (interface, slave)
              for slave in physdevs]
+    argv += ['--add=bonding.%s.fake-iface=true']
 
     if pifrec['MAC'] != "":
         argv += ['--add=port.%s.mac=%s' % (interface, pifrec['MAC'])]
@@ -1014,9 +1015,6 @@ def action_up(pif):
         argv += configure_bond(bond_master)
     modify_config(argv)
 
-    # Configure network devices.
-    configure_netdev(pif)
-
     # Bring up VLAN slave, plus physical devices other than bond
     # slaves (which we brought up earlier).
     if vlan_slave:
@@ -1024,6 +1022,9 @@ def action_up(pif):
     for physdev in set(physdevs) - set(bond_slave_physdevs):
         up_netdev(physdev)
 
+    # Configure network devices.
+    configure_netdev(pif)
+
     # Update /etc/issue (which contains the IP address of the management interface)
     os.system("/sbin/update-issue")