[node-patches] Change in ovirt-node[master]: Fix using "has_link()" to check nic physical connected faile...
hadong0720 at gmail.com
hadong0720 at gmail.com
Mon Nov 11 11:59:06 UTC 2013
hadong has uploaded a new change for review.
Change subject: Fix using "has_link()" to check nic physical connected failed issue
......................................................................
Fix using "has_link()" to check nic physical connected failed issue
Previously using the "has_link" of class "NIC" to detect the physical
connected state of a network cable/connector will fail.This is due to
it miss to execute "ip link set dev {dev} up" before check "1" in
/sys/class/net/{dev}/carrier.
Change-Id: I608af3dd35d979b2213a762d84b831e792417efc
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/utils/network.py
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/30/21130/1
diff --git a/src/ovirt/node/utils/network.py b/src/ovirt/node/utils/network.py
index 2398d57..81a7f23 100644
--- a/src/ovirt/node/utils/network.py
+++ b/src/ovirt/node/utils/network.py
@@ -252,6 +252,15 @@
# Fallback
has_carrier = False
+ cmd = ["ip", "link", "set", "dev", self.ifname, "up"]
+ try:
+ process.check_call(cmd)
+ except process.CalledProcessError:
+ LOGGER.debug("try to set dev %s link up for twice" % self.ifname)
+ process.check_call(cmd)
+ except:
+ LOGGER.debug("Failed to set dev %s link up" % self.ifname)
+
try:
content = File("/sys/class/net/%s/carrier" % self.ifname).read()
has_carrier = "1" in content
--
To view, visit http://gerrit.ovirt.org/21130
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I608af3dd35d979b2213a762d84b831e792417efc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>
More information about the node-patches
mailing list