From Fedora Project Wiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 29: Line 29:


=== Test Cases ===
=== Test Cases ===
{|


! TEST !! METHOD
Things to test, roughly in dependency order:


|-
# [[QA:Testcase virt-install using qcow2]]
| virt-install w/ qcow2
# [[QA:Testcase virt-manager install using qcow2]]
||
# [[QA:Testcase qemu-img convert from raw to qcow2]]
 
# [[QA:Testcase qemu-img create snapshot]]
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.
 
# Open virt-manager, click 'New'
# Enter options as necessary until you reach the 'Storage' screen
# Click 'Select managed or existing storage', then click 'Browse'
# Select storage pool 'default', then click 'New Volume'
# Enter a new filename and size, but select Format 'qcow2', click 'Create Volume'
# Select the newly created volume and click 'Choose Volume'
# Continue with the installation
 
|-
| 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.
 
|-
| Backing files
||
 
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>
  <!-- Amount of space to store changes -->
  <capacity>1000000000</capacity>
  <allocation>0</allocation>
  <target>
    <format type='qcow2'/>
  </target>
  <backingStore>
    <path>/var/lib/libvirt/images/youroriginal.img</path>
  </backingStore>
</volume>
__EOF__
 
Then run:
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>'
 
|}


=== Advanced aspects ===
=== Advanced aspects ===
Please note that all contributions to Fedora Project Wiki are considered to be released under the Attribution-Share Alike 4.0 International (see Fedora Project Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please solve the following task below and enter the answer in the box (more info):

Cancel Editing help (opens in new window)