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

Re: [libvirt] [PATCH v2 1/5] Public virDomainMigrateSetMaxDowntime API



On Thu, Mar 18, 2010 at 08:12:44PM +0100, Jiri Denemark wrote:
> ---
>  include/libvirt/libvirt.h.in |    4 +++
>  src/libvirt.c                |   49 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |    5 ++++
>  3 files changed, 58 insertions(+), 0 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 0d1b5b5..d983e5f 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -408,6 +408,10 @@ int virDomainMigrateToURI (virDomainPtr domain, const char *duri,
>                             unsigned long flags, const char *dname,
>                             unsigned long bandwidth);
>  
> +int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
> +                                    unsigned long long downtime,
> +                                    unsigned int flags);
> +
>  /**
>   * VIR_NODEINFO_MAXCPUS:
>   * @nodeinfo: virNodeInfo instance
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 1d9b878..07837a3 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -11265,3 +11265,52 @@ error:
>      virDispatchError(conn);
>      return -1;
>  }
> +
> +
> +/**
> + * virDomainMigrateSetMaxDowntime:
> + * @domain: a domain object
> + * @downtime: maximum tolerable downtime for live migration, in nanoseconds
> + * @flags: fine-tuning flags, currently unused, use 0

  We discussed that previously, obviously the nanosecond accuracy is
not expected but most uses of durations in the API now use nanoseconds
and after all it's better to have something too fine grained than
too coarse there

> + * Sets maximum tolerable time for which the domain is allowed to be paused
> + * at the end of live migration. It's supposed to be called while the domain is
> + * being live-migrated as a reaction to migration progress.
> + *
> + * Returns 0 in case of success, -1 otherwise.
> + */
> +int
> +virDomainMigrateSetMaxDowntime(virDomainPtr domain,
> +                               unsigned long long downtime,
> +                               unsigned int flags)
> +{
> +    virConnectPtr conn;
> +
> +    DEBUG("domain=%p, downtime=%llu, flags=%u", domain, downtime, flags);
> +
> +    virResetLastError();
> +
> +    if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
> +        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> +        virDispatchError(NULL);
> +        return -1;
> +    }
> +
> +    conn = domain->conn;
> +    if (conn->flags & VIR_CONNECT_RO) {
> +        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
> +        goto error;
> +    }
> +
> +    if (conn->driver->domainMigrateSetMaxDowntime) {
> +        if (conn->driver->domainMigrateSetMaxDowntime(domain, downtime, flags) < 0)
> +            goto error;
> +        return 0;
> +    }
> +
> +    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
> +
> +error:
> +    virDispatchError(conn);
> +    return -1;
> +}
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 64e7505..6ed79d0 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -358,4 +358,9 @@ LIBVIRT_0.7.7 {
>  	virDomainAbortJob;
>  } LIBVIRT_0.7.5;
>  
> +LIBVIRT_0.7.8 {
> +    global:
> +        virDomainMigrateSetMaxDowntime;
> +} LIBVIRT_0.7.7;
> +
>  # .... define new API here using predicted next version number ....

  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]