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 604953

Summary: Logical partition is not allowed to created via virsh vol-create command.
Product: Red Hat Enterprise Linux 6 Reporter: Johnny Liu <jialiu>
Component: libvirtAssignee: Dave Allan <dallan>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: dallan, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-25 03:50:36 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:
Bug Depends On:    
Bug Blocks: 621776    

Description Johnny Liu 2010-06-17 06:04:22 UTC
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):
libvirt-0.8.1-8.el6.x86_64
# 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:
Always

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

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'>
  <name>sda</name>
  <uuid>b0f38663-5d3f-1dd6-36eb-0fb86e7314a6</uuid>
  <capacity>500105249280</capacity>
  <allocation>200219604480</allocation>
  <available>299885483520</available>
  <source>
    <device path='/dev/sda'>
    <freeExtent start='58185630720' end='71707991040'/>
    <freeExtent start='213742126080' end='500105249280'/>
    </device>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev</path>
    <permissions>
      <mode>0700</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>


# 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 
<volume>
  <name>sda9</name>
  <key>/dev/sda9</key>
  <source>
    <device path='/dev/sda'>
    </device>
  </source>
  <capacity unit='M'>100</capacity>
  <target>
    <path>/dev/sda9</path>
  </target>
</volume>

# 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".
...
  <target>
    <path>/dev/sda9</path>
    <format type='logical'/>
  </target>
...

# 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 Program Management 2010-06-17 06:32:55 UTC
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
inclusion.

Comment 3 Dave Allan 2010-06-28 15:48:54 UTC
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-25 03:50:36 UTC
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.