Justin Clift
2010-May-31 17:26 UTC
[libvirt-users] Working example of logical storage pool and volume creation?
Hi all, Does anyone have a working example of creation of a logical storage pool and volume? I'm hitting a wall getting logical volumes to work on RHEL 6 beta. There's a single drive I'm trying to setup (sdc) as a libvirt managed logical storage pool, but all volume creation on it fails. Here's what I'm finding so far: Prior to any storage pool work, only the host boot drive (sda) is in lvm. # vgs VG #PV #LV #SN Attr VSize VFree vg_host2 1 3 0 wz--n- 465.27g 0 # pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_host2 lvm2 a- 465.27g 0 # ls -la /dev/mapper total 0 drwxr-xr-x. 2 root root 120 Jun 1 03:12 . drwxrwxrwt. 21 root root 3920 Jun 1 03:12 .. crw-rw----. 1 root root 10, 58 May 31 14:08 control lrwxrwxrwx. 1 root root 7 May 31 14:10 vg_host2-lv_home -> ../dm-7 lrwxrwxrwx. 1 root root 7 May 31 14:08 vg_host2-lv_root -> ../dm-0 lrwxrwxrwx. 1 root root 7 May 31 14:10 vg_host2-lv_swap -> ../dm-8 # Creation of a logical storage pool, using sdc: # virsh pool-define-as guest_images_lvm logical - - /dev/sdc libvirt_lvm /dev/mapper Pool guest_images_lvm defined # virsh pool-info guest_images_lvm Name: guest_images_lvm UUID: 17398035-8000-7252-ab25-58db95aed130 State: inactive # virsh pool-build guest_images_lvm Pool guest_images_lvm built # The physical device and volume group are seen in lvm: # pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_host2 lvm2 a- 465.27g 0 /dev/sdc libvirt_lvm lvm2 a- 465.76g 465.76g # vgs VG #PV #LV #SN Attr VSize VFree libvirt_lvm 1 0 0 wz--n- 465.76g 465.76g vg_host2 1 3 0 wz--n- 465.27g 0 # Starting the logical pool works: # virsh pool-start guest_images_lvm Pool guest_images_lvm started # Creation of volumes fail: # virsh vol-create-as guest_images_lvm volume1 8G error: Failed to create vol volume1 error: internal error '/sbin/lvcreate --name volume1 -L 8388608K /dev/mapper' exited with non-zero status 3 and signal 0: Volume group name expected (no slash) Run `lvcreate --help' for more information. # So, it looked like "/dev/mapper" in the pool-define-as command should have instead been the LVM volume group again. That doesn't work either though: # virsh pool-define-as guest_images_lvm logical - - /dev/sdc libvirt_lvm libvirt_lvm Pool guest_images_lvm defined # virsh pool-build guest_images_lvm Pool guest_images_lvm built # virsh pool-start guest_images_lvm Pool guest_images_lvm started # virsh vol-create-as guest_images_lvm volume1 8G error: Failed to create vol volume1 error: cannot read path 'libvirt_lvm/volume1': No such file or directory Looking in the libvirtd logs for this last attempt, the volume was actually successfully created. But libvirtd then checks for it's presence (wrongly!), doesn't find it, and then lvremove's it: 03:01:24.000: debug : virRunWithHook:832 : /sbin/lvcreate --name volume1 -L 8388608K libvirt_lvm ... 03:01:24.223: debug : virRunWithHook:848 : Command stdout: Logical volume "volume1" created ... 03:01:24.223: error : virStorageBackendLogicalCreateVol:616 : cannot read path 'libvirt_lvm/volume1': No such file or directory ... 03:01:24.223: debug : virRunWithHook:832 : /sbin/lvremove -f libvirt_lvm/volume1 Guessing I'm either doing something wrong, or hitting bugs, or ? Anyone have ideas/suggestions/etc? Regards and best wishes, Justin Clift -- Salasaga - Open Source eLearning IDE http://www.salasaga.org
Justin Clift
2010-Jun-02 14:07 UTC
[libvirt-users] Working example of logical storage pool and volume creation?
On 06/01/2010 03:26 AM, Justin Clift wrote:> Hi all, > > Does anyone have a working example of creation of a logical storage pool > and volume?<snip> If anyone's interested, the working command turned out to be: # virsh pool-define-as guest_images_lvm logical - - /dev/sdc libvirt_lvm /dev/libvirt_lvm (that's all on one line) Regards and best wishes, Justin Clift -- Salasaga - Open Source eLearning IDE http://www.salasaga.org