Add a directory as a storage pool
# virsh pool-list --all
# virsh pool-define-as storage01 --type dir --target /mnt/storage01/vm
# virsh pool-start storage01
# virsh pool-autostart storage01
# virsh pool-list --all
Remove a directory storage pool
Verify the pool is not in use
# virsh pool-list --all
# lsof | grep storage01
Remove the pool
# virsh pool-list --all
# virsh pool-destroy storage01
# virsh pool-undefine storage01
# virsh pool-list --all
Create a qemu disk image
Create a 40GB QCOW2 image:
# qemu-img create -f qcow2 -o compat=1.1 windows.qcow2 40000000000
Convert a vmdk disk image to a qcow2 disk image
# qemu-img convert -p -O qcow2 -o compat=1.1 windows.vmdk windows.qcow2
Live Migrate a VM from one storage pool to another (does not delete the original source qcow2 file)
Backup the XML just in case:
# virsh dumpxml --inactive windows > ~/windows.xml.backup
Migrate the disk volume:
# virsh undefine windows
# virsh blockcopy windows /mnt/storage01/vm/windows.qcow2 /mnt/storage02/vm/windows.qcow2 --wait --verbose --pivot
# virsh dumpxml windows > ~/windows.xml
# virsh define ~/windows.xml
Cleanup
Verify that the qcow2 file is opened in the new location and not the old location
# lsof | grep windows
Remove the temporary files
# rm /mnt/storage01/vm/windows.qcow2
# rm ~/windows.xml
# rm ~/windows.xml.backup
Done
Rename a domain
Shutdown the domain
# virsh dumpxml windows > ~/windows.xml
Edit the xml file and rename the domain
# virsh undefine windows
# virsh define ~/windows.xml
Power on the domain
# rm ~/windows.xml