|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH 28 of 33] interface-reconfigure: do not sort the result
it is only required in one caller so perform the sort there.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 7fbd1addf5d8 -r 7eba221bc261 scripts/InterfaceReconfigure.py
--- a/scripts/InterfaceReconfigure.py Fri Dec 18 14:16:32 2009 +0000
+++ b/scripts/InterfaceReconfigure.py Fri Dec 18 14:16:32 2009 +0000
@@ -449,23 +449,7 @@
if not bondrec:
raise Error("No bond record for bond master PIF")
- # build a list of slave's pifs
- slave_pifs = bondrec['slaves']
-
- # Ensure any currently attached slaves are listed in the opposite order to
the order in
- # which they were attached. The first slave attached must be the last
detached since
- # the bond is using its MAC address.
- try:
- attached_slaves = open("/sys/class/net/%s/bonding/slaves" %
pifrec['device']).readline().split()
- for slave in attached_slaves:
- pifs = [p for p in db().get_pifs_by_device(slave) if not
pif_is_vlan(p)]
- slave_pif = pifs[0]
- slave_pifs.remove(slave_pif)
- slave_pifs.insert(0, slave_pif)
- except IOError:
- pass
-
- return slave_pifs
+ return bondrec['slaves']
#
# VLAN PIFs
diff -r 7fbd1addf5d8 -r 7eba221bc261 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
@@ -570,6 +570,27 @@
log("Invalid value for mtu = %s" % oc['mtu'])
return None
+def pif_get_bond_slaves_sorted(pif):
+ pifrec = db().get_pif_record(pif)
+
+ # build a list of slave's pifs
+ slave_pifs = pif_get_bond_slaves(pif)
+
+ # Ensure any currently attached slaves are listed in the opposite order to
the order in
+ # which they were attached. The first slave attached must be the last
detached since
+ # the bond is using its MAC address.
+ try:
+ attached_slaves = open("/sys/class/net/%s/bonding/slaves" %
pifrec['device']).readline().split()
+ for slave in attached_slaves:
+ pifs = [p for p in db().get_pifs_by_device(slave) if not
pif_is_vlan(p)]
+ slave_pif = pifs[0]
+ slave_pifs.remove(slave_pif)
+ slave_pifs.insert(0, slave_pif)
+ except IOError:
+ pass
+
+ return slave_pifs
+
def configure_bond_interface(pif):
"""Write the configuration for a bond interface.
@@ -755,7 +776,7 @@
# Need to bring down bond slaves first since the bond device
# must be up to enslave/unenslave.
- bond_slaves = pif_get_bond_slaves(pif)
+ bond_slaves = pif_get_bond_slaves_sorted(pif)
log("bond slaves of %s - %s" % (db().get_pif_record(pif)['device'],
[pif_netdev_name(s) for s in bond_slaves]))
for slave in bond_slaves:
slave_interface = pif_netdev_name(slave)
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-API] [PATCH 18 of 33] interface-reconfigure: use the same other-config:ethtool-* and MTU as vswitch version, (continued)
- [Xen-API] [PATCH 18 of 33] interface-reconfigure: use the same other-config:ethtool-* and MTU as vswitch version, Ian Campbell
- [Xen-API] [PATCH 20 of 33] interface-reconfigure: add pif_is_bond(), Ian Campbell
- [Xen-API] [PATCH 19 of 33] interface-reconfigure: further separate the concept of ipdev and datapath, Ian Campbell
- [Xen-API] [PATCH 21 of 33] interface-reconfigure: explicitly rename devices early, Ian Campbell
- [Xen-API] [PATCH 22 of 33] interface-reconfigure: move /etc/init.d/management-interface to this repository, Ian Campbell
- [Xen-API] [PATCH 23 of 33] interface-reconfigure: Do not try to bring down interfaces before forcing them up, Ian Campbell
- [Xen-API] [PATCH 24 of 33] interface-reconfigure: do not require a PIF for rewrite action, Ian Campbell
- [Xen-API] [PATCH 25 of 33] interface-reconfigure: Refactor the action_* methods, Ian Campbell
- [Xen-API] [PATCH 27 of 33] interface-reconfigure: Move bond and VLAN utilities to utility module, Ian Campbell
- [Xen-API] [PATCH 29 of 33] interface-reconfigure: Move ethtool and MTU setting utilities to module, Ian Campbell
- [Xen-API] [PATCH 28 of 33] interface-reconfigure: do not sort the result in pif_get_bond_slaves,
Ian Campbell <=
- [Xen-API] [PATCH 26 of 33] interface-reconfigure: Move DatabaseCache object to utility module, Ian Campbell
- [Xen-API] [PATCH 31 of 33] interface-reconfigure: Improve error handling of if{up, down} if ifcfg, Ian Campbell
- [Xen-API] [PATCH 32 of 33] interface-reconfigure: Add license headers to new InterfaceReconfigure*.py, Ian Campbell
- [Xen-API] [PATCH 33 of 33] interface-reconfigure: vswitch: explicitly configure IP device MAC address, Ian Campbell
- [Xen-API] [PATCH 30 of 33] interface-reconfigure: move datapath configuration to module, Ian Campbell
- [Xen-API] [PATCH 16 of 33] interface-reconfigure: hang all configuration off of the ipdev, Ian Campbell
|
|
|
|
|