[libvirt] [PATCH 08/10] Re-write virsh console to use streams

Daniel P. Berrange berrange at redhat.com
Tue Nov 2 17:51:57 UTC 2010


On Mon, Nov 01, 2010 at 03:55:08PM -0600, Eric Blake wrote:
> On 11/01/2010 10:12 AM, Daniel P. Berrange wrote:
> > This re-writes the 'virsh console' command so that it uses
> > the new streams API. This lets it run remotely and/or as a
> > non-root user. This requires that virsh be linked against
> > the simple event loop from libvirtd in daemon/event.c
> > As an added bonus, it can now connect to any console device,
> > not just the first one.
> > 
> > * tools/Makefile.am: Link to event.c
> > * tools/console.c, tools/console.h: Rewrite to use the
> >   virDomainOpenConsole() APIs with streams
> > * tools/virsh.c: Support choosing the console name
> >   via --devname $NAME
> > ---
> >  .x-sc_avoid_write |    1 +
> >  tools/Makefile.am |    1 +
> >  tools/console.c   |  330 ++++++++++++++++++++++++++++++++++++++++-------------
> >  tools/console.h   |    2 +-
> >  tools/virsh.c     |   76 ++++---------
> 
> tools/virsh.pod changes?
> 
> > +        if (con->terminalToStream.data[con->terminalToStream.offset] == CTRL_CLOSE_BRACKET) {
> > +            con->quit = true;
> > +            return;
> > +        }
> 
> Is there any way to type an escape sequence, such as ^v in common stty
> usage, in order to allow sending a literal ^] through to the console
> instead of always making it quit?

Not at this time. This was also true of the old impl, so not a regression

> 
> >  
> > +    if (con) {
> > +        if (con->st)
> > +            virStreamFree(con->st);
> 
> Should virStreamFree tolerate a NULL argument, at which point it should
> be added to the list in cfg.mk of free()-like functions that should not
> have an extra if() preceding usage?

Our public APIs all raise an error if you pass NULL to any of the
virXXXXXFree() APIs.

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list