Re: [libvirt-glib] Add gvir_domain_open_graphics_fd()

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

 



This API was added recently, in libvirt v1.2.8. You should either
change libvirt-glib dependency or add a fallback using
virDomainOpenGraphics, dating back from v0.9.7.

Also, it would be nice to have Since: flags in the docs. Looks good otherwise.

On Wed, Nov 19, 2014 at 2:19 AM, Zeeshan Ali (Khattak)
<zeeshanak@xxxxxxxxx> wrote:
> Add binding for virDomainOpenGraphicsFD.
> ---
>  libvirt-gobject/libvirt-gobject-domain.c | 36 ++++++++++++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain.h |  4 ++++
>  libvirt-gobject/libvirt-gobject.sym      |  5 +++++
>  3 files changed, 45 insertions(+)
>
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 8df30d7..9c1aa6e 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -1222,6 +1222,42 @@ cleanup:
>  }
>
>  /**
> + * gvir_domain_open_graphics_fd:
> + * @dom: the domain
> + * @idx: the graphics index
> + * @flags: extra flags, currently unused
> + *
> + * This will create a socket pair connected to the graphics backend of @dom. One
> + * end of the socket will be returned on success, and the other end is handed to
> + * the hypervisor. If @dom has multiple graphics backends configured, then @idx
> + * will determine which one is opened, starting from @idx 0.
> + *
> + * Returns: An fd on success, -1 on failure.
> + */
> +int gvir_domain_open_graphics_fd(GVirDomain *dom,
> +                                 guint idx,
> +                                 unsigned int flags,
> +                                 GError **err)
> +{
> +    GVirDomainPrivate *priv;
> +    int ret = -1;
> +
> +    g_return_val_if_fail(GVIR_IS_DOMAIN(dom), -1);
> +    g_return_val_if_fail(err == NULL || *err == NULL, -1);
> +
> +    priv = dom->priv;
> +
> +    ret = virDomainOpenGraphicsFD(priv->handle, idx, flags);
> +    if (ret <= 0) {
> +        gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
> +                               0,
> +                               "Unable to open graphics");
> +    }
> +
> +    return ret;
> +}
> +
> +/**
>   * gvir_domain_suspend:
>   * @dom: the domain to suspend
>   * @err: Place-holder for possible errors
> diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
> index 47ed784..4fe381e 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.h
> +++ b/libvirt-gobject/libvirt-gobject-domain.h
> @@ -332,6 +332,10 @@ gboolean gvir_domain_open_graphics(GVirDomain *dom,
>                                     int fd,
>                                     unsigned int flags,
>                                     GError **err);
> +int gvir_domain_open_graphics_fd(GVirDomain *dom,
> +                                 guint idx,
> +                                 unsigned int flags,
> +                                 GError **err);
>
>  gboolean gvir_domain_suspend (GVirDomain *dom,
>                                GError **err);
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index d18769b..927cad9 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -260,4 +260,9 @@ LIBVIRT_GOBJECT_0.1.9 {
>         gvir_stream_io_condition_get_type;
>  } LIBVIRT_GOBJECT_0.1.5;
>
> +LIBVIRT_GOBJECT_0.2.0 {
> +  global:
> +       gvir_domain_open_graphics_fd;
> +} LIBVIRT_GOBJECT_0.1.9;
> +
>  # .... define new API here using predicted next version number ....
> --
> 2.1.0
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list



-- 
Marc-André Lureau

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]