Bug 735441 - Incorrect hardcoded sector size in disk storage pool
Summary: Incorrect hardcoded sector size in disk storage pool
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 16:06 UTC by Daniel Berrangé
Modified: 2011-12-06 11:27 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.9.4-8.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 11:27:58 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Daniel Berrangé 2011-09-02 16:06:16 UTC
Description of problem:
If creating a 'disk' storage pool on a device which has 4k sectors, the size of the partitions reported by libvirt will be x8 too small. This is because libvirt incorrectly hardcoded a 512 byte sector size.

Version-Release number of selected component (if applicable):
0.9.4-1.el6

How reproducible:
Only with 'disk' storage pool on a device with 4k sectors

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Upstream fix

commit b6263c18013e99bab1938d112fc927f948df3eef
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Aug 23 15:25:28 2011 +0100

    Fix parted sector size assumption
    
    Parted does not report disk size in 512 byte units, but
    rather the disks' logical sector size, which with modern
    drives might be 4k.
    
    * src/storage/parthelper.c: Remove hardcoded 512 byte sector
      size

Comment 5 Wayne Sun 2011-11-04 10:13:41 UTC
# fdisk -l
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 162.8 GB, 162842222592 bytes
255 heads, 63 sectors/track, 2474 cylinders
Units = cylinders of 16065 * 4096 = 65802240 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000d2129

   Device Boot      Start         End      Blocks   Id  System

Steps:
1. define disk pool on /dev/sdb
2. build and start /dev/sdb
3. create a vol in the disk pool using vol.xml:
<volume>
  <name>sdb1</name>
  <key>/dev/sdb1</key>
  <source>
    <device path='/dev/sdb'>
    </device>
  </source>
  <capacity unit='M'>10240</capacity>
  <target>
    <path>/dev/sdb1</path>
  </target>
</volume>

# virsh vol-create sdb vol.xml

4. check the vol info
# virsh vol-info sdb1 --pool sdb

Results:
Step 3:
the vol created successfully.

Step 4:
libvirt-0.9.4-7.2:
# virsh vol-info sdb1 --pool sdb
Name:           sdb1
Type:           block
Capacity:       1.25 GB
Allocation:     1.25 GB

libvirt-0.9.4-21:
# virsh vol-info sdb1 --pool sdb
Name:           sdb1
Type:           block
Capacity:       10.00 GB
Allocation:     10.00 GB

So libvirt reports the right size now, no factor x8 defect.

Comment 6 errata-xmlrpc 2011-12-06 11:27:58 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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


Note You need to log in before you can comment on or make changes to this bug.