On Sat, Feb 06, 2016 at 02:04:23PM +0100, Max Reitz wrote: > On 04.02.2016 18:36, Alyssa Milburn wrote: > > This avoids a 'change' command from the monitor unlink()ing the new > > file if the bdrv was previously snapshotted. > > > > Signed-off-by: Alyssa Milburn <[email protected]> > > --- > > blockdev.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/blockdev.c b/blockdev.c > > index be4ca44..d39c2e6 100644 > > --- a/blockdev.c > > +++ b/blockdev.c > > @@ -2514,6 +2514,7 @@ void qmp_blockdev_change_medium(const char *device, > > const char *filename, > > } > > > > bdrv_flags = blk_get_open_flags_from_root_state(blk); > > + bdrv_flags &= ~BDRV_O_TEMPORARY; > > > > if (!has_read_only) { > > read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN; > > > > This patch is correct (thanks!), but I think we want to unset even more > flags, namely BDRV_O_SNAPSHOT, BDRV_O_NO_BACKING, and BDRV_O_PROTOCOL.
Thanks. I posted an updated patch with this change (but of course, this is a trivial patch anyway). It's not entirely clear to me which flags should(n't) be preserved and where to do that. Since the snapshotted file is part of a chain (and the original flags are "correct") I wondered if this might not be the ideal fix, but it seems safe/sane to do it here. - Alyssa
