Bug 604953 - Logical partition is not allowed to created via virsh vol-create command.
Logical partition is not allowed to created via virsh vol-create command.
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Dave Allan
Virtualization Bugs
Depends On:
Blocks: Rhel6.1LibvirtTier1
  Show dependency treegraph
Reported: 2010-06-17 02:04 EDT by Johnny Liu
Modified: 2016-04-26 09:29 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-01-24 22:50:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Johnny Liu 2010-06-17 02:04:22 EDT
Description of problem:
In a disk pool, when try to create a volume on a disk on which no primary partition is available, virsh vol-create command will fail.

Version-Release number of selected component (if applicable):
# uname -a
Linux dhcp-66-70-6.nay.redhat.com 2.6.32-33.el6.x86_64 #1 SMP Thu Jun 3 13:00:03 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:

Steps to Reproduce:
1. Prepare a disk pool xml:
# cat pool-disk-test.xml 
<pool type='disk'>
    <device path='/dev/sda'>

2. define the disk pool
# virsh pool-define pool-disk-test.xml 
Pool sda defined from pool-disk-test.xml

3. Start the pool
# virsh pool-start sda
Pool sda started

4. Check the current disk info:
# virsh pool-dumpxml sda
<pool type='disk'>
    <device path='/dev/sda'>
    <freeExtent start='58185630720' end='71707991040'/>
    <freeExtent start='213742126080' end='500105249280'/>
    <format type='unknown'/>

# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA Hitachi HDT72105 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  36.7GB  36.7GB  primary   ext3
 2      36.7GB  58.2GB  21.5GB  primary   ext3
 3      71.7GB  107GB   35.0GB  primary   ext3            boot
 4      107GB   500GB   393GB   extended
 5      107GB   109GB   2007MB  logical   linux-swap(v1)
 6      109GB   144GB   35.0GB  logical   ext3
 7      144GB   179GB   35.0GB  logical   ext3
 8      179GB   214GB   35.0GB  logical

(Note: There is no primary partition available, but there is still free space on this disk)

4. Try to create a vol in the pool
# cat vol-partition-test.xml 
    <device path='/dev/sda'>
  <capacity unit='M'>100</capacity>

# virsh vol-create sda vol-partition-test.xml 
error: Failed to create vol from vol-partition-test.xml
error: internal error '/sbin/parted /dev/sda mkpart --script primary 58185630720B 58290488319B' exited with non-zero status 1 and signal 0: /sbin/parted: invalid token: primary

Actual results:
virsh vol-create command always try to create a primary partition.

I try to specify "logical" format for the partition in xml, but looks like the command can not recognize "logical".
    <format type='logical'/>

# virsh vol-create sda vol-partition-test.xml 
error: Failed to create vol from vol-partition-test.xml
error: XML description for unknown volume format type logical is not well formed or invalid

Expected results:
User should be successful to create logical partition on the disk where no primary partition is available.

Additional info:
Comment 2 RHEL Product and Program Management 2010-06-17 02:32:55 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
Comment 3 Dave Allan 2010-06-28 11:48:54 EDT
While this is a bug, it's better to use LVM instead of more than 4 DOS partitions.  Moving to 6.1.
Comment 5 Dave Allan 2011-01-24 22:50:36 EST
We should document this behavior as a limitation of the API, but I don't see that it's something that we're ever going to fix, so I'm closing it.

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