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

Re: [libvirt] [PATCH 1/5] Introduce virDomainResumeFlags API



On 11/05/14 13:35, Michal Privoznik wrote:
> The old DomainResume API lacks flags argument. This is
> unfortunate, because there may exist some use cases
> where an additional work could be done on domain
> resume. However, without flags it's not possible.
> 
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  include/libvirt/libvirt-domain.h |  2 ++
>  src/driver-hypervisor.h          |  5 +++++
>  src/libvirt-domain.c             | 44 ++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms          |  5 +++++
>  src/remote/remote_driver.c       |  1 +
>  src/remote/remote_protocol.x     | 13 +++++++++++-
>  src/remote_protocol-structs      |  5 +++++
>  7 files changed, 74 insertions(+), 1 deletion(-)
> 


> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 7dc3146..6dcb9ef 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -693,6 +693,50 @@ virDomainResume(virDomainPtr domain)
>  
>  
>  /**
> + * virDomainResumeFlags:
> + * @domain: a domain object
> + * @flags: extra flags; not used yet, so callers should always pass 0
> + *
> + * Resume a suspended domain, the process is restarted from the state where
> + * it was frozen by calling virDomainSuspend().
> + * This function may require privileged access
> + * Moreover, resume may not be supported if domain is in some
> + * special state like VIR_DOMAIN_PMSUSPENDED.
> + *
> + * Returns 0 in case of success and -1 in case of failure.
> + */
> +int
> +virDomainResumeFlags(virDomainPtr domain,
> +                     unsigned int flags)
> +{
> +    virConnectPtr conn;
> +
> +    VIR_DOMAIN_DEBUG(domain);
> +
> +    virResetLastError();
> +
> +    virCheckDomainReturn(domain, -1);
> +    conn = domain->conn;
> +
> +    virCheckReadOnlyGoto(conn->flags, error);
> +
> +    if (conn->driver->domainResumeFlags) {
> +        int ret;
> +        ret = conn->driver->domainResumeFlags(domain, flags);
> +        if (ret < 0)
> +            goto error;
> +        return ret;
> +    }
> +
> +    virReportUnsupportedError();
> +
> + error:
> +    virDispatchError(domain->conn);
> +    return -1;
> +}
> +
> +
> +/**
>   * virDomainPMSuspendForDuration:
>   * @dom: a domain object
>   * @target: a value from virNodeSuspendTarget
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 5f95802..2daff56 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -684,4 +684,9 @@ LIBVIRT_1.2.9 {
>          virNodeAllocPages;
>  } LIBVIRT_1.2.8;
>  
> +LIBVIRT_1.2.10 {

It's 1.2.11 already.

> +    global:
> +        virDomainResumeFlags;
> +} LIBVIRT_1.2.9;
> +
>  # .... define new API here using predicted next version number ....
> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> index 65c04d9..3dc1c8f 100644
> --- a/src/remote/remote_driver.c
> +++ b/src/remote/remote_driver.c
> @@ -8240,6 +8240,7 @@ static virHypervisorDriver hypervisor_driver = {
>      .connectGetDomainCapabilities = remoteConnectGetDomainCapabilities, /* 1.2.7 */
>      .connectGetAllDomainStats = remoteConnectGetAllDomainStats, /* 1.2.8 */
>      .nodeAllocPages = remoteNodeAllocPages, /* 1.2.9 */
> +    .domainResumeFlags = remoteDomainResumeFlags, /* 1.2.10 */

Same here.

>  };
>  
>  static virNetworkDriver network_driver = {

Looks reasonable. ACK, but please hold off the push until we agree on
the need of this (see Re: 4/5, 5/5 of this series)

Peter

Attachment: signature.asc
Description: OpenPGP digital signature


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