[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 23 of 33] interface-reconfigure: Do not try to bring down interfaces before forcing them up



Doing this at start of day seems to cause all sorts of issues with the 
/sbin/ifdown script.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r e74e2f09d0ee -r d680275b3054 scripts/interface-reconfigure
--- a/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
+++ b/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
@@ -1492,7 +1492,7 @@
 # Toplevel actions
 #
 
-def action_up(pif):
+def action_up(pif, force):
     pifrec = db.get_pif_record(pif)
 
     ipdev = pif_ipdev_name(pif)
@@ -1508,26 +1508,26 @@
     
     pif_rename_physical_devices(pif)
 
-    # if there is a bridge using this pif then bring it down
-    ifdown(ipdev)
+    if not force:
+        # if there is a bridge using this pif then bring it down
+        ifdown(ipdev)
 
-    # Bring down any VLAN masters so that we can reconfigure the slave.
-    vlan_masters = pif_get_vlan_masters(pif)
-    for master in vlan_masters:
-        name = pif_netdev_name(master)
-        log("action_up: bring down vlan master %s" % (name))
-        netdev_down(name)
+        # Bring down any VLAN masters so that we can reconfigure the slave.
+        for master in pif_get_vlan_masters(pif):
+            name = pif_netdev_name(master)
+            log("action_up: bring down vlan master %s" % (name))
+            netdev_down(name)
 
-    # interface-reconfigure is never explicitly called to down a bond master.
-    # However, when we are called to up a slave it is implicit that we are 
destroying the master.
-    bond_masters = pif_get_bond_masters(pif)
-    for master in bond_masters:
-        log("action_up: bring down bond master %s" % (pif_netdev_name(master)))
-        # bring down master
-        bring_down_interface(master, destroy=True)
+        # interface-reconfigure is never explicitly called to down a bond 
master.
+        # However, when we are called to up a slave it is implicit that we are 
destroying the master.
+        bond_masters = pif_get_bond_masters(pif)
+        for master in bond_masters:
+            log("action_up: bring down bond master %s" % 
(pif_netdev_name(master)))
+            # bring down master
+            bring_down_interface(master, destroy=True)
 
-    # No masters left - now its safe to reconfigure the slave.
-    bring_down_interface(pif)
+        # No masters left - now its safe to reconfigure the slave.
+        bring_down_interface(pif)
 
     try:
         f.apply()
@@ -1541,7 +1541,7 @@
         os.system("/sbin/update-issue")
 
         # Bring back any currently-attached VLAN masters (brought down above)
-        for master in [v for v in vlan_masters if 
db.get_pif_record(v)['currently_attached']]:
+        for master in [v for v in pif_get_vlan_masters(pif) if 
db.get_pif_record(v)['currently_attached']]:
             name = pif_netdev_name(master)
             log("action_up: bring up %s" % (name))
             netdev_up(name)
@@ -1758,7 +1758,7 @@
                 management_pif = db.get_management_pif()
 
                 if action == "up":
-                    action_up(pif)
+                    action_up(pif, True)
                 elif action == "down":
                     action_down(pif)
             else:
@@ -1790,7 +1790,7 @@
                     return 0
 
                 if action == "up":
-                    action_up(pif)
+                    action_up(pif, False)
                 elif action == "down":
                     action_down(pif)
                 elif action == "rewrite":

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.