On Mon, Oct 03, 2011 at 04:09:01PM +0000, Federico Simoncelli wrote: > In some situations might be useful to let qemu use an image that was > prepared for a live snapshot. > The advantage is that creating the snapshot file outside of the qemu > process we can use the whole range of options provided by the format > (eg for qcow2: encryption, cluster_size and preallocation). > It is also possible to pre-set a relative path to the backing file > (now it is created by default as absolute path). > In the long run it can also avoid the danger of reimplementing qemu-img > inside qemu (if we wanted to expose such options when a snapshot is > requested).
When the image file is created based on the backing file size: $ qemu-img create -f qcow2 -o backing_file=master.img vm001.qcow2 It turns out that bdrv_img_create() opens the backing file with read/write permissions. This is generally a bad idea but especially dangerous when the VM currently has the image file open already since image formats are not designed for multiple initiators (clustering). We wouldn't want any caches being written out or startup fsck-style operations to be performed on the backing file while the VM has it open. Please make sure to use read-only before applying this patch. Stefan