[libvirt] [PATCH 4/7] Add support for multiple consoles in LXC
Eric Blake
eblake at redhat.com
Wed Nov 2 20:46:50 UTC 2011
On 10/20/2011 08:47 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> Currently the LXC controller only supports setup of a single
> text console. This is wired up to the container init's stdio,
> as well as /dev/console and /dev/tty1. Extending support for
> multiple consoles, means wiring up additional PTYs to /dev/tty2,
> /dev/tty3, etc, etc. The LXC controller is passed multiple open
> file handles, one for each console requested.
>
> * src/lxc/lxc_container.c, src/lxc/lxc_container.h: Wire up
> all the /dev/ttyN links required to symlink to /dev/pts/NN
> * src/lxc/lxc_container.h: Open more container side /dev/pts/NN
> devices, and adapt event loop to handle I/O from all consoles
> * src/lxc/lxc_driver.c: Setup multiple host side PTYs
> ---
> src/lxc/lxc_container.c | 81 +++++++++++++++---------
> src/lxc/lxc_container.h | 3 +-
> src/lxc/lxc_controller.c | 160 +++++++++++++++++++++++++++++-----------------
> src/lxc/lxc_driver.c | 62 +++++++++++-------
> 4 files changed, 191 insertions(+), 115 deletions(-)
>
> @@ -891,10 +900,9 @@ cleanup:
> virMutexDestroy(&lock);
> signal(SIGCHLD, SIG_DFL);
> cleanup2:
> - VIR_FORCE_CLOSE(console.hostFd);
> - VIR_FORCE_CLOSE(console.contFd);
> VIR_FORCE_CLOSE(monitor.serverFd);
> VIR_FORCE_CLOSE(monitor.clientFd);
> + VIR_FREE(consoles);
The old code was closing all fds; should the new code be iterating over
consoles and freeing both fd members per consoles[i]?
> @@ -1677,26 +1681,34 @@ static int lxcVmStart(virConnectPtr conn,
> return -1;
> }
>
> - /* open parent tty */
> - if (virFileOpenTty(&parentTty,&parentTtyPath, 1)< 0) {
> - virReportSystemError(errno, "%s",
> - _("Failed to allocate tty"));
> + /* Here we open all the PTYs we need on the host OS side.
> + * The LXC controller will open the guest OS side PTYs
> + * forward I/O between them.
s/forward/and forward/
ACK with those points fixed.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list