[libvirt] [libvirt-glib] Add gvir_domain_open_graphics_fd()

Daniel P. Berrange berrange at redhat.com
Wed Nov 19 12:41:51 UTC 2014


On Wed, Nov 19, 2014 at 12:08:21PM +0000, Zeeshan Ali (Khattak) wrote:
> On Wed, Nov 19, 2014 at 11:00 AM, Christophe Fergeau
> <cfergeau at redhat.com> wrote:
> > On Wed, Nov 19, 2014 at 01:19:31AM +0000, Zeeshan Ali (Khattak) 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,
> >
> > Could/should this take a GVirConfigDomainGraphics * instead and infer
> > the index from it?
> > I know gvir_domain-open_graphics() uses 'idx', but maybe we should offer
> > the 2 variants?
> 
> Doesn't sound very convenient and also I don't think the API
> guarantees the order of devices returned from
> gvir_config_domain_get_devices.

If we don't already, we should *explicitly* guarantee that the order of
devices returned by gvir_config_domain_get_devices 100% matches the
order they appeared in the XML document.  The ordering is sensitive
when considering things like BIOS disk boot priority, so we must take
extra care not to disturb ordering.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list