diff options
| author | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-05-10 22:47:22 -0700 |
|---|---|---|
| committer | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-05-10 22:47:22 -0700 |
| commit | 0fea980fa4c5162f8ab0425ca44b95b2cd27b84f (patch) | |
| tree | 4d15ab2f236e52a2f1349b6b5f167531bee30f30 /src/com.gluster.storage.management.server.scripts | |
| parent | 375f14ba56b02603106a441a98b4d890ffa12585 (diff) | |
| parent | b721e9cf6487016eee8057dfe62890cbfff7ea64 (diff) | |
Merge pull request #31 from TimothyAsir/master
Removed netconfpkg package and used '/sys/class/net/' path to retrieve net device details.
Diffstat (limited to 'src/com.gluster.storage.management.server.scripts')
| -rw-r--r-- | src/com.gluster.storage.management.server.scripts/src/common/NetworkUtils.py | 23 |
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: |
