[libvirt] [PATCH 1/8] Add new API virDomainBlockPull* to headers

Daniel P. Berrange berrange at redhat.com
Tue Jun 14 09:47:36 UTC 2011


On Thu, Jun 09, 2011 at 12:10:07PM -0500, Adam Litke wrote:
> Set up the types for the block pull functions and insert them into the
> virDriver structure definition.  Symbols are exported in this patch to prevent
> documentation compile failures.
> 
> * include/libvirt/libvirt.h.in: new API
> * src/driver.h: add the new entry to the driver structure
> * python/generator.py: fix compiler errors, the actual python bindings are
>   implemented later
> * src/libvirt_public.syms: export symbols
> 
> Signed-off-by: Adam Litke <agl at us.ibm.com>
> ---
>  include/libvirt/libvirt.h.in |   39 +++++++++++++++++++++++++++++++++++++++
>  python/generator.py          |    3 +++
>  src/driver.h                 |   22 ++++++++++++++++++++++
>  src/libvirt_public.syms      |    7 +++++++
>  4 files changed, 71 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index df213f1..ba547c1 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1156,6 +1156,45 @@ int virDomainUpdateDeviceFlags(virDomainPtr domain,
>                                 const char *xml, unsigned int flags);
>  
>  /*
> + * BlockPull API
> + */
> +
> +/* An iterator for initiating and monitoring block pull operations */
> +typedef unsigned long long virDomainBlockPullCursor;
> +
> +typedef struct _virDomainBlockPullInfo virDomainBlockPullInfo;
> +struct _virDomainBlockPullInfo {
> +    /*
> +     * The following fields provide an indication of block pull progress.  @cur
> +     * indicates the current position and will be between 0 and @end.  @end is
> +     * the final cursor position for this operation and represents completion.
> +     * To approximate progress, divide @cur by @end.
> +     */
> +    virDomainBlockPullCursor cur;
> +    virDomainBlockPullCursor end;
> +};
> +typedef virDomainBlockPullInfo *virDomainBlockPullInfoPtr;
> +
> +int                 virDomainBlockPull(virDomainPtr dom,
> +                                       const char *path,
> +                                       virDomainBlockPullInfoPtr info,
> +                                       unsigned int flags);
> +
> +int                 virDomainBlockPullAll(virDomainPtr dom,
> +                                          const char *path,
> +                                          unsigned int flags);
> +
> +int                 virDomainBlockPullAbort(virDomainPtr dom,
> +                                            const char *path,
> +                                            unsigned int flags);
> +
> +int                 virDomainGetBlockPullInfo(virDomainPtr dom,
> +                                              const char *path,
> +                                              virDomainBlockPullInfoPtr info,
> +                                              unsigned int flags);
> +
> +
> +/*
>   * NUMA support
>   */
>  
> diff --git a/python/generator.py b/python/generator.py
> index 7c38fdd..43e7414 100755
> --- a/python/generator.py
> +++ b/python/generator.py
> @@ -178,6 +178,8 @@ def enum(type, name, value):
>  functions_failed = []
>  functions_skipped = [
>      "virConnectListDomains",
> +    'virDomainBlockPull',
> +    'virDomainGetBlockPullInfo',
>  ]
>  
>  skipped_modules = {
> @@ -192,6 +194,7 @@ skipped_types = {
>       'virConnectDomainEventIOErrorCallback': "No function types in python",
>       'virConnectDomainEventGraphicsCallback': "No function types in python",
>       'virEventAddHandleFunc': "No function types in python",
> +     'virDomainBlockPullInfoPtr': "Not implemented yet",
>  }
>  
>  #######################################################################
> diff --git a/src/driver.h b/src/driver.h
> index 5df798a..4b30390 100644
> --- a/src/driver.h
> +++ b/src/driver.h
> @@ -615,6 +615,24 @@ typedef int
>                       unsigned long flags,
>                       int cancelled);
>  
> +typedef int
> +    (*virDrvDomainBlockPull)(virDomainPtr dom, const char *path,
> +                             virDomainBlockPullInfoPtr info,
> +                             unsigned int flags);
> +
> +typedef int
> +    (*virDrvDomainBlockPullAll)(virDomainPtr dom, const char *path,
> +                                unsigned int flags);
> +
> +typedef int
> +    (*virDrvDomainBlockPullAbort)(virDomainPtr dom, const char *path,
> +                                  unsigned int flags);
> +
> +typedef int
> +    (*virDrvDomainGetBlockPullInfo)(virDomainPtr dom, const char *path,
> +                                    virDomainBlockPullInfoPtr info,
> +                                    unsigned int flags);
> +
>  /**
>   * _virDriver:
>   *
> @@ -749,6 +767,10 @@ struct _virDriver {
>      virDrvDomainMigratePerform3	domainMigratePerform3;
>      virDrvDomainMigrateFinish3	domainMigrateFinish3;
>      virDrvDomainMigrateConfirm3	domainMigrateConfirm3;
> +    virDrvDomainBlockPull domainBlockPull;
> +    virDrvDomainBlockPullAll domainBlockPullAll;
> +    virDrvDomainBlockPullAbort domainBlockPullAbort;
> +    virDrvDomainGetBlockPullInfo domainGetBlockPullInfo;
>  };
>  
>  typedef int
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 4d4299a..f2637ae 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -451,3 +451,10 @@ LIBVIRT_0.9.2 {
>  } LIBVIRT_0.9.0;
>  
>  # .... define new API here using predicted next version number ....
> +LIBVIRT_0.9.3 {
> +    global:
> +        virDomainBlockPull;
> +        virDomainBlockPullAll;
> +        virDomainBlockPullAbort;
> +        virDomainGetBlockPullInfo;
> +} LIBVIRT_0.9.2;
> -- 

ACK

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