On Tue, Oct 04, 2011 at 04:27:42AM -0400, Federico Simoncelli wrote: > ----- Original Message ----- > > From: "Stefan Hajnoczi" <stefa...@gmail.com> > > To: "Federico Simoncelli" <fsimo...@redhat.com> > > Cc: qemu-devel@nongnu.org, aba...@redhat.com, dl...@redhat.com > > Sent: Tuesday, October 4, 2011 9:33:48 AM > > Subject: Re: [Qemu-devel] New option for snapshot_blkdev to avoid image > > creation > > > > 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). > > Hi Stefan, are you sure that bdrv_img_create opens the backing file > with read/write permissions?
You are absolutely right. BDRV_O_FLAGS does not have BDRV_O_RDWR so it is opening read-only. I missed this when reading the code earlier today. Stefan