Bug 611443
| Summary: | User can not delete the volume in a pool built on a mapper device. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Johnny Liu <jialiu> |
| Component: | libvirt | Assignee: | Osier Yang <jyang> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 6.0 | CC: | dallan, dyuan, eblake, mjenner, mzhan, nzhang, syeghiay, xen-maint, yoyzhang |
| Target Milestone: | rc | Keywords: | Reopened |
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.8.7-7.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-05-19 13:19:23 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: | |||
Libvirt currently has trouble with pools built on dev mapper devices as the partition naming works a little differently. This BZ is a dup of 593785. *** This bug has been marked as a duplicate of bug 593785 *** Bug 593785 is about volume creation on mapper device, this bug is about volume deletion operation, So they are different bug. And I also re-tested this bug with libvirt-0.8.1-15.el6.x86_64 (Bug 593785 has been fixed on the -15 version), this issue still reproduced, so I reopened this bug. # rpm -q libvirt libvirt-0.8.1-15.el6.x86_64 # virsh pool-list --all Name State Autostart ----------------------------------------- default active yes xx active no # virsh pool-dumpxml xx <pool type='disk'> <name>xx</name> <uuid>ec1942d9-0bf3-7793-f46b-83cc839772fd</uuid> <capacity>42944186880</capacity> <allocation>1052803584</allocation> <available>41891351040</available> <source> <device path='/dev/mapper/mpatha'> <freeExtent start='1052835840' end='42944186880'/> </device> <format type='dos'/> </source> <target> <path>/dev</path> <permissions> <mode>0700</mode> <owner>-1</owner> <group>-1</group> </permissions> </target> </pool> # virsh vol-list xx Name Path ----------------------------------------- mpathap1 /dev/mapper/mpathap1 # ll /dev/mapper/mpatha* lrwxrwxrwx. 1 root root 7 Jul 15 12:51 /dev/mapper/mpatha -> ../dm-0 lrwxrwxrwx. 1 root root 7 Jul 15 12:51 /dev/mapper/mpathap1 -> ../dm-1 # virsh vol-delete --pool xx mpathap1 error: Failed to delete vol mpathap1 error: internal error Volume path 'dm-1' did not start with parent pool source device name. Ok, fair enough; I'll look into it. So, it turns out that it is essentially the same problem as the BZ I thought it was a dup of, but it is indeed a separate bug. I'm working on a fix. the problem is the logic of "virStorageBackendDiskDeleteVol" doesn't work for device mapper volume at all.
devname = basename(devpath);
srcname = basename(pool->def->source.devices[0].path);
DEBUG("devname=%s, srcname=%s", devname, srcname);
if (!STRPREFIX(devname, srcname)) {
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
_("Volume path '%s' did not start with parent "
"pool source device name '%s'."), devname,
srcname);
goto cleanup;
}
e.g. For jialiu's case:
devname = "dm-1"
srcname = "mpatha"
And the method to calculate partion number also not correct for a device mapper volume.
part_num = devname + strlen(srcname);
Fortunately, we quit with the check before, we need a new logic for device mapper volume.
As you've noticed, the problem here is that the logic to calculate the partition number isn't correct when the underlying device is a dm device. The logic I used in the create case is at: https://www.redhat.com/archives/libvir-list/2010-July/msg00186.html committed upstream as: ae3275c0bb538e29eab840153ccc748cd5023cf7 http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-February/msg01080.html patch posted internally. move to POST. Verified this bug PASS with libvirt-0.8.7-7.el6.x86_64
- kernel-2.6.32-113.el6.x86_64
- qemu-kvm-0.12.1.2-2.147.el6.x86_64
1. # cat xx.xml
<pool type='disk'>
<name>xx</name>
<source>
<device path='/dev/mapper/mpathc'/>
</source>
<target>
<path>/dev</path>
</target>
</pool>
# virsh pool-create xx.xml
Pool xx created from xx.xml
2. # virsh vol-create-as --pool xx --name xx-1 --capacity 2G
Vol xx-1 created
# virsh vol-list xx
Name Path
-----------------------------------------
xx-1 /dev/mapper/mpathcp1
# ll /dev/mapper/
total 0
crw-rw----. 1 root root 10, 58 Feb 21 13:11 control
lrwxrwxrwx. 1 root root 7 Feb 21 13:42 mpathb -> ../dm-1
lrwxrwxrwx. 1 root root 7 Feb 21 13:42 mpathc -> ../dm-0
brw-rw----. 1 root disk 253, 2 Feb 21 14:03 mpathcp1
# fdisk /dev/mapper/mpathc
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/mapper/mpathc: 21.3 GB, 21346910208 bytes
23 heads, 16 sectors/track, 113296 cylinders
Units = cylinders of 368 * 512 = 188416 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c1644
Device Boot Start End Blocks Id System
/dev/mapper/mpathcp1 1 11398 2097152 83 Linux
3. # virsh vol-delete /dev/mapper/mpathcp1 --pool xx
Vol /dev/mapper/mpathcp1 deleted
4. # virsh pool-list --all
Name State Autostart
-----------------------------------------
default active yes
xx active no
# virsh vol-list xx
Name Path
-----------------------------------------
# ll /dev/mapper/
total 0
crw-rw----. 1 root root 10, 58 Feb 21 13:11 control
lrwxrwxrwx. 1 root root 7 Feb 21 13:42 mpathb -> ../dm-1
lrwxrwxrwx. 1 root root 7 Feb 21 13:42 mpathc -> ../dm-0
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0596.html |
Description of problem: Create a pool on a mapper device, and create some volume in the pool, when trying to delete the volume, the following error is seen: # virsh vol-delete /dev/mapper/myvm10p1 error: Failed to delete vol /dev/mapper/myvm10p1 error: internal error Volume path 'dm-1' did not start with parent pool source device name. Version-Release number of selected component (if applicable): libvirt-0.8.1-13.el6.x86_64 How reproducible: Always Steps to Reproduce: 1. Create a pool on a mapper device # virsh pool-dumpxml xx <pool type='disk'> <name>xx</name> <uuid>08a0a104-cbc3-0b96-bd6a-b1f8d00d9474</uuid> <capacity>0</capacity> <allocation>0</allocation> <available>0</available> <source> <device path='/dev/mapper/myvm10'/> <format type='dos'/> </source> <target> <path>/dev</path> <permissions> <mode>0700</mode> <owner>-1</owner> <group>-1</group> </permissions> </target> </pool> # virsh vol-list xx Name Path ----------------------------------------- myvm10p1 /dev/mapper/myvm10p1 # ll /dev/mapper/myvm10* lrwxrwxrwx. 1 root root 7 Jul 5 14:07 /dev/mapper/myvm10 -> ../dm-0 lrwxrwxrwx. 1 root root 7 Jul 5 14:07 /dev/mapper/myvm10p1 -> ../dm-1 2. Try to delete the volume in the pool # virsh vol-delete /dev/mapper/myvm10p1 error: Failed to delete vol /dev/mapper/myvm10p1 error: internal error Volume path 'dm-1' did not start with parent pool source device name. 3. Actual results: User can not delete the volume in a pool built on a mapper device. Expected results: User should can delete the volume in the mapper pool. Additional info: