[NEW PATCH] BZ#730946 - detect ISCSI HBAs as ISCSI (via gerrit-bot)
Saggi Mizrahi
smizrahi at redhat.com
Thu Aug 25 15:02:12 UTC 2011
New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/823
commit 468445758676916e9a76649ffcd980cf93760ccb
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date: Tue Aug 16 16:43:50 2011 +0300
BZ#730946 - detect ISCSI HBAs as ISCSI
Change-Id: I05ec04094aa05b076ca585e7f068231d4b371476
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 19ce19e..a9cda1b 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -540,14 +540,10 @@ def forceIScsiScan():
def devIsiSCSI(dev):
hostdir = os.path.realpath(os.path.join("/sys/block", dev, "device/../../.."))
host = os.path.basename(hostdir)
- iscsi_host = os.path.join(hostdir, constants.STRG_ISCSI_HOST + host)
- scsi_host = os.path.join(hostdir, constants.STRG_SCSI_HOST + host)
+ iscsi_host = os.path.join(hostdir, constants.STRG_ISCSI_HOST, host)
+ scsi_host = os.path.join(hostdir, constants.STRG_SCSI_HOST, host)
proc_name = os.path.join(scsi_host, "proc_name")
- if os.path.exists(iscsi_host) and os.path.exists(proc_name):
- with open(proc_name, "r") as f:
- return f.readline().startswith("iscsi_tcp")
-
- return False
+ return (os.path.exists(iscsi_host) and os.path.exists(proc_name))
def getiScsiTarget(dev):
device = os.path.realpath(os.path.join("/sys/block", dev, "device"))
@@ -595,12 +591,15 @@ def getdeviSCSIinfo(dev):
paddr = os.path.join(iscsi_connection, "persistent_address")
pport = os.path.join(iscsi_connection, "persistent_port")
- cmd = [constants.EXT_CAT, targetname, tpgt, user, passwd, paddr, pport,
- initiator]
- rc, out, err = misc.execCmd(cmd)
- if rc != 0 or len(out) != 7:
- raise se.MiscFileReadException()
- iqn, num, username, password, ip, port, initiator = out
+ res = []
+ for fname in (targetname, tpgt, user, passwd, paddr, pport, initiator):
+ try:
+ with open(fname, "r") as f:
+ res.append(f.read().strip())
+ except (OSError, IOError):
+ res.append("")
+
+ iqn, num, username, password, ip, port, initiator = res
# Fix username and password if needed (iscsi reports empty user/password
# as "<NULL>" (RHEL5) or "(null)" (RHEL6)
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index cca353f..269e0e3 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -267,7 +267,7 @@ def pathListIter(filterGuids=None):
pathInfo["type"] = DEV_ISCSI
sessionID = iscsi.getiScsiSession(slave)
if sessionID not in knownSessions:
- knownSessions[sessionID] = iscsi.getdeviSCSIinfo(slave)
+ knownSessions[sessionID] = svdsm.getdeviSCSIinfo(slave)
devInfo["connections"].append(knownSessions[sessionID])
else:
devInfo["devtypes"].append(DEV_FCP)
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 1667ccf..20972c0 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -31,6 +31,7 @@ from multiprocessing import Pipe, Process
from storage.multipath import getScsiSerial as _getScsiSerial
from storage.iscsi import forceIScsiScan as _forceIScsiScan
+from storage.iscsi import getdeviSCSIinfo as _getdeviSCSIinfo
from supervdsm import _SuperVdsmManager, PIDFILE, ADDRESS
from storage.fileUtils import chown, open_ex, resolveGid, resolveUid
from storage.fileUtils import validateAccess as _validateAccess
@@ -77,6 +78,10 @@ class _SuperVdsm(object):
return _removeMapping(devName)
@logDecorator
+ def getdeviSCSIinfo(self, *args, **kwargs):
+ return _getdeviSCSIinfo(*args, **kwargs)
+
+ @logDecorator
def getPathsStatus(self):
return _getPathsStatus()
More information about the vdsm-patches
mailing list