aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-07-19 17:36:54 +0000
committerGerrit Code Review <review@openstack.org>2016-07-19 17:36:54 +0000
commita08e230b00c32a475d0f2f9826dabaa822153ad6 (patch)
treef3f42a5fd83e8dda52122ca499adc594e65ae8c2
parent6bb8412ef3d3f163d91f2884081b743f07a78f18 (diff)
parent6036a166710b22831b0ec9756b9732024b0a0e24 (diff)
Merge "Make os-net-config idempotent with Linux bonds and MAC mapping"
-rw-r--r--os_net_config/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index 7ff19fb..83aae63 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -42,6 +42,13 @@ def get_file_data(filename):
def interface_mac(name):
+ try: # If the iface is part of a Linux bond, the real MAC is only here.
+ with open('/sys/class/net/%s/bonding_slave/perm_hwaddr' % name,
+ 'r') as f:
+ return f.read().rstrip()
+ except IOError:
+ pass # Iface is not part of a bond, continue
+
try:
with open('/sys/class/net/%s/address' % name, 'r') as f:
return f.read().rstrip()