Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 667621

Summary: 2.2.6 - Can not attach hardware iSCSI based datastore to rhevm
Product: Red Hat Enterprise Linux 5 Reporter: Pengzhen Cao <pcao>
Component: vdsm22Assignee: Dan Kenigsberg <danken>
Status: CLOSED NEXTRELEASE QA Contact: yeylon <yeylon>
Severity: high Docs Contact:
Priority: urgent    
Version: 5.6CC: abaron, bazulay, cpelland, cshao, danken, iheim, qwan, srevivo, ycui
Target Milestone: rcKeywords: Reopened, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-28 19:26:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 670809    
Attachments:
Description Flags
vdsm.log
none
getDeviceList.log
none
multipath-list.log
none
ovirt.log none

Description Pengzhen Cao 2011-01-06 09:28:07 UTC
Description of problem:
Can not attach a datastore to rhevm datacenter if it is based on hardware iSCSI HBA card instead for rhevh host software initiator

Version-Release number of selected component (if applicable):
rhev-hypervisor-5.6-8.1.el5
rhevm sm-92 build

How reproducible:
100%

Steps to Reproduce:
1. install a rhevh host with 5.6-8.1.el5 build, the host must has a hardware iSCSI HBA card and has some LUN allocated to it. After rhevh host installed and configured, verify you can see the LUNs with multipath -ll or fdisk -l or whatever else.
2. in rhevm, create a datacenter with iSCSI type, then create a cluster, add the rhevh host into taht cluster
3. after host is up, in storage tab, choose new domain with type iSCSI, and I can not see there is any LUNs in the list. Thus, I can not use the Hardware based iSCSI datastore.
4. I also tried with FCP datacenter type but with no lucky
  
Actual results:
We can not see or use hardware based iSCSI datastore

Expected results:
We should be able to use hardware based iSCSI datastore

Additional info:

After some initial analysis, I found that the issue might be with vdsm backend in rhevh, so I choose the vdsm component for this bug.

Please check the result of "vdsClient -s0 getDeviceList" and note the "devtype" key, it is empty in a host with hardware iSCSI HBA card, but not "iSCSI" as that on a host with software initiator.

---------snap of vdsClient -s0 getDeviceList----------
vendorID = NETAPP 
capacity = 10714349568 
fwrev = 0000 
vgUUID =  
pathlist = [] 
pathstatus = [{'physdev': 'sdf', 'state': 'active', 'lun': '7'}] 
devtype = [] 
pvUUID =  
serial =  
GUID = 360a9800050334c33424a573531347344 
productID = LUN 
--------------------

Comment 1 Pengzhen Cao 2011-01-06 09:29:26 UTC
Created attachment 472014 [details]
vdsm.log

Comment 2 Pengzhen Cao 2011-01-06 09:30:07 UTC
Created attachment 472015 [details]
getDeviceList.log

Comment 3 Pengzhen Cao 2011-01-06 09:32:31 UTC
Created attachment 472018 [details]
multipath-list.log

Comment 4 Pengzhen Cao 2011-01-06 09:32:59 UTC
Created attachment 472019 [details]
ovirt.log

Comment 5 Ayal Baron 2011-01-07 22:10:59 UTC
Dan, this looks like a duplicate of Ortal's bug.
Seems there is a permissions problem with running cat as sudo:

Thread-34::DEBUG::2011-01-06 08:16:50,979::misc::96::irs::'/usr/bin/sudo -n /bin/cat /sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name' (cwd None)
Thread-34::WARNING::2011-01-06 08:16:51,014::misc::121::irs::FAILED: <err> = 'sudo: sorry, a password is required to run sudo\n'; <rc> = 1
Thread-34::ERROR::2011-01-06 08:16:51,015::misc::62::irs::Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)
Thread-34::ERROR::2011-01-06 08:16:51,016::misc::63::irs::Traceback (most recent call last):
  File "/usr/share/vdsm/storage/multipath.py", line 199, in pathinfo
  File "/usr/share/vdsm/storage/iscsi.py", line 511, in devIsiSCSI
  File "/usr/share/vdsm/storage/misc.py", line 218, in readfileSUDO
MiscFileReadException: Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)

Thread-34::WARNING::2011-01-06 08:16:51,016::multipath::222::irs::(pathinfo) bad path line ' \_ 2:0:0:5  sdd 8:48  [active][ready]' is ignored
Thread-34::DEBUG::2011-01-06 08:16:51,016::misc::96::irs::'/usr/bin/sudo -n /sbin/multipath -ll 360a9800050334c33424a573531436868' (cwd None)
Thread-34::DEBUG::2011-01-06 08:16:51,122::misc::119::irs::SUCCESS: <err> = ''; <rc> = 0
Thread-34::DEBUG::2011-01-06 08:16:51,123::misc::96::irs::'/usr/bin/sudo -n /bin/cat /sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name' (cwd None)
Thread-34::WARNING::2011-01-06 08:16:51,158::misc::121::irs::FAILED: <err> = 'sudo: sorry, a password is required to run sudo\n'; <rc> = 1
Thread-34::ERROR::2011-01-06 08:16:51,159::misc::62::irs::Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)
Thread-34::ERROR::2011-01-06 08:16:51,160::misc::63::irs::Traceback (most recent call last):
  File "/usr/share/vdsm/storage/multipath.py", line 199, in pathinfo
  File "/usr/share/vdsm/storage/iscsi.py", line 511, in devIsiSCSI
  File "/usr/share/vdsm/storage/misc.py", line 218, in readfileSUDO
MiscFileReadException: Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)

Thread-34::WARNING::2011-01-06 08:16:51,160::multipath::222::irs::(pathinfo) bad path line ' \_ 2:0:0:10 sdi 8:128 [active][ready]' is ignored
Thread-34::DEBUG::2011-01-06 08:16:51,161::misc::96::irs::'/usr/bin/sudo -n /sbin/multipath -ll 360a9800050334c33424a573531494658' (cwd None)
Thread-34::DEBUG::2011-01-06 08:16:51,248::misc::119::irs::SUCCESS: <err> = ''; <rc> = 0
Thread-34::DEBUG::2011-01-06 08:16:51,249::misc::96::irs::'/usr/bin/sudo -n /bin/cat /sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name' (cwd None)
Thread-34::WARNING::2011-01-06 08:16:51,285::misc::121::irs::FAILED: <err> = 'sudo: sorry, a password is required to run sudo\n'; <rc> = 1
Thread-34::ERROR::2011-01-06 08:16:51,286::misc::62::irs::Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)
Thread-34::ERROR::2011-01-06 08:16:51,287::misc::63::irs::Traceback (most recent call last):
  File "/usr/share/vdsm/storage/multipath.py", line 199, in pathinfo
  File "/usr/share/vdsm/storage/iscsi.py", line 511, in devIsiSCSI
  File "/usr/share/vdsm/storage/misc.py", line 218, in readfileSUDO
MiscFileReadException: Internal file read failure: ('/sys/devices/pci0000:00/0000:00:06.0/0000:0c:00.0/0000:0d:01.1/host2/scsi_host:host2/proc_name',)

Comment 6 Dan Kenigsberg 2011-01-08 22:22:43 UTC
Yes, this indeed may have caused https://bugzilla.redhat.com/show_bug.cgi?id=565416#c9 ("Ortal's bug").

Pengzhen, does the following patch help you?

diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 60f3934..b6b6f1a 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -544,9 +544,8 @@ def checkSession(host, port, iqn, tpgt, user=None, password=None):
 def devIsiSCSI(dev):
 
     isiSCSI = False
-    hostdir = os.path.realpath(os.path.join("/sys/block", dev,
-        "device/../../.."))
-    host = os.path.basename(hostdir)
+    hostdir = os.path.join("/sys/block", dev, "device/../../..")
+    host = os.path.basename(os.path.realpath(hostdir))
     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")

Comment 7 Pengzhen Cao 2011-01-10 05:17:52 UTC
Hi Dan,

I can see the LUN with your patch, and can add the lun in rhevm with type FC.

-----------------
vendorID = NETAPP 
capacity = 10714349568 
fwrev = 0000 
vgUUID =  
pathlist = [] 
pathstatus = [{'physdev': 'sdk', 'state': 'active', 'lun': '11'}] 
devtype = FCP 
pvUUID =  
serial = SNETAPP_LUN_P3L3BJW51FgP 
GUID = 360a9800050334c33424a573531466750 
productID = LUN 
-----------------

So both hw.iSCSI/FC LUNs are recognized to type FCP , right?


(In reply to comment #6)
> Yes, this indeed may have caused
> https://bugzilla.redhat.com/show_bug.cgi?id=565416#c9 ("Ortal's bug").
> 
> Pengzhen, does the following patch help you?
> 
> diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
> index 60f3934..b6b6f1a 100644
> --- a/vdsm/storage/iscsi.py
> +++ b/vdsm/storage/iscsi.py
> @@ -544,9 +544,8 @@ def checkSession(host, port, iqn, tpgt, user=None,
> password=None):
>  def devIsiSCSI(dev):
> 
>      isiSCSI = False
> -    hostdir = os.path.realpath(os.path.join("/sys/block", dev,
> -        "device/../../.."))
> -    host = os.path.basename(hostdir)
> +    hostdir = os.path.join("/sys/block", dev, "device/../../..")
> +    host = os.path.basename(os.path.realpath(hostdir))
>      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")

Comment 8 Dan Kenigsberg 2011-01-10 20:17:50 UTC
(In reply to comment #7)

> 
> So both hw.iSCSI/FC LUNs are recognized to type FCP , right?
> 

Actually, this sounds a bit odd to me. Is it expected, Ayal? Is it possible that this LUN is accessible by iSCSI, too?

Comment 9 Ayal Baron 2011-01-13 23:41:36 UTC
(In reply to comment #8)
> (In reply to comment #7)
> 
> > 
> > So both hw.iSCSI/FC LUNs are recognized to type FCP , right?
> > 
> 
> Actually, this sounds a bit odd to me. Is it expected, Ayal? Is it possible
> that this LUN is accessible by iSCSI, too?

This is the expected behavior.
It is not that the LUN is accessible via iSCSI too, it is accessible ONLY via iscsi in this case.  Issue is that the iSCSI connection is done entirely on HBA (hardware) so we recognize it as non SW iSCSI device.  All such devices currently fall under the misnomer "FCP"

Comment 10 Ayal Baron 2011-01-14 00:18:18 UTC
(In reply to comment #7)
> Hi Dan,
> 
> I can see the LUN with your patch, and can add the lun in rhevm with type FC.
> 
> -----------------
> vendorID = NETAPP 
> capacity = 10714349568 
> fwrev = 0000 
> vgUUID =  
> pathlist = [] 
> pathstatus = [{'physdev': 'sdk', 'state': 'active', 'lun': '11'}] 
> devtype = FCP 
> pvUUID =  
> serial = SNETAPP_LUN_P3L3BJW51FgP 
> GUID = 360a9800050334c33424a573531466750 
> productID = LUN 
> -----------------
> 
> So both hw.iSCSI/FC LUNs are recognized to type FCP , right?
Correct

Comment 12 Dan Kenigsberg 2011-01-19 10:18:11 UTC
patches committed to RHEL-5 branch, moving to MODIFIED.

Comment 14 Dan Kenigsberg 2011-01-28 19:26:19 UTC
Closing all rhel-5.7 clones of rhev-2.2.6 bugs as they have served their purpose.