python: Backport argparse to older platforms.
[sliver-openvswitch.git] / xenserver / opt_xensource_libexec_interface-reconfigure
index f756bab..ff4b976 100755 (executable)
@@ -204,6 +204,8 @@ def ifup(netdev):
 #
 
 def pif_rename_physical_devices(pif):
+    if pif_is_tunnel(pif):
+        return
 
     if pif_is_vlan(pif):
         pif = pif_get_vlan_slave(pif)
@@ -415,7 +417,7 @@ def action_up(pif, force):
     pifrec = db().get_pif_record(pif)
 
     ipdev = pif_ipdev_name(pif)
-    dp = DatapathFactory(pif)
+    dp = DatapathFactory()(pif)
 
     log("action_up: %s" % ipdev)
 
@@ -455,7 +457,7 @@ def action_up(pif, force):
 
 def action_down(pif):
     ipdev = pif_ipdev_name(pif)
-    dp = DatapathFactory(pif)
+    dp = DatapathFactory()(pif)
 
     log("action_down: %s" % ipdev)
 
@@ -463,6 +465,9 @@ def action_down(pif):
 
     dp.bring_down()
 
+def action_rewrite():
+    DatapathFactory().rewrite()
+    
 # This is useful for reconfiguring the mgmt interface after having lost connectivity to the pool master
 def action_force_rewrite(bridge, config):
     def getUUID():
@@ -522,6 +527,8 @@ def action_force_rewrite(bridge, config):
     f.write('\t\t<VLAN_slave_of/>\n')
     f.write('\t\t<VLAN_master_of>OpaqueRef:NULL</VLAN_master_of>\n')
     f.write('\t\t<VLAN>-1</VLAN>\n')
+    f.write('\t\t<tunnel_access_PIF_of/>\n')
+    f.write('\t\t<tunnel_transport_PIF_of/>\n')
     f.write('\t\t<device>%s</device>\n' % interface)
     f.write('\t\t<MAC>%s</MAC>\n' % mac)
     f.write('\t\t<other_config/>\n')
@@ -666,7 +673,7 @@ def main(argv=None):
                 pif = db().get_pif_by_uuid(pif_uuid)
 
             if action == "rewrite":
-                pass
+                action_rewrite()
             else:
                 if not pif:
                     raise Usage("No PIF given")