aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-04-11 16:51:38 +0000
committerGerrit Code Review <review@openstack.org>2016-04-11 16:51:38 +0000
commit2ab73df9e050c6d7fc512e3ab053310e2f3d359f (patch)
tree5dff3299af77b07af770a9d63087041919d34579
parent02d87760ee03699838911837945c3886dae47b83 (diff)
parent8792d74c9115d48f1756c2a77f5ff4ed4a001cdf (diff)
Merge "Use interface operstate to determine nic status"
-rw-r--r--os_net_config/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index 4109081..da7ab11 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -58,15 +58,15 @@ def _is_active_nic(interface_name):
device_dir = _SYS_CLASS_NET + '/%s/device' % interface_name
has_device_dir = os.path.isdir(device_dir)
- carrier = None
- with open(_SYS_CLASS_NET + '/%s/carrier' % interface_name, 'r') as f:
- carrier = int(f.read().rstrip())
+ operstate = None
+ with open(_SYS_CLASS_NET + '/%s/operstate' % interface_name, 'r') as f:
+ operstate = f.read().rstrip()
address = None
with open(_SYS_CLASS_NET + '/%s/address' % interface_name, 'r') as f:
address = f.read().rstrip()
- if has_device_dir and carrier == 1 and address:
+ if has_device_dir and operstate == 'UP' and address:
return True
else:
return False