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?
+ 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?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org