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 20 of 33] interface-reconfigure: add pif_is_bond()

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 20 of 33] interface-reconfigure: add pif_is_bond()
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Dec 2009 14:17:15 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 18 Dec 2009 06:20:52 -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
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

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