Bug 1134670

Summary: fail to specify the physical_block_size/logical_block_size value not 512 for IDE disk
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: chayang, famz, hhuang, juzhang, kwolf, mazhang, michen, mrezanin, pbonzini, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-101.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1134693 (view as bug list) Environment:
Last Closed: 2015-11-19 04:52:59 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:
Bug Depends On:    
Bug Blocks: 1134693    

Description Sibiao Luo 2014-08-28 04:31:24 UTC
Description of problem:
fail to specify the physical_block_size/logical_block_size=1024|2048... for IDE disk, check the value in guest which is 512 all the time.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev && rpm -q seabios
3.10.0-145.el7.x86_64
qemu-kvm-rhev-1.5.3-60.el7ev.x86_64
seabios-1.7.5-4.el7.x86_64
guest info:
rhel: 3.10.0-145.el7.x86_64
windows: win2012-R2
virtio-win-prewhql-0.1-89

How reproducible:
100%

Steps to Reproduce:
1.launch a KVM guest with physical_block_size/logical_block_size=1024|2048 specified for IDE disk.
e.g.:...-drive file=/home/my-data-disk1.qcow2,if=none,id=drive-data-disk1,format=qcow2,cache=none,aio=native -device ide-hd,drive=drive-data-disk1,id=data-disk1,bus=ide.0,unit=0,physical_block_size=1024,logical_block_size=1024
2.login guest and check the physical_block_size/logical_block_size value.
# cat /sys/block/sda/queue/logical_block_size
# cat /sys/block/sda/queue/physical_block_size

Actual results:
after step 2, it was not the value specified in qemu-kvm commandline.
- for rhel guest:
# cat /sys/block/sda/queue/logical_block_size 
512
# cat /sys/block/sda/queue/physical_block_size 
512
- for windows guest:
C:\Windows\system32>fsutil fsinfo ntfsinfo D:
NTFS Volume Serial Number :       0xbc70d39970d3592a
NTFS Version   :                  3.1
LFS Version    :                  2.0
Number Sectors :                  0x00000000009fe7ff
Total Clusters :                  0x000000000013fcff
Free Clusters  :                  0x000000000013c27f
Total Reserved :                  0x0000000000000000
Bytes Per Sector  :               512       <-----------logical block size
Bytes Per Physical Sector :       512       <-----------physical block size
Bytes Per Cluster :               4096
Bytes Per FileRecord Segment    : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length :           0x0000000000040000
Mft Start Lcn  :                  0x0000000000040000
Mft2 Start Lcn :                  0x0000000000000002
Mft Zone Start :                  0x0000000000040040
Mft Zone End   :                  0x000000000004c840
Resource Manager Identifier :     7C9FE2F6-2E41-11E4-8B47-A304308EAA2B

Expected results:
It should the same values as specified(1024) in qemu-kvm command line.

Additional info:

Comment 1 Kevin Wolf 2014-12-10 15:13:32 UTC
The command line is not correct, our IDE emulation doesn't support logical block
sizes other than 512. Using a different one happens to also the affect the
exposed physical block size.

I sent a patch upstream to catch this ('ide: Check validity of logical block
size') and unless the pull request is rejected, this is going to become commit
d2005185.

Comment 4 Miroslav Rezanina 2015-08-14 18:03:59 UTC
Fix included in qemu-kvm-1.5.3-101.el7

Comment 6 mazhang 2015-08-24 09:23:27 UTC
Reproduced this bug on qemu-kvm-1.5.3-100.el7.x86_64

Host:
qemu-kvm-1.5.3-100.el7.x86_64

Guest:
3.10.0-308.el7.x86_64

Command line:
-drive file=/home/rhel7.2-64.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,werror=stop,rerror=stop,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pci.0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-drive file=/home/my-data-disk1.qcow2,if=none,id=drive-data-disk1,format=qcow2,cache=none,aio=native \
-device ide-hd,drive=drive-data-disk1,id=data-disk1,bus=ide.0,unit=0,physical_block_size=1024,logical_block_size=1024 \


Result:
Both physical_block_size and logical_block_size is 512.

[root@dhcp-10-70 ~]# cat /sys/block/sda/queue/physical_block_size
512
[root@dhcp-10-70 ~]# cat /sys/block/sda/queue/logical_block_size
512


Verified this bug on qemu-kvm-1.5.3-101.el7.x86_64.

Result:
qemu-kvm quit with warning.

QEMU 1.5.3 monitor - type 'help' for more information
(qemu) qemu-kvm: -device ide-hd,drive=drive-data-disk1,id=data-disk1,bus=ide.0,unit=0,physical_block_size=1024,logical_block_size=1024: logical_block_size must be 512 for IDE
qemu-kvm: -device ide-hd,drive=drive-data-disk1,id=data-disk1,bus=ide.0,unit=0,physical_block_size=1024,logical_block_size=1024: Device initialization failed.
qemu-kvm: -device ide-hd,drive=drive-data-disk1,id=data-disk1,bus=ide.0,unit=0,physical_block_size=1024,logical_block_size=1024: Device 'ide-hd' could not be initialized


So this bug has been fixed.

Comment 8 errata-xmlrpc 2015-11-19 04:52:59 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, 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://rhn.redhat.com/errata/RHBA-2015-2213.html