[libvirt-users] virt-install creates a snapshot as the volume backend

Ján Tomko jtomko at redhat.com
Mon Apr 29 16:11:54 UTC 2013


On 04/28/2013 12:55 AM, Ahmed Ossama wrote:
> Greetings All,
> 
> I was running libvirt-0.9.10 on CentOS 6.3 and it was working perfectly until
> yesterday when I decided to update to 6.4, which upgraded libvirt-0.9.10 to
> libvirt-0.10.2.
> 
> I have a storage pool of type volume group, upon upgrading to libvirt-0.10.2,
> the disk image gets created as a snapshot on the volume group not as a regular
> volume.
> 
> Now every time I create a vm using virt-install on a vg, the lv gets created
> as a snapshot not a regular lv, as a result I get the following error when I
> run dmesg:
> 
>     device-mapper: snapshots: Invalidating snapshot: Unable to allocate exception.
>     Buffer I/O error on device dm-5, logical block 128251
...
> 
> and the following on the domain's log file:
> 
>     block I/O error in device 'drive-virtio-disk0': Input/output error (5)
> 
> # virt-install --name="ns1" --vcpus="2" --check-cpu --ram=512
> --os-variant="rhel6" --network "bridge=br0" --disk
> "pool=vdisks,size=22,cache=writeback" --vnc --hvm --vnclisten="0.0.0.0"
> --cdrom="/mnt/ISOs/centos/x86_64/CentOS-6.3-x86_64-bin-DVD1.iso" --hvm
> # lvs | grep ns
>   ns1.img          vm_volumes swi-aos--   4.00m      [ns1.img_vorigin]   0.00
> 
> When I try to create a volume using virt-manager on the volume group, it gets
> created as a snapshot. But when I create a volume using virsh, it gets created
> correctly;
> 
>     virsh # vol-create-as vdisks test 23622320128
> 
>     # lvs | grep test
>       test             vm_volumes -wi-a----  22.00g
> 
> If anyone came across this issue or can provide an advice, I will appreciate
> it so much.
> 
> -- 
> Best Regards,
> Ahmed Ossama
> 

Hello,

since 0.10.2 libvirt creates sparse logical volumes when the requested
allocation is less than requested capacity. Unlike sparse files, these don't
grow automatically and you get an I/O error if you fill them up. [1]

virt-install requests an allocation of 0, which libvirt interprets as the
smallest possible value of 4MB. Unfortunately, you can't specify a different
allocation value at virt-install command line, but a fix that uses the same
allocation and capacity for logical volumes is committed upstream already [2]
and should be fixed in next release.

In virt-manager, you should be able to set the allocation to the same value
manually.

Jan

[1] http://libvirt.org/formatstorage.html#StorageVolFirst

[2] https://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=590c8dbe
commit 590c8dbebfddb71874de7a98e579264ebae6859f
Author:     Martin Kletzander <mkletzan at redhat.com>
AuthorDate: 2013-04-02 13:51:28 +0200
    Don't support sparse logical volumes

    Sparse logical volumes are supported by libvirt, but only in case the
    user takes care of the reallocation, which is not what virt-install
    and virt-manager users want.  This patch defaults the logical volumes
    to non-sparse ones and makes sure allocation is always equal to
    capacity for such volumes.





More information about the libvirt-users mailing list