How can I use the host's lvm VG as a kvm pool?-Collection of common programming errors
I have a machine setup with Centos6 as a virtualisation host. It has a single 250G hard drive that is configured as a single lvm volume group(vg_fluke). Now I would like to use the host’s lvm as a storage pool for KVM.
I found this question on SF and method one describes what I would like to achieve. But I can’t find a way to go about it.
I tried the following, but since the documentation is sketchy, I am certain that I am doing something wrong.
virsh # pool-define-as guest_images_lvm logical - - - - /dev/vg_fluke
Pool guest_images_lvm defined
And followed it with,
virsh # pool-start guest_images_lvm
error: Failed to start pool guest_images_lvm
error: internal error Child process (/sbin/vgchange -ay -) status unexpected: exit status 5
More Information on the LVM setup:
[root@fluke ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb2 vg_fluke lvm2 a-- 232.39g 125.45g
[root@fluke ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
lv_home vg_fluke -wi-ao 5.00g
lv_root vg_fluke -wi-ao 100.00g
lv_swap vg_fluke -wi-ao 1.94g
[root@fluke ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_fluke 1 3 0 wz--n- 232.39g 125.45g
Update:
Followed @sitaktif’s advice and now get the following error:
virsh # pool-define-as lv_guest_vm logical --target /dev/vg-main
Pool lv_guest_vm defined
virsh # pool-start lv_guest_vm
error: Failed to start pool lv_guest_vm
error: internal error '/sbin/vgchange -ay lv_guest_vm' exited with non-zero status 5 and signal 0: Volume group "lv_guest_vm" not found
Note: I am on trying this on a different machine where the VG is vg-main. Do I have to create a second VG for libvirt to use for virtual machines? How can I set it up use a LV in the existing VG?