On Mon, Jun 17, 2013 at 02:44:46PM +0800, Fam Zheng wrote: > Introduce a "drive" option to new image mode. With this mode, QMP command > should (this patch only modified drive-backup to support it, and report > invalid > parameter error for drive-mirror) skip creating the image file or trying to > open it, it should just reuse the existing BDS by looking for the named drive > with bdrv_find(). It will be useful to utilize "none" sync mode of > drive-backup > for point-in-time snapshot. > > The example with drive-backup is: > > -> { "execute": "drive-backup", "arguments": { "device": "ide0-hd0", > "mode": "drive", > "target": "drive_id_here" > } } > <- { "return": {} } > > > Target bs is not released when block job completes in this case since it's > still used as a device drive or exported by nbd server. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > block/backup.c | 9 ++++++-- > blockdev.c | 57 > ++++++++++++++++++++++++++++++++--------------- > include/block/block_int.h | 3 ++- > qapi-schema.json | 4 +++- > 4 files changed, 51 insertions(+), 22 deletions(-)
Fam and I chatted about this yesterday. The QMP API change here is that traditionally 'target' and 'mode' always referred to existing filenames. Now you can set 'mode': 'drive' and then 'target' becomes a QEMU block device name. I think this API extension is reasonable but I think we haven't nailed down the lifecycle of the snapshot block drive yet... Stefan