Red Hat Bugzilla – Bug 604953
Logical partition is not allowed to created via virsh vol-create command.
Last modified: 2016-04-26 09:29:31 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): 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:
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.
While this is a bug, it's better to use LVM instead of more than 4 DOS partitions. Moving to 6.1.
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.