[NEW PATCH] BZ#732272 Activate nics in the correct order (via gerrit-bot)
Federico Simoncelli
fsimonce at redhat.com
Tue Aug 23 10:37:57 UTC 2011
New patch submitted by Federico Simoncelli (fsimonce at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/835
commit 14fc26b00c057f7f73d65de991d1180fc83625fc
Author: Federico Simoncelli <fsimonce at redhat.com>
Date: Mon Aug 22 10:24:47 2011 +0000
BZ#732272 Activate nics in the correct order
Change-Id: If7048d01780d8e7dbb03a87b478b578ae34cb582
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index ac300a7..81792a6 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -126,6 +126,19 @@ def bondingOtherUsers(bridge, vlan, bonding):
users.discard(owner)
return users
+def nicSort(nics):
+ "Return a list of nics/interfaces ordered by name"
+ nics_list = []
+ nics_rexp = re.compile("([A-Za-z]+)([0-9]+)")
+
+ for nic_name in nics:
+ nic_sre = nics_rexp.match(nic_name)
+ if nic_sre:
+ nics_list.append((nic_sre.group(1), int(nic_sre.group(2))))
+ else:
+ nics_list.append((nic_name, ''))
+
+ return [x + str(y) for x, y in sorted(nics_list)]
class ConfigWriter(object):
NET_CONF_PREF = NET_CONF_DIR + 'ifcfg-'
@@ -447,7 +460,9 @@ def addNetwork(bridge, vlan=None, bonding=None, nics=None, ipaddr=None, netmask=
if nic not in vlanedIfaces:
ifdown(nic)
ifdown(bridge)
- for nic in nics:
+ # nics must be activated in the same order of boot time to expose the correct
+ # MAC address.
+ for nic in nicSort(nics):
ifup(nic)
if bonding:
ifup(bonding)
More information about the vdsm-patches
mailing list