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

Philip Durbin philipdurbin at gmail.com
Tue Oct 4 17:11:54 UTC 2011


I have three KVM hosts running CentOS 5.5 that store their images and
qemu configuration in the same location on NFS:

[root at gfs06 ~]# which koan
alias koan='koan --virt --server=cobbler --virt-type=qemu
--qemu-disk-type=virtio --virt-path=/etc/libvirt/images/'
	/usr/bin/koan
[root at gfs06 ~]# file /etc/libvirt/{qemu,images}
/etc/libvirt/qemu:   symbolic link to `/mnt/KVM_temp/qemu'
/etc/libvirt/images: symbolic link to `/mnt/KVM_temp/images'
[root at gfs06 ~]#

I've set up a new KVM host running CentOS 6.0 and I'd like to access
the existing storage so that I can migrate guests from the CentOS 5
KVM host to the CentOS 6 KVM host.

I set up the same symlinks, but I can't create guest from the CentOS
KVM host due to permission errors on the disk image (though the disk
image is created).

I suspect the problem is that with CentOS 6 I need to use storage
pools. . . that I can't simply use symlinks as they were set up on
CentOS 5.

I found a thread at
https://www.redhat.com/archives/virt-tools-list/2011-May/msg00017.html
that talks using commands such as. . .

* virsh pool-destroy default
* virsh pool-edit default
* virsh pool-start default

. . . and I would obviously point the default pool (or a new one) to
our existing storage (i.e. /etc/libvirt/images or
/mnt/KVM_temp/images) but I'm a little concerned about the 60 or so
guests that are stored there.

Are the commands to manage libvirt storage pools (virsh, virt-manager,
etc.) non-destructive?  If I configure the default pool or a new pool
to use the path to my existing guest images, will the guest be
unharmed?  I'd rather not break anything with the existing
installation.  Again, the goal would be migration of guests from the
old KVM hosts to the new one.

Thanks in advance!

Phil

p.s.  Here are some libvirt and related version numbers for CentOS 5.5
vs. CentOS 6:

[root at gfs06 ~]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root at gfs06 ~]# rpm -q kvm libvirt.x86_64
kvm-83-164.el5_5.25
libvirt-0.6.3-33.el5_5.3

[root at kvm-camd01 ~]# cat /etc/centos-release
CentOS Linux release 6.0 (Final)
[root at kvm-camd01 ~]# rpm -q qemu-kvm libvirt
qemu-kvm-0.12.1.2-2.113.el6_0.8.x86_64
libvirt-0.8.1-27.el6_0.6.x86_64

p.p.s. In case someone in the future is searching for similar errors,
here's an example of trying to create a guest and getting permission
denied errors.  Note that for the time being I've disabled SELinux.

[root at kvm-camd01 ~]# file /etc/libvirt/{qemu,images}
/etc/libvirt/qemu:   symbolic link to `/mnt/KVM_temp/qemu'
/etc/libvirt/images: symbolic link to `/mnt/KVM_temp/images'
[root at kvm-camd01 ~]# ls /etc/libvirt/images/testfromkvmcamd01.img
ls: cannot access /etc/libvirt/images/testfromkvmcamd01.img: No such
file or directory
[root at kvm-camd01 ~]# virt-install --name=testfromkvmcamd01 --ram=1024
--vcpus=1 --cdrom=/var/lib/libvirt/images/CentOS-6.0-x86_64-minimal.iso
--os-type=linux --os-variant=rhel6 --disk
path=/etc/libvirt/images/testfromkvmcamd01.img,size=5


Starting install...
Creating storage file testfromkvmcamd01.img
                                                               | 5.0
GB     00:00
ERROR    internal error process exited while connecting to monitor:
char device redirected to /dev/pts/1
qemu: could not open disk image
/etc/libvirt/images/testfromkvmcamd01.img: Permission denied

Domain installation does not appear to have been
 successful.  If it was, you can restart your domain
 by running 'virsh start testfromkvmcamd01'; otherwise, please
 restart your installation.
ERROR    internal error process exited while connecting to monitor:
char device redirected to /dev/pts/1
qemu: could not open disk image
/etc/libvirt/images/testfromkvmcamd01.img: Permission denied
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 1054, in <module>
    main()
  File "/usr/sbin/virt-install", line 936, in main
    start_time, guest.start_install)
  File "/usr/sbin/virt-install", line 978, in do_install
    dom = install_func(conscb, progresscb, wait=(not wait))
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 973,
in start_install
    return self._do_install(consolecb, meter, removeOld, wait)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line
1038, in _do_install
    "install")
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line
1009, in _create_guest
    dom = self.conn.createLinux(start_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1270, in
createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed',
conn=self)
libvirtError: internal error process exited while connecting to
monitor: char device redirected to /dev/pts/1
qemu: could not open disk image
/etc/libvirt/images/testfromkvmcamd01.img: Permission denied

[root at kvm-camd01 ~]# ls -lh /etc/libvirt/images/testfromkvmcamd01.img
-rwxr-xr-x 1 root root 5.0G Oct  4 12:49
/etc/libvirt/images/testfromkvmcamd01.img
[root at kvm-camd01 ~]# getenforce
Disabled
[root at kvm-camd01 ~]#




More information about the virt-tools-list mailing list