----- Original Message ----- > From: "Paolo Bonzini" <pbonz...@redhat.com> > Cc: "Federico Simoncelli" <fsimo...@redhat.com>, kw...@redhat.com, > mtosa...@redhat.com, qemu-devel@nongnu.org > Sent: Thursday, February 23, 2012 8:38:55 AM > Subject: Re: [PATCH 3/3] Add nocreate option to snapshot_blkdev > > On 02/23/2012 08:19 AM, Paolo Bonzini wrote: > >> > Signed-off-by: Federico Simoncelli <fsimo...@redhat.com> > > What is the usecase, and how can this be tested? > > Oops, you explained it in part 0. > > > Step 5 - Final Switch to Destination > > ==================================== > > VM1 is now able to switch to the destination for both read and > > write > > operations. > > > > [src/hd0base] <- [src/hd0snap1] <= VM1(read-write) > > > > (qemu) snapshot_blkdev -n ide0-hd0 /tmp/dst/hd0snap1.qcow2 > > It seems to me that reusing the snapshot_blkdev command is a bit of a > misnomer. It also forces you to use format autodetection for the > destination in the blkmirror phase. > > I see two possibilities: > > 1) you can make a new command block_reopen; this fixes only the > naming > problem. > > 2) you can hide the new format behind a new command to be used like > this: > > block_migrate --mirror ide-hd0 /tmp/dst/hd0snap1.qcow2 > ... > block_migrate --switch ide-hd0 > > This leave the possibility to specify the format in the future: > > block_migrate --mirror ide-hd0 /tmp/dst/hd0snap1.qcow2 qcow2 > > And we could have another sub-command > > block_mirror --stream ide-hd0 /tmp/dst/hd0.raw > > to migrate block devices without shared storage and without an > intermediate snapshot.
I agree on the fact that using snapshot_blkdev is a misnomer but at the same time I like very much how blkmirror is modular and it can be used as a regular image filename. I'm worried that making it explicit with a "--mirror" option would take away its flexibility. What about adding block_reopen and extending the blkmirror string: (qemu) block_reopen ide-hd0 \ blkmirror:qcow2:/tmp/src/hd0snap1.qcow2:/tmp/dst/hd0snap1.qcow2 so that the format is passed as first argument (and if it's empty we would use the auto-detection). -- Federico