[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/9] Stub out internal driver entry points for job processing



On Thu, Feb 18, 2010 at 03:56:08PM +0000, Daniel P. Berrange wrote:
> The internal glue layer for the new pubic API
> 
> * src/driver.h: Define internal driver API contract
> * src/libvirt.c, src/libvirt_public.syms: Wire up public
>   API to internal driver API
> * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
>   src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
>   src/qemu/qemu_driver.c, src/remote/remote_driver.c,
>   src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
>   src/xen/xen_driver.c: Stub new entry point
> ---
>  src/driver.h                |    5 ++++
>  src/esx/esx_driver.c        |    1 +
>  src/libvirt.c               |   48 +++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms     |    1 +
>  src/lxc/lxc_driver.c        |    1 +
>  src/opennebula/one_driver.c |    1 +
>  src/openvz/openvz_driver.c  |    1 +
>  src/phyp/phyp_driver.c      |    1 +
>  src/qemu/qemu_driver.c      |    1 +
>  src/remote/remote_driver.c  |    1 +
>  src/test/test_driver.c      |    1 +
>  src/uml/uml_driver.c        |    1 +
>  src/vbox/vbox_tmpl.c        |    1 +
>  src/xen/xen_driver.c        |    1 +
>  14 files changed, 65 insertions(+), 0 deletions(-)
> 
> diff --git a/src/driver.h b/src/driver.h
> index fe21ea3..8c5d97d 100644
> --- a/src/driver.h
> +++ b/src/driver.h
> @@ -373,6 +373,10 @@ typedef char *
>                           unsigned int ncpus,
>                           unsigned int flags);
>  
> +typedef int
> +    (*virDrvDomainGetJobInfo)(virDomainPtr domain,
> +                              virDomainJobInfoPtr info);
> +
>  /**
>   * _virDriver:
>   *
> @@ -464,6 +468,7 @@ struct _virDriver {
>      virDrvDomainIsPersistent   domainIsPersistent;
>      virDrvCPUCompare            cpuCompare;
>      virDrvCPUBaseline           cpuBaseline;
> +    virDrvDomainGetJobInfo     domainGetJobInfo;
>  };
>  
>  typedef int
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index e125a09..226a6a0 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -3404,6 +3404,7 @@ static virDriver esxDriver = {
>      esxDomainIsPersistent,           /* domainIsPersistent */
>      NULL,                            /* cpuCompare */
>      NULL,                            /* cpuBaseline */
> +    NULL, /* domainGetJobInfo */
>  };
>  
>  
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 0e5f4a2..46e1221 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -11147,3 +11147,51 @@ error:
>      virDispatchError(conn);
>      return NULL;
>  }
> +
> +
> +/**
> + * virDomainGetJobInfo:
> + * @domain: a domain object
> + * @info: pointer to a virDomainJobInfo structure allocated by the user
> + *
> + * Extract information about progress of a background job on a domain.
> + * Will return an error if the domain is not active.
> + *
> + * Returns 0 in case of success and -1 in case of failure.
> + */
> +int
> +virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
> +{
> +    virConnectPtr conn;
> +    DEBUG("domain=%p, info=%p", domain, info);
> +
> +    virResetLastError();
> +
> +    if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
> +        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> +        virDispatchError(NULL);
> +        return (-1);
> +    }
> +    if (info == NULL) {
> +        virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
> +        goto error;
> +    }
> +
> +    memset(info, 0, sizeof(virDomainJobInfo));
> +
> +    conn = domain->conn;
> +
> +    if (conn->driver->domainGetJobInfo) {
> +        int ret;
> +        ret = conn->driver->domainGetJobInfo (domain, info);
> +        if (ret < 0)
> +            goto error;
> +        return ret;
> +    }
> +
> +    virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
> +
> +error:
> +    virDispatchError(domain->conn);
> +    return -1;
> +}
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 152aae4..6997b7b 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -354,6 +354,7 @@ LIBVIRT_0.7.7 {
>          virDomainAttachDeviceFlags;
>          virDomainDetachDeviceFlags;
>          virConnectBaselineCPU;
> +        virDomainGetJobInfo;
>  } LIBVIRT_0.7.5;

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]