Test Day:2009-09-17 Virtualization qcow2
|Thursday Sep 17, 2009||All day||#fedora-test-day (webchat)|
What to test?
This part of today's Fedora Test Day will focus on testing
qemu-kvm support for the qcow2 image format.
This is related to the KVM qcow2 Performance feature in Fedora 12. If we're to advertise the format's improved performance, we better test that people can use the format!
If you come to this page after the test day is completed, your testing is still valuable, and you can use the information on this page to test qcow2 support and provide feedback.
The following people have also agreed to be available for testing, workarounds, bug fixes, and general discussion:
- add your name here
What's needed to test
- A fully updated Fedora 12 Rawhide machine. See instructions on the main test day page.
- At least one guest image installed before the test day (suggested reading - Virtualization_Quick_Start)
|virt-install w/ qcow2||
virt-install can create qcow2 images at install time via the '--disk format=' option:
virt-install --connect qemu:///system \ --name rawhide-qcow2 \ --ram 1024 \ --disk path=/var/lib/libvirt/images/rawhide.qcow2,format=qcow2,size=6 \ --location http://download.fedoraproject.org/pub/fedora/linux/development/x86_64/os \ --os-variant fedora12
virt-install can only create QCOW2 images in a libvirt managed directory (storage pool), so trying to create /home/foouser/myvm.qcow2 may error unless you have taught libvirt about your home directory. You can do this via virt-manager: Edit->Host Details->Storage-> '+' Button to add a directory storage pool. QCOW2 images can also be provisioned from the 'Storage' section by selecting 'New Volume'
|virt-manager w/ qcow2||
Similarly, a qcow2 install can be done with virt-manager.
|qemu-img convert from raw to qcow2||
An existing disk image can be converted to qcow2 using 'qemu-img':
cd /var/lib/libvirt/images qemu-img convert -O qcow2 <original image> <new image name> virsh pool-refresh default
This will not alter or remove the original disk image. 'pool-refresh' is required for libvirt to notice the change. To point your VM at the qcow2 image, you can use 'virsh edit <vm name>', and change the disk paths.
An existing disk image can be used as a readonly 'backing store' for a new image. The new image provides COW access to the original image: only changes are stored in the new image (the original image is NOT altered in anyway). This is useful if a user wants to test possibly dangerous changes to a valuable disk image.
This can be done via libvirt. You will need to create an XML file for the new image:
cat << __EOF__ >> new.xml <volume> <name>new.img</name> <capacity>1000000000</capacity> <allocation>0</allocation> <target> <format type='qcow2'/> </target> <backingStore> <path>/var/lib/libvirt/images/youroriginal.img</path> </backingStore> </volume> __EOF__
virsh vol-create --pool default new.xml
You can then create a VM pointing at 'new.img', or repoint an existing image at the new file using 'virsh edit <vm name>'
If you want to play a bit more with qcow2 and the test cases suggested above are not enough for you, there are some additional features that cannot be accessed with the management tools (so they are not top priority to be tested), but you still can use them by invoking qemu-img and qemu manually.
When creating images with qemu-img, you can change some default options using the -o parameter. For example you could create a fairly non-standard image using
qemu-img create -f qcow2 -o encryption,cluster_size=32k,backing_file=base.vmdk image.qcow2 10G. To get an overview of the supported options, you can use
qemu-img create -f qcow2 -o ?.
The following list contains some suggestions on what you could test:
- Encrypted images (
- Varying cluster sizes (
-o cluster_size=sizewhere size is between 512 and 64k). Smaller cluster can save some space on almost empty disks, larger clusters are faster usually.
- Backing files (
-o backing_file=file). The new image is based on the given backing file and only differences are saved into the qcow2 file. Try usinh different formats for the backing file, it doesn't need to be qcow2.
- Commit back the changes from a qcow2 image to its backing file (
qemu-img commitor the
commitcommand in the qemu monitor)
- Snapshots: You can either snapshot the disk of a turned off VM (
qemu-img snapshot -c my_snapshot disk.qcow2) or use the qemu monitor to save the state of a running VM (
savevm my_snapshot). In the former case, you can revert the disk to the saved state using
qemu-img snapshot -a my_snapshot.qcow2. Using the qemu monitor (
loadvm my_snapshot) you restore the complete VM state as it was when you saved the snapshot. Alternatively, you can also use the -loadvm option on the qemu command line to start a VM using a previously saved snapshot.
- Compressed images: When converting an image, you can have the resulting qcow2 image compressed (
qemu-img convert -O qcow2 -c ...)
- Combine things: Snapshots on an encrypted image with a compressed backing file...
If you suspect that something has gone wrong with your image and you want to check it, you can try
qemu-img check disk.qcow2.
Issues that were identified
|phan||VM cannot boot from the disk converted by qemu-img||#523948||NEEDINFO|
|jbao||VM cannot boot from the backing disk img||#525362||NEEDINFO|