summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim <timothyasir@gluster.com>2011-05-11 00:12:56 +0530
committerTim <timothyasir@gluster.com>2011-05-11 00:12:56 +0530
commitb721e9cf6487016eee8057dfe62890cbfff7ea64 (patch)
tree4d15ab2f236e52a2f1349b6b5f167531bee30f30 /src
parent0d25b76b7cb998d4d7e5a5f8b7dc564afbb9a540 (diff)
Updated NetworkUtils.py to fetch network device name using /sys/class/net/ path
Diffstat (limited to 'src')
-rw-r--r--src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py b/src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py
index 1ce1b132..f8a5de30 100644
--- a/src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py
+++ b/src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py
@@ -25,7 +25,7 @@ import tempfile
import Globals
from Utils import *
-from netconfpkg.NCHardwareList import getHardwareList
+#from netconfpkg.NCHardwareList import getHardwareList
def readHostFile(fileName=None):
hostEntryList = []
@@ -244,7 +244,9 @@ def setBondMode(deviceName, mode, fileName=None):
def getNetDeviceList(root=""):
netDeviceList = []
- for device in getHardwareList():
+
+ for deviceName in os.listdir("/sys/class/net/"):
+ #for device in getHardwareList():
netDevice = {}
netDevice["device"] = None
netDevice["description"] = None
@@ -266,18 +268,21 @@ def getNetDeviceList(root=""):
netDevice["link"] = None
netDevice["mode"] = None
- netDevice["device"] = device.Name
- netDevice["description"] = device.Description
- netDevice["type"] = device.Type
- netDevice["link"] = getLinkStatus(device.Name)
- netDevice["mode"] = getBondMode(device.Name, root + Globals.MODPROBE_CONF_FILE)
+ #netDevice["device"] = device.Name
+ netDevice["device"] = deviceName
+ #netDevice["description"] = device.Description
+ netDevice["description"] = deviceName
+ #netDevice["type"] = device.Type
+ netDevice["type"] = None
+ netDevice["link"] = getLinkStatus(deviceName)
+ netDevice["mode"] = getBondMode(deviceName, root + Globals.MODPROBE_CONF_FILE)
try:
- netDevice["hwaddr"] = open("/sys/class/net/%s/address" % device.Name).read().strip()
+ netDevice["hwaddr"] = open("/sys/class/net/%s/address" % deviceName).read().strip()
except IOError:
pass
netDeviceList.append(netDevice)
- conf = readIfcfgConfFile(device.Name, root)
+ conf = readIfcfgConfFile(deviceName, root)
if not conf:
continue
try: