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

Re: [libvirt] [PATCH 1/3] Introduce virDomainOpenGraphicsFD API



On 08/25/14 20:22, Ján Tomko wrote:
> Define the public API implementation and declare internal
> driver prototype.
> ---
>  include/libvirt/libvirt.h.in |  5 ++++
>  src/driver.h                 |  7 ++++++
>  src/libvirt.c                | 58 ++++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |  5 ++++
>  4 files changed, 75 insertions(+)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 47ea695..153b386 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in

> diff --git a/src/libvirt.c b/src/libvirt.c
> index 8349261..9de1e44 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -20182,6 +20182,64 @@ virDomainOpenGraphics(virDomainPtr dom,
>  
>  
>  /**
> + * virDomainOpenGraphicsFD:
> + * @dom: pointer to domain object
> + * @idx: index of graphics config to open
> + * @fd: returned file descriptor
> + * @flags: bitwise-OR of virDomainOpenGraphicsFlags
> + *
> + * This will create a socket pair connected to the graphics backend of @dom.
> + * One pair will be returned as @fd.

You return just one fd, so:

"One element will be "

Or perhaps

"One socket .. " ?

> + * If @dom has multiple graphics backends configured, then @idx will determine
> + * which one is opened, starting from @idx 0.
> + *
> + * To disable any authentication, pass the VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
> + * constant for @flags.
> + *
> + * This method can only be used when connected to a local
> + * libvirt hypervisor, over a UNIX domain socket. Attempts
> + * to use this method over a TCP connection will always fail
> + *
> + * Returns 0 on success, -1 on failure
> + */
> +int
> +virDomainOpenGraphicsFD(virDomainPtr dom,
> +                        unsigned int idx,
> +                        int *fd,
> +                        unsigned int flags)
> +{
> +    VIR_DOMAIN_DEBUG(dom, "idx=%u, fd=%p, flags=%x",
> +                     idx, fd, flags);
> +
> +    virResetLastError();
> +
> +    virCheckDomainReturn(dom, -1);
> +    virCheckNonNullArgGoto(fd, error);
> +
> +    virCheckReadOnlyGoto(dom->conn->flags, error);
> +
> +    if (!VIR_DRV_SUPPORTS_FEATURE(dom->conn->driver, dom->conn,
> +                                  VIR_DRV_FEATURE_FD_PASSING)) {
> +        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +                       _("fd passing is not supported by this connection"));
> +        goto error;
> +    }
> +
> +    if (dom->conn->driver->domainOpenGraphicsFD) {
> +        int ret;
> +        ret = dom->conn->driver->domainOpenGraphicsFD(dom, idx, fd, flags);
> +        if (ret < 0)
> +            goto error;
> +        return ret;
> +    }
> +
> +    virReportUnsupportedError();
> +
> + error:
> +    virDispatchError(dom->conn);
> +    return -1;
> +}
> +/**
>   * virConnectSetKeepAlive:
>   * @conn: pointer to a hypervisor connection
>   * @interval: number of seconds of inactivity before a keepalive message is sent

No other objections from my side.

I think this is a nice inversion of the virDomainOpenGraphics API. As
this approach was suggested by DanPB I'm happy to give an

ACK (with docs tweaked of course)

Peter

Attachment: signature.asc
Description: OpenPGP digital signature


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