Bug 754485 - can't work with LVM virtual volumes
Summary: can't work with LVM virtual volumes
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Osier Yang
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-16 16:27 UTC by ildar.mulyukov
Modified: 2011-11-22 21:58 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-22 21:58:33 UTC
Embargoed:


Attachments (Terms of Use)
pool xml (649 bytes, text/xml)
2011-11-16 16:44 UTC, ildar.mulyukov
no flags Details

Description ildar.mulyukov 2011-11-16 16:27:46 UTC
Description of problem:
libvirt throws an error when trying to work with LVs which are snapshots. Please fix.

Steps to Reproduce:
1. Create a volume: lvcreate -nsnapshoted_lv -L1G VirtVG --virtualsize 3G
2. Add the VG to libvirt's qemu://system
  
Actual results:
Error starting pool 'VirtVG': cannot open volume '/dev/VirtVG/[snapshoted_lv_vorigin]': No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 44, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/storagepool.py", line 64, in start
    self.pool.create(0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1761, in create
    if ret == -1: raise libvirtError ('virStoragePoolCreate() failed', pool=self)
libvirtError: cannot open volume '/dev/VirtVG/[snapshoted_lv_vorigin]': No such file or directory

Comment 1 Dave Allan 2011-11-16 16:32:53 UTC
Can you provide the pool xml?

Comment 2 ildar.mulyukov 2011-11-16 16:44:52 UTC
Created attachment 534049 [details]
pool xml

It has nothing special. Whenever I add a snapshot LV and refresh the pool, it gets inactive. More:
# lvdisplay VirtVG
File descriptor 8 (pipe:[35313]) leaked on lvdisplay invocation. Parent PID 8246: bash
  --- Logical volume ---
  LV Name                /dev/VirtVG/testqemu
  VG Name                VirtVG
  LV UUID                QRTK9G-08qk-ezAO-UB5P-bmXI-3Ofm-EZbvNj
  LV Write Access        read/write
  LV snapshot status     active destination for /dev/VirtVG/testqemu_vorigin
  LV Status              available
  # open                 0
  LV Size                3.00 GiB
  Current LE             768
  COW-table size         880.00 MiB
  COW-table LE           220
  Allocated to snapshot  0.00% 
  Snapshot chunk size    4.00 KiB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:6

Comment 3 Osier Yang 2011-11-17 02:43:04 UTC
(In reply to comment #0)
> Description of problem:
> libvirt throws an error when trying to work with LVs which are snapshots.
> Please fix.
> 
> Steps to Reproduce:
> 1. Create a volume: lvcreate -nsnapshoted_lv -L1G VirtVG --virtualsize 3G

This is not an snapshot lv actually, though the name is "snapshoted_lv".

> 2. Add the VG to libvirt's qemu://system
> 
> Actual results:
> Error starting pool 'VirtVG': cannot open volume
> '/dev/VirtVG/[snapshoted_lv_vorigin]': No such file or directory
> 
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/asyncjob.py", line 44, in
> cb_wrapper
>     callback(asyncjob, *args, **kwargs)
>   File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in tmpcb
>     callback(*args, **kwargs)
>   File "/usr/share/virt-manager/virtManager/storagepool.py", line 64, in start
>     self.pool.create(0)
>   File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1761, in create
>     if ret == -1: raise libvirtError ('virStoragePoolCreate() failed',
> pool=self)
> libvirtError: cannot open volume '/dev/VirtVG/[snapshoted_lv_vorigin]': No such
> file or directory

Comment 4 Osier Yang 2011-11-17 03:09:10 UTC
(In reply to comment #2)
> Created attachment 534049 [details]
> pool xml
> 
> It has nothing special. Whenever I add a snapshot LV and refresh the pool, it
> gets inactive. More:
> # lvdisplay VirtVG
> File descriptor 8 (pipe:[35313]) leaked on lvdisplay invocation. Parent PID
> 8246: bash
>   --- Logical volume ---
>   LV Name                /dev/VirtVG/testqemu
>   VG Name                VirtVG
>   LV UUID                QRTK9G-08qk-ezAO-UB5P-bmXI-3Ofm-EZbvNj
>   LV Write Access        read/write
>   LV snapshot status     active destination for /dev/VirtVG/testqemu_vorigin

This is a snapshot lv, but with my testing on the git head of libvirt, there is no problem for a logical pool has a snapshot lv. Both of pool-start and pool-refresh work fine.

Comment 5 Osier Yang 2011-11-17 03:10:39 UTC
@Ildar, What's the libvirt version you use? on which platform?

Comment 6 ildar.mulyukov 2011-11-17 03:46:22 UTC
0.9.6, ALTLinux x86_64

Comment 7 Osier Yang 2011-11-17 10:29:43 UTC
There is no problem when I tested with 0.9.6, things are just fine (from tarball, and note that I don't have an ALTLinux).

Comment 8 Osier Yang 2011-11-17 11:39:45 UTC
By the way, the pool can't be started if there is a striped lv on 0.9.6 though, it's fixed in upstream 0.9.7 with commit 82c174.

@Ildar, could you figure out if the pool-start/pool-refresh work for you with a real snapshot lv?

Comment 9 ildar.mulyukov 2011-11-18 07:53:52 UTC
I am sorry that my report was quite misleading.
I did it too general, noting snapshots instead of virtual volumes.

Note: virtual volumes are snapshots of some pseudo-volumes that do not exist in reality:
# lvcreate -n vlv-test -L1G VirtVG --virtualsize 3G
  Logical volume "vlv-test" created
# lvs | grep vlv-test
  vlv-test VirtVG swi-a-   1.00g [vlv-test_vorigin]   0.00                        
# lvdisplay /dev/VirtVG/vlv-test | grep status
  LV snapshot status     active destination for /dev/VirtVG/vlv-test_vorigin
# lvdisplay /dev/VirtVG/vlv-test_vorigin
  One or more specified logical volume(s) not found.

virsh # pool-start VirtVG
error: Failed to start pool VirtVG
error: cannot open volume '/dev/VirtVG/[vlv-test_vorigin]': No such file or directory

Summary: libvirt tries to find the origin volume that does not exist.

Comment 10 Osier Yang 2011-11-18 09:06:50 UTC
(In reply to comment #9)
> I am sorry that my report was quite misleading.
> I did it too general, noting snapshots instead of virtual volumes.
> 
> Note: virtual volumes are snapshots of some pseudo-volumes that do not exist in
> reality:
> # lvcreate -n vlv-test -L1G VirtVG --virtualsize 3G
>   Logical volume "vlv-test" created
> # lvs | grep vlv-test
>   vlv-test VirtVG swi-a-   1.00g [vlv-test_vorigin]   0.00                      
> # lvdisplay /dev/VirtVG/vlv-test | grep status
>   LV snapshot status     active destination for /dev/VirtVG/vlv-test_vorigin
> # lvdisplay /dev/VirtVG/vlv-test_vorigin
>   One or more specified logical volume(s) not found.
> 
> virsh # pool-start VirtVG
> error: Failed to start pool VirtVG
> error: cannot open volume '/dev/VirtVG/[vlv-test_vorigin]': No such file or
> directory
> 
> Summary: libvirt tries to find the origin volume that does not exist.

Thanks, Ildar, the problem exists indeed. 

# /sbin/lvs --separator \# --noheadings --units b --unbuffered --nosuffix --options lv_name,origin,uuid,devices,segtype,stripes,seg_size,vg_extent_size osier_vg
  osier_snap##gH3hDB-1QuA-UVkY-SlBJ-0Bbe-L0G2-tGS3cQ#/dev/sda5(15)#linear#1#4194304#4194304
  osier_linear##J63tmm-fV8z-lt52-4kKc-fKrE-dYe4-zDkJU3#/dev/sda5(16)#linear#1#12582912#4194304
  snap_test#osier_linear#11lBqw-xZbv-qf1o-IhT5-vcQH-nxAD-8PtDVe#/dev/sda6(16)#linear#1#104857600#4194304
  lv_test#[lv_test_vorigin]#Mo91Oc-lfVU-8F7A-12UM-ytvs-EKip-mofEKB#/dev/sda5(19)#linear#1#12582912#4194304

For the lv_test volume which created with "--virtualsize", it's the original path
is outputed as "[lv_test_vorigin]".

Comment 11 Osier Yang 2011-11-21 03:29:35 UTC
Patch committed to upstream:

commit d26b73ca2b1c35957b3c709a6cd9b3fd6a3d332a
Author: Osier Yang <jyang>
Date:   Fri Nov 18 19:15:10 2011 +0800

Comment 12 Dave Allan 2011-11-21 19:29:52 UTC
Ildar, would you be able to test the upstream HEAD?  (Apologies if you have I haven't been following all the details.)

Comment 13 ildar.mulyukov 2011-11-22 05:56:54 UTC
Dave, I believe Osier and you that the problem is fixed, though I can't check it right now. You can close the bug. If I see some related problem, I'll REOPEN it.

Thanks a lot.

Comment 14 Dave Allan 2011-11-22 21:58:33 UTC
Ok, sounds like a plan.


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