On 03/06/2012 10:56 AM, Paolo Bonzini wrote: > With it comes a new image creation mode, "no-backing-file", that can > be used to stream an image so that the destination does not need the > original image's backing file(s). > > Both bdrv_append and blkmirror will set the backing_hd on the target, > even if the image is created without one, so that both streaming and > copy-on-write work properly (at least with qcow2 or qed, not raw). > > Streaming mode works with the following gotchas: > > - streaming will rewrite every bit of the source image; > > - zero writes are not supported by the blkmirror driver, hence both > the source and the destination image will grow to full size. >
> +++ b/qapi-schema.json > @@ -1133,10 +1133,12 @@ > # @absolute-paths: QEMU should create a new image with absolute paths > # for the backing file. > # > +# @no-backing-file: QEMU should create a new image with no backing file. > +# > # Since: 1.1 > ## > { 'enum': 'NewImageMode' > - 'data': [ 'existing', 'absolute-paths' ] } > + 'data': [ 'existing', 'absolute-paths', 'no-backing-file' ] } Offline, Paolo and I were discussing this. It may make more sense to _not_ expose a 'no-backing-file' mode, but instead... > +# @BlockdevMirror > +# > +# @device: the name of the device to start mirroring. > +# > +# @target: the image that will start receiving writes for @device. A new > +# file will be created unless @mode is "existing". > +# > +# @format: #optional the format of the target image, default is 'qcow2'. > +# > +# @mode: #optional whether and how QEMU should create a new image, default is > +# 'absolute-paths'. > +## > +{ 'type': 'BlockdevMirror', > + 'data': { 'device': 'str', 'target': 'str', '*format': 'str', > + '*mode': 'NewImageMode' } } have either a mandatory 'full':'bool' or an optional '*base':'str' for choosing how much of the backing chain to be mirrored, as is the case with the block_stream command. That is, the ability to supply an external file ('mode':'existing') should not imply a shallow copy. Having an optional base (where omitting the base gives a full copy) is the most flexible, because then I can start with: base <- snap1 <- snap2 <- snap3 as well as use qemu-img to create an empty file backed by snap1, then issue: { 'execute': 'drive-mirror', 'arguments': { 'device': 'ide0-hd0', 'target': 'copy', 'base': 'snap1', 'mode': 'existing' } } and get the following setup after a drive-reopen: base <- snap1 <- copy without having to do an extra block_stream. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature