Bug 2022656

Summary: [virtio-win][vioscsi] Windows will fail to format a partition to NTFS with vioscsi+scsi-block
Product: Red Hat Enterprise Linux 9 Reporter: Peixiu Hou <phou>
Component: virtio-winAssignee: Vadim Rozenfeld <vrozenfe>
virtio-win sub component: virtio-win-prewhql QA Contact: Peixiu Hou <phou>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: abchujb, coli, mdean, qinwang, qizhu
Version: 9.0   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:35:27 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:

Description Peixiu Hou 2021-11-12 10:04:35 UTC
Description of problem:
Issue is come from an upstream issue:https://github.com/virtio-win/kvm-guest-drivers-windows/issues/657

W can reproduce it with a SATA ssd disk, with scsi-block, the vm cannot be installed successful. When do disk partition format, hit error message "Windows could not format a partition on disk 0. The error occurred while prparing the partition selected for installation, Error code: 0x80070057"

And cannot reproduce it with a LIO-ORG disk with scsi-block.
also cannot reproduce it with SATA SSD disk + scsi-hd.

Version-Release number of selected component (if applicable):
kernel-4.18.0-305.el8.x86_64
qemu-kvm-4.2.0-48.module+el8.4.0+11909+3300d70f.3.x86_64
virtio-win-prewhql-208
edk2-ovmf-20200602gitca407c7246bf-4.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1. Make sure your host has a SATA SSD disk can be used to passthrough
# lsscsi
[0:0:11:0]   disk    ATA      INTEL SSDSC2CT06 300i  /dev/sda 
[0:2:0:0]    disk    IBM      ServeRAID M5210  4.22  /dev/sdb

# fdisk -l /dev/sda
Disk /dev/sda: 55.9 GiB, 60022480896 bytes, 117231408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3B055CFC-28FE-4513-8446-5FF1504E0C32

2. Boot a vm up:
/usr/libexec/qemu-kvm \
	-name guest=vgpu1,debug-threads=on \
	-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
	-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
	-blockdev '{"driver":"file","filename":"OVMF_VARS_640.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
	-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"raw","file":"libvirt-pflash1-storage"}' \
	-machine pc-q35-rhel8.2.0,accel=kvm,usb=off,vmport=off,smm=on,dump-guest-core=off,kernel_irqchip=on,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format \
	-cpu host,hypervisor=off,vmx=off,hv-time,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-vpindex,hv-runtime,hv-synic,hv-stimer,hv-vendor-id=1234567890ab,hv-frequencies,hv-ipi,kvm=off,host-cache-info=on,l3-cache=off \
	-global driver=cfi.pflash01,property=secure,value=on \
	-m 4096 \
	-overcommit mem-lock=off \
	-smp 3,sockets=1,dies=1,cores=3,threads=1 \
	-uuid a6911b76-56e4-4871-b90b-c366941032f2 \
	-no-user-config -nodefaults \
	-rtc base=utc,clock=vm,driftfix=slew \
	-global kvm-pit.lost_tick_policy=delay \
	-no-hpet -no-shutdown \
	-global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 \
	-boot strict=on \
	-device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \
	-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
	-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \
	-device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \
	-device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \
	-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 \
	-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 \
	-device virtio-scsi-pci,id=scsi0,bus=pci.4,addr=0x0 \
	-device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 \
	-blockdev '{"driver":"host_device","filename":"/dev/sda","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
	-blockdev '{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","detect-zeroes":"unmap","cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \
	-blockdev '{"driver":"file","filename":"/home/kvm_autotest_root/iso/windows/virtio-win-prewhql-0.1-208.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
	-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=libvirt-2-format,id=scsi0-0-0-0,bootindex=1 \
	-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \
	-device ide-cd,bus=ide.0,drive=libvirt-1-format,id=sata0-0-2 \
	-chardev pty,id=charserial0 \
	-device isa-serial,chardev=charserial0,id=serial0 \
	-chardev spicevmc,id=charchannel0,name=vdagent \
	-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
	-device usb-tablet,id=input0,bus=usb.0,port=1 \
	-device VGA,bus=pcie.0 \
	-vnc :0  \
	-msg timestamp=on \
	-cdrom /home/kvm_autotest_root/iso/ISO/Win10/en_windows_10_business_editions_version_21h1_x64_dvd_ec5a76c1.iso \
        -monitor stdio

3. Upload the virtio-win vioscsi driver during installtion
4. Try to create new partition and start install  --> error occurred

Actual results:
Installed failed.

Expected results:
Install success

Additional info:
1. Tried test with  LIO-ORG disk + scsi-block + build 208, cannot reproduce this issue.
2. Tried test with SATA SSD disk + scsi-block + build 208, reproduce this issue.
3. Tried test with SATA SSD disk + scsi-block + build 204, also reproduce this issue, this's different the upstream user's result, he cannot reproduce the issue with build 204.
4. Tried test with SATA SSD disk + scsi-block + build 199, also reproduce this issue.
5. Tried test with SATA SSD disk + scsi-block + virtio-win-1.9.19-1.el8.iso, also reproduce this issue.
6. Tried test with SATA SSD disk + scsi-hd + build 208, cannot reproduce this issue, the os can be installed success.

SATA SSD disk max_segments value:
# lsscsi
[0:0:11:0]   disk    ATA      INTEL SSDSC2CT06 300i  /dev/sda 
[0:2:0:0]    disk    IBM      ServeRAID M5210  4.22  /dev/sdb
# cat /sys/block/sda/queue/max_segments
64

LIO-ORG disk max_segments value:
# lsscsi
[0:2:0:0]    disk    DELL     PERC H730 Mini   4.27  /dev/sda 
[1:0:0:0]    disk    Kingston DT 101 G2        PMAP  /dev/sdb 
[12:0:0:0]   disk    LIO-ORG  disk0            4.0   /dev/sdc 
# cat /sys/block/sdc/queue/max_segments
2048

Comment 1 Peixiu Hou 2021-11-16 09:40:05 UTC
Tried test on RHEL9 host, also reproduced this issue.

kernel-5.14.0-15.el9.x86_64
qemu-kvm-6.1.0-6.el9.x86_64
virtio-win-prewhql-214
seabios-bin-1.14.0-7.el9.noarch

Comment 2 Vadim Rozenfeld 2021-12-02 07:51:10 UTC
merged upstream
https://github.com/virtio-win/kvm-guest-drivers-windows/pull/685

Comment 4 Peixiu Hou 2021-12-06 13:53:32 UTC
Hi Vadim,

I tested this case on a RHEL8.4 host with virtio-win-prewhql-215, also reproduced this issue, steps as comment#0.
- with scsi-block + /dev/sdb, install win10 os failed.
- with scsi-hd + /dev/sdb, win10 os can be installed success.

# lsscsi
[0:2:0:0]    disk    DELL     PERC H710        3.13  /dev/sda 
[0:2:1:0]    disk    DELL     PERC H710        3.13  /dev/sdb 
[0:2:2:0]    disk    DELL     PERC H710        3.13  /dev/sdc 
[5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD51  /dev/sr0

# cat /sys/block/sdb/queue/max_segments
64

Version:
kernel-4.18.0-305.28.1.el8_4.x86_64
qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
virtio-win-prewhql-215

Thanks~
Peixiu

Comment 5 Vadim Rozenfeld 2021-12-07 00:46:50 UTC
(In reply to Peixiu Hou from comment #4)
> Hi Vadim,
> 
> I tested this case on a RHEL8.4 host with virtio-win-prewhql-215, also
> reproduced this issue, steps as comment#0.
> - with scsi-block + /dev/sdb, install win10 os failed.
> - with scsi-hd + /dev/sdb, win10 os can be installed success.
> 
> # lsscsi
> [0:2:0:0]    disk    DELL     PERC H710        3.13  /dev/sda 
> [0:2:1:0]    disk    DELL     PERC H710        3.13  /dev/sdb 
> [0:2:2:0]    disk    DELL     PERC H710        3.13  /dev/sdc 
> [5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD51  /dev/sr0
> 
> # cat /sys/block/sdb/queue/max_segments
> 64
> 
> Version:
> kernel-4.18.0-305.28.1.el8_4.x86_64
> qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> virtio-win-prewhql-215
> 
> Thanks~
> Peixiu

Hi Peixiu,

you need to specify max_sectors qemu parameter for the direct lun
attached device. Something like this:
"-device virtio-scsi-pci,id=scsi-vioscsi1,max_sectors=64"

Comment 6 Peixiu Hou 2021-12-07 10:13:47 UTC
(In reply to Vadim Rozenfeld from comment #5)
> (In reply to Peixiu Hou from comment #4)
> > Hi Vadim,
> > 
> > I tested this case on a RHEL8.4 host with virtio-win-prewhql-215, also
> > reproduced this issue, steps as comment#0.
> > - with scsi-block + /dev/sdb, install win10 os failed.
> > - with scsi-hd + /dev/sdb, win10 os can be installed success.
> > 
> > # lsscsi
> > [0:2:0:0]    disk    DELL     PERC H710        3.13  /dev/sda 
> > [0:2:1:0]    disk    DELL     PERC H710        3.13  /dev/sdb 
> > [0:2:2:0]    disk    DELL     PERC H710        3.13  /dev/sdc 
> > [5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD51  /dev/sr0
> > 
> > # cat /sys/block/sdb/queue/max_segments
> > 64
> > 
> > Version:
> > kernel-4.18.0-305.28.1.el8_4.x86_64
> > qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> > edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> > virtio-win-prewhql-215
> > 
> > Thanks~
> > Peixiu
> 
> Hi Peixiu,
> 
> you need to specify max_sectors qemu parameter for the direct lun
> attached device. Something like this:
> "-device virtio-scsi-pci,id=scsi-vioscsi1,max_sectors=64"

Test again with max_sectors=64, installation can be succeed, thanks a lot vadim, changing this bug to verified.

Used versions:
kernel-4.18.0-305.28.1.el8_4.x86_64
qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
virtio-win-preqwhql-215
edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch

Best regards~
Peixiu

Comment 8 abchujb 2022-01-20 03:21:07 UTC
(In reply to Peixiu Hou from comment #6)
> (In reply to Vadim Rozenfeld from comment #5)
> > (In reply to Peixiu Hou from comment #4)
> > > Hi Vadim,
> > > 
> > > I tested this case on a RHEL8.4 host with virtio-win-prewhql-215, also
> > > reproduced this issue, steps as comment#0.
> > > - with scsi-block + /dev/sdb, install win10 os failed.
> > > - with scsi-hd + /dev/sdb, win10 os can be installed success.
> > > 
> > > # lsscsi
> > > [0:2:0:0]    disk    DELL     PERC H710        3.13  /dev/sda 
> > > [0:2:1:0]    disk    DELL     PERC H710        3.13  /dev/sdb 
> > > [0:2:2:0]    disk    DELL     PERC H710        3.13  /dev/sdc 
> > > [5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD51  /dev/sr0
> > > 
> > > # cat /sys/block/sdb/queue/max_segments
> > > 64
> > > 
> > > Version:
> > > kernel-4.18.0-305.28.1.el8_4.x86_64
> > > qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> > > edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> > > virtio-win-prewhql-215
> > > 
> > > Thanks~
> > > Peixiu
> > 
> > Hi Peixiu,
> > 
> > you need to specify max_sectors qemu parameter for the direct lun
> > attached device. Something like this:
> > "-device virtio-scsi-pci,id=scsi-vioscsi1,max_sectors=64"
> 
> Test again with max_sectors=64, installation can be succeed, thanks a lot
> vadim, changing this bug to verified.
> 
> Used versions:
> kernel-4.18.0-305.28.1.el8_4.x86_64
> qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> virtio-win-preqwhql-215
> edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> 
> Best regards~
> Peixiu

if the disk is openstack cinder block volume, where i can set max_sectors=64?

Comment 9 Peixiu Hou 2022-01-20 09:58:14 UTC
(In reply to abchujb from comment #8)
> (In reply to Peixiu Hou from comment #6)
> > (In reply to Vadim Rozenfeld from comment #5)
> > > (In reply to Peixiu Hou from comment #4)
> > > > Hi Vadim,
> > > > 
> > > > I tested this case on a RHEL8.4 host with virtio-win-prewhql-215, also
> > > > reproduced this issue, steps as comment#0.
> > > > - with scsi-block + /dev/sdb, install win10 os failed.
> > > > - with scsi-hd + /dev/sdb, win10 os can be installed success.
> > > > 
> > > > # lsscsi
> > > > [0:2:0:0]    disk    DELL     PERC H710        3.13  /dev/sda 
> > > > [0:2:1:0]    disk    DELL     PERC H710        3.13  /dev/sdb 
> > > > [0:2:2:0]    disk    DELL     PERC H710        3.13  /dev/sdc 
> > > > [5:0:0:0]    cd/dvd  PLDS     DVD-ROM DS-8D9SH UD51  /dev/sr0
> > > > 
> > > > # cat /sys/block/sdb/queue/max_segments
> > > > 64
> > > > 
> > > > Version:
> > > > kernel-4.18.0-305.28.1.el8_4.x86_64
> > > > qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> > > > edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> > > > virtio-win-prewhql-215
> > > > 
> > > > Thanks~
> > > > Peixiu
> > > 
> > > Hi Peixiu,
> > > 
> > > you need to specify max_sectors qemu parameter for the direct lun
> > > attached device. Something like this:
> > > "-device virtio-scsi-pci,id=scsi-vioscsi1,max_sectors=64"
> > 
> > Test again with max_sectors=64, installation can be succeed, thanks a lot
> > vadim, changing this bug to verified.
> > 
> > Used versions:
> > kernel-4.18.0-305.28.1.el8_4.x86_64
> > qemu-kvm-5.2.0-16.module+el8.4.0+13043+9eb47245.11.x86_64
> > virtio-win-preqwhql-215
> > edk2-ovmf-20200602gitca407c7246bf-4.el8_4.2.noarch
> > 
> > Best regards~
> > Peixiu
> 
> if the disk is openstack cinder block volume, where i can set max_sectors=64?

Hi, I see your block volume used virtio-blk-pci device, it should not support max_sectors=64 param, if you openstack default use virtio-blk-pci for block volume, then it seems cannot works, we can wait for the developer reply of bug 2041757; If you change to virtio-scsi-pci for block volume, honestly, I'm also not so familiar about the openstack detail behavior, 5sorry for that~ 

BR~
Peixiu

Comment 10 qing.wang 2022-01-21 08:54:51 UTC
*** Bug 2041757 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2022-05-17 15:35:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: virtio-win), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3890