On 06/15/2012 09:05 AM, Paolo Bonzini wrote: > This adds the monitor commands that start the mirroring job. > > Signed-off-by: Paolo Bonzini > --- > blockdev.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- > hmp-commands.hx | 21 ++++++++++ > hmp.c | 28 +++++++++++++ > hmp.h | 1 + > qapi-schema.json | 33 +++++++++++++++ > qmp-commands.hx | 41 +++++++++++++++++++ > trace-events | 2 +- > 7 files changed, 242 insertions(+), 4 deletions(-) > > ## > +# @drive-mirror > +# > +# Start mirroring a block device's writes to a new destination. > +# > +# @device: the name of the device whose writes should be mirrored. > +# > +# @target: the target of the new image. If the file exists, or if it > +# is a device, the existing file/device will be used as the new > +# destination. If it does not exist, a new file will be created. > +# > +# @format: #optional the format of the new destination, default is the > +# format of the source > +# > +# @mode: #optional whether and how QEMU should create a new image, default is > +# 'absolute-paths'. Indentation. > +# > +# @sync: what parts of the disk image should be copied to the destination > +# (all the disk, only the sectors allocated in the topmost image, or > +# only new I/O). Document @peed:. > +# > +# Returns: nothing on success > +# If @device is not a valid block device, DeviceNotFound > +# If @target can't be opened, OpenFileFailed > +# If @format is invalid, InvalidBlockFormat > +# > +# Since 1.1 1.2 > +## > +{ 'command': 'drive-mirror', > + 'data': { 'device': 'str', 'target': 'str', '*format': 'str', > + 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode', > + '*speed': 'int' } } > + > +## > # @migrate_cancel > # > # Cancel the current executing migration process. > diff --git a/qmp-commands.hx b/qmp-commands.hx > index e2d77b6..cccea2f 100644 > --- a/qmp-commands.hx > +++ b/qmp-commands.hx > @@ -832,6 +832,47 @@ Example: > EQMP > > { > + .name = "drive-mirror", > + .args_type = "sync:s,device:B,target:s,sync:s?,format:s?", sync: twice? and no speed: or mode:? > +SQMP > +drive-mirror > +------------ > + > +Start mirroring a block device's writes to a new destination. target > +specifies the target of the new image. If the file exists, or if it is > +a device, it will be used as the new destination for writes. If does not > +exist, a new file will be created. format specifies the format of the > +mirror image, default is to probe if mode='existing', else qcow2. default is qcow2? Earlier in this patch you said the same format as the source. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org