On 2019-02-13 11:46 AM, Kevin Wolf wrote: > Reading from the backing file would be correct in your special case > (because the overlay was only just created and doesn't contain data > yet), but generally speaking, this would make the disk content > inconsistent because it would mix newer data from the overlay with old > data from the snapshot in the backing file. > > But before I make suggestions how this could be addressed (it's probably > not trivial), let me ask what your real goal is? > > I'm asking because when you start a VM with '-loadvm foo', this means > that you already got a snapshot at this exact point. So the guest will > write to the qcow2 file, but when you start the VM the next time, and > again with '-loadvm foo', the newly written data will be discarded and > QEMU will revert to the snapshot 'foo' again. So you already got the > same functionality that -snapshot is supposed to provide, even without > using it. > > Do you have other reasons why you want to use -snapshot?
The issue is that if I start with -loadvm foo, it will start from the foo snapshot, but any changes will be written to disk. Since qcow2 is a sparse format, a mean guest could fill up all of the sectors and balloon the underlying disk. The next guest starts from the snapshot, too - but the host is wasting disk space. I'm also not able to run several guests from the same qcow2 at once - which is a non-starter.