Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1092214

Summary: [virtio-win][scsi] windows guest only detect 1020 disks if assigned 1024 disks to random controllers, targets and LUNs via virtio-scsi
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: virtio-winAssignee: Vadim Rozenfeld <vrozenfe>
Status: CLOSED CANTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, bcao, chayang, hhuang, juzhang, michen, qzhang, rhod, virt-maint, vrozenfe, xfu, yvugenfi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-10 09:39:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screenshot_for_Disk_Management. none

Description Sibiao Luo 2014-04-29 02:39:20 UTC
Description of problem:
when i tried to random test with 1024 disks assigned to random controllers, targets and LUNs, windows guest only can detect 1020 disks.
BWT, if use the rhel7 guest has no such issue which can detect 1024 disks correctly. It can do hot-plug with 1024 number virtio-scsi disk on one virtio-scsi controller to windows guest successfully and they can be detected in windows guest correctly.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-121.el7.x86_64
qemu-kvm-rhev-1.5.3-60.el7ev.x86_64
guest info:
win2012R2 64bit
win7 64bit
virtio-win-1.7.0-1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1.boot up a windows KVM guest with 1024 disks assigned to random controllers, targets and LUNs.
qemu-kvm command script:
cli="/usr/libexec/qemu-kvm -M pc -m 4G -smp 4 -cpu SandyBridge -vnc :1 -monitor stdio -boot menu=on -monitor unix:/tmp/monitor,server,nowait -drive file=/home/windows_server_2012_r2_x64.raw,if=none,id=blk1 -device virtio-blk-pci,scsi=off,drive=blk1,id=blk-disk1,bootindex=1 -netdev tap,id=netdev1,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=netdev1,mac=02:03:04:05:06:00,id=net-pci1"
cli="$cli -device virtio-scsi-pci,id=scsi0"
cli="$cli -device virtio-scsi-pci,id=scsi1"
count=$((${1:-1}-1))
for i in $(seq 0 $count)
do
j=$((2*$i))
echo $j
 cli="$cli -drive file=/home/disk/disk$j.qcow2,if=none,id=disk$j"
 cli="$cli -device scsi-hd,bus=scsi0.0,drive=disk$j,id=target$j,scsi-id=$(($i%256)),lun=$(($i/256))"
 cli="$cli -drive file=/home/disk/disk$(($j+1)).qcow2,if=none,id=disk$(($j+1))"
 cli="$cli -device scsi-hd,bus=scsi1.0,drive=disk$(($j+1)),id=target$(($j+1)),scsi-id=$(($i%256)),lun=$(($i/256))"
done
$cli

2.'Rescan Disks' and check the disks numbers in 'Computer Management ----- storage ----- Disk Management'.

Actual results:
after step 2, windows guest only can detect 1020 disks in 'Disk Management', the HMP monitor has 1024 disks correctly.

Expected results:
It can detect 1024 disks in 'Disk Management'.

Additional info:

Comment 1 Sibiao Luo 2014-04-29 02:41:47 UTC
Created attachment 890634 [details]
Screenshot_for_Disk_Management.

Comment 2 Mike Cao 2014-05-07 10:04:02 UTC
I can reproduce this issue with lun=16383
-device scsi-hd,bus=scsi0.0,drive=drive-scsi-11,id=scsi-11,lun=16383,scsi-id=6

Comment 3 Vadim Rozenfeld 2014-05-07 10:37:15 UTC
(In reply to Mike Cao from comment #2)
> I can reproduce this issue with lun=16383
> -device
> scsi-hd,bus=scsi0.0,drive=drive-scsi-11,id=scsi-11,lun=16383,scsi-id=6

WDK defines the maximum number of luns per target as 255 (0..254). 16383 is 3FFF and will be clipped to FF, which is 255. You can try 255, 511, 767, 1023, etc. They also should fail.

Comment 4 Mike Cao 2014-05-09 10:58:16 UTC
(In reply to Vadim Rozenfeld from comment #3)
> (In reply to Mike Cao from comment #2)
> > I can reproduce this issue with lun=16383
> > -device
> > scsi-hd,bus=scsi0.0,drive=drive-scsi-11,id=scsi-11,lun=16383,scsi-id=6
> 
> WDK defines the maximum number of luns per target as 255 (0..254). 16383 is
> 3FFF and will be clipped to FF, which is 255. You can try 255, 511, 767,
> 1023, etc. They also should fail.

So you mean lun=256 should be same as lun=0 ,right ?
So Is it normal only 1 disk can be detects if I use following commandline ?

-drive file=test8.qcow2,if=none,id=drive-test8,cache=writethrough,format=qcow2,werror=stop,rerror=stop -device scsi-hd,id=test8,drive=drive-test8,lun=256,scsi-id=1 -drive file=test9.qcow2,if=none,id=drive-test9,cache=writeback,format=qcow2,werror=stop,rerror=stop -device scsi-hd,id=test9,drive=drive-test9,lun=0,scsi-id=1

Comment 5 Vadim Rozenfeld 2014-05-11 07:25:56 UTC
(In reply to Mike Cao from comment #4)
> (In reply to Vadim Rozenfeld from comment #3)
> > (In reply to Mike Cao from comment #2)
> > > I can reproduce this issue with lun=16383
> > > -device
> > > scsi-hd,bus=scsi0.0,drive=drive-scsi-11,id=scsi-11,lun=16383,scsi-id=6
> > 
> > WDK defines the maximum number of luns per target as 255 (0..254). 16383 is
> > 3FFF and will be clipped to FF, which is 255. You can try 255, 511, 767,
> > 1023, etc. They also should fail.
> 
> So you mean lun=256 should be same as lun=0 ,right ?
> So Is it normal only 1 disk can be detects if I use following commandline ?
> 
> -drive
> file=test8.qcow2,if=none,id=drive-test8,cache=writethrough,format=qcow2,
> werror=stop,rerror=stop -device
> scsi-hd,id=test8,drive=drive-test8,lun=256,scsi-id=1 -drive
> file=test9.qcow2,if=none,id=drive-test9,cache=writeback,format=qcow2,
> werror=stop,rerror=stop -device
> scsi-hd,id=test9,drive=drive-test9,lun=0,scsi-id=1

Right after returning from HWInitialization, Windows sends REPORT_LUNS to all targets. Since the maximum number of luns is 255 (unless this value is limited with max_lun parameter), Windows just cannot recognize 
any lut behind 254.

Comment 6 Ronen Hod 2014-08-10 09:39:37 UTC
Seems as if Windows (including 2012R2) only supports 255 (not 256) LUN per host bus adapters.