[virt-tools-list] Adding a storage pool for a directory with existing guest images

Philip Durbin philipdurbin at gmail.com
Tue Oct 4 20:48:37 UTC 2011


On Tue, Oct 4, 2011 at 1:24 PM, Eric Blake <eblake at redhat.com> wrote:
> Another thing to check is to make sure that SELinux is not preventing the
> access - 'getsebool virt_use_nfs' needs to report 'on' if you have SELinux
> enabled on your CentOS 6 host.

This was very helpful; thanks, Eric.  I had disabled SELinux during my
troubleshooting but now I've got it back on.  The other change I made
was a chmod of /etc/libvirt, since our symlinks reside in that
directory;

[root at kvm-camd01 ~]# cat /etc/redhat-release
CentOS Linux release 6.0 (Final)
[root at kvm-camd01 ~]# file /etc/libvirt/{images,qemu}
/etc/libvirt/images: symbolic link to `/mnt/KVM_temp/images'
/etc/libvirt/qemu:   symbolic link to `/mnt/KVM_temp/qemu'
[root at kvm-camd01 ~]# ls -ld /etc/libvirt
drwx------. 5 root root 4096 Oct  4 10:02 /etc/libvirt
[root at kvm-camd01 ~]# chmod 701 /etc/libvirt
[root at kvm-camd01 ~]# ls -ld /etc/libvirt
drwx-----x. 5 root root 4096 Oct  4 10:02 /etc/libvirt
[root at kvm-camd01 ~]# getsebool virt_use_nfs
virt_use_nfs --> off
[root at kvm-camd01 ~]# setsebool -P virt_use_nfs on
[root at kvm-camd01 ~]# getsebool virt_use_nfs
virt_use_nfs --> on

It's interesting; on the Centos 5.5 hosts /etc/libvirt has mode 700:

[root at gfs06 ~]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root at gfs06 ~]# file /etc/libvirt/{images,qemu}
/etc/libvirt/images: symbolic link to `/mnt/KVM_temp/images'
/etc/libvirt/qemu:   symbolic link to `/mnt/KVM_temp/qemu'
[root at gfs06 ~]# ls -ld /etc/libvirt
drwx------ 4 root root 4096 Oct  4 11:45 /etc/libvirt
[root at gfs06 ~]#

Anyway, you helped me get on the right track.  Thanks.

And, to answer my original question, it seems like virsh and
virt-manager are not destructive; they don't delete existing images.
Do look out for `virsh pool-delete` though.  You want `virsh
pool-undefine` instead.  Here's a lifecyle of configuring and
unconfiguring storage pools.  I hope it's useful to someone:

[root at kvm-camd01 ~]# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes

[root at kvm-camd01 ~]# virsh pool-define-as local_images dir - - - -
/root/local_image_testing/var/lib/libvirt/images
Pool local_images defined

[root at kvm-camd01 ~]# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
local_images         inactive   no

[root at kvm-camd01 ~]# virsh pool-info local_images
Name:           local_images
UUID:           8c87274a-e221-8217-400d-bc70eaf888a1
State:          inactive
Persistent:     yes
Autostart:      no

[root at kvm-camd01 ~]# virsh pool-start local_images
Pool local_images started

[root at kvm-camd01 ~]# virsh pool-autostart local_images
Pool local_images marked as autostarted

[root at kvm-camd01 ~]# virsh pool-info local_images
Name:           local_images
UUID:           8c87274a-e221-8217-400d-bc70eaf888a1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       98.43 GB
Allocation:     37.60 GB
Available:      60.83 GB

[root at kvm-camd01 ~]# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
local_images         active     yes

[root at kvm-camd01 ~]# virsh pool-destroy local_imagesPool local_images destroyed

[root at kvm-camd01 ~]# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
local_images         inactive   yes

[root at kvm-camd01 ~]# virsh pool-undefine local_images
Pool local_images has been undefined

[root at kvm-camd01 ~]# virsh pool-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes

[root at kvm-camd01 ~]#

That said, in our configuration with symlinks, I don't need storage
pools (yet anyway).  The symlinks seem to be working, and I'm able to
`koan --system=my_new_vm

Thanks again,

Phil




More information about the virt-tools-list mailing list