Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Add link information to the netinfo nic dictionary.
......................................................................

Add link information to the netinfo nic dictionary.

This patch aims to provide more link status information
in order to make better decisions when deleting networks.

Change-Id: I25b87559bc04ab6f4c3ff59b6e3f238ae1be6956
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M vdsm/netinfo.py
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/8442/1

diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index c3c5a6f..ffcce26 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -168,6 +168,11 @@
     return bitmask_to_address(netmask)
 
 
+def getlinkstatus(dev):
+    return ['down',
+            'up'][ethtool.get_flags(dev.encode('utf8')) & ethtool.IFF_UP]
+
+
 def gethwaddr(dev):
     return file('/sys/class/net/%s/address' % dev).read().strip()
 
@@ -329,6 +334,7 @@
                               'hwaddr': gethwaddr(nic),
                               'mtu': getMtu(nic),
                               'cfg': getIfaceCfg(nic),
+                              'link': getlinkstatus(nic),
                               })
                         for nic in nics()])
     paddr = permAddr()


--
To view, visit http://gerrit.ovirt.org/8442
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b87559bc04ab6f4c3ff59b6e3f238ae1be6956
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to