WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 23 of 33] interface-reconfigure: Do not try to bring do

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 23 of 33] interface-reconfigure: Do not try to bring down interfaces before forcing them up
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Dec 2009 14:17:18 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 18 Dec 2009 06:21:41 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1261145815@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>