[libvirt] [RFC] Introduce virDomainBlockCopy API

Daniel P. Berrange berrange at redhat.com
Wed Jun 22 12:54:16 UTC 2011


On Mon, Jun 20, 2011 at 08:15:24PM +0200, Jiri Denemark wrote:
> This API starts asynchronous live copy of a block device (specified by
> target element of the xml argument) into a new source (which must
> already exist). The process can be controlled in the same way as
> migration: monitored with virDomainJobInfo() and canceled using
> virDomainAbortJob().
> 
> I don't particularly like the name (but I wasn't able to come up with a
> better one) since it doesn't reflect the fact that once a block device
> is switched to use the new source once copying finishes. In other words,
> the goal of this API is to update the device to use new source (just
> like virDomainUpdateDeviceFlags) but before doing so all data is copied
> from the old source into the new one (unlike the UpdateDevice API).
> ---
>  include/libvirt/libvirt.h.in |    4 +++
>  src/driver.h                 |    6 ++++
>  src/libvirt.c                |   54 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |    1 +
>  4 files changed, 65 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index cb9e8ca..41f6b2e 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2983,6 +2983,10 @@ typedef struct _virTypedParameter virMemoryParameter;
>   */
>  typedef virMemoryParameter *virMemoryParameterPtr;
>  
> +int virDomainBlockCopy(virDomainPtr domain,
> +                       const char *xml,
> +                       unsigned int flags);

Given that we do in fact need this API, the main problem with it is
that it does not allow for multiple concurrent copy operations on
a single VM. This is because the JobAbort/JobInfo APis are per-VM,
not per block devices. We'd either need to add some new APIs, or
somehow re-use the BlockPullAbort/Info APis for this copy operation
too.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list