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

[Xen-API] [PATCH 20 of 33] interface-reconfigure: add pif_is_bond()



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

diff -r 5883cee5ce9f -r 4992b8f5eff0 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
@@ -764,9 +764,7 @@
 def create_bond_device(pif):
     """Ensures that a bond master device exists in the kernel."""
 
-    pifrec = db.get_pif_record(pif)
-
-    if len(pifrec['bond_master_of']) == 0:
+    if not pif_is_bond(pif):
         return
 
     __create_bond_device(pif_netdev_name(pif))
@@ -792,7 +790,7 @@
 
     pifrec = db.get_pif_record(pif)
 
-    if len(pifrec['bond_master_of']) == 0:
+    if not pif_is_bond(pif):
         return
 
     # If the bonding module isn't loaded then do nothing.
@@ -881,6 +879,11 @@
 #
 # Bonded PIFs
 #
+def pif_is_bond(pif):
+    pifrec = db.get_pif_record(pif)
+
+    return len(pifrec['bond_master_of']) > 0
+
 def pif_get_bond_masters(pif):
     """Returns a list of PIFs which are bond masters of this PIF"""
 
@@ -1064,11 +1067,9 @@
     Returns the open file handle for the interface configuration file.
     """
 
-    pifrec = db.get_pif_record(pif)
-
     if pif_is_vlan(pif):
         f = configure_vlan_interface(pif)
-    elif len(pifrec['bond_master_of']) != 0:
+    elif pif_is_bond(pif):
         f = configure_bond_interface(pif)
     else:
         f = configure_physical_interface(pif)

_______________________________________________
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®.