[lxc-devel] [PATCH] console API improvements

Dwight Engen dwight.engen at oracle.com
Mon Jun 10 23:10:28 UTC 2013


On Mon, 10 Jun 2013 17:18:03 -0500
Serge Hallyn <serge.hallyn at ubuntu.com> wrote:

> Quoting Dwight Engen (dwight.engen at oracle.com):
> > On Mon, 10 Jun 2013 15:49:07 -0500
> > Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> > 
> > > Quoting Dwight Engen (dwight.engen at oracle.com):
> > > > On Mon, 10 Jun 2013 14:55:08 -0500
> > > > Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> > > > 
> > > > > Quoting Dwight Engen (dwight.engen at oracle.com):
> > > > > > Add a higher level console API that opens a tty/console and
> > > > > > runs the mainloop as well. Rename existing API to
> > > > > > console_getfd(). Use these in the python binding.
> > > > > > 
> > > > > > Allow attaching a console peer after container bootup,
> > > > > > including if the container was launched with -d. This is
> > > > > > made possible by allocation of a "proxy" pty as the peer
> > > > > > when the console is attached to.
> > > > > > 
> > > > > > Improve handling of SIGWINCH, the pty size will be correctly
> > > > > > set at the beginning of a session and future changes when
> > > > > > using the lxc_console() API will be propagated to it as
> > > > > > well.
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > we're hitting on black magic here as far as I'm concerned -
> > > > > but I can verify that with this patch, 'sudo lxc-console -n
> > > > > container -t 0' gives me the right size (per stty -a) on
> > > > > console which never happened before. However, if I then
> > > > > resize my xterm, I have to disconnect and reconnect the
> > > > > console to get the new size.  Is that expected?
> > > > 
> > > > Hmm, its supposed to work when you resize as well. It does in my
> > > > (xfce) Terminal session (both stty -a and the shell updated
> > > > $LINES and $COLUMNS). It also worked from the simple python
> > > > around vte exmaple, that was in the patch, but that is pretty
> > > > much the same as Terminal (or gnome-terminal I would think)
> > > > since they are all based on vte.
> > > > 
> > > > When you say xterm do you literally mean xterm or some other
> > > > newer Terminal emulator? Just wondering so I could look at it,
> > > > I wonder if SIGWINCH isn't getting there.
> > > 
> > > Weeeell, it was screen in mosh in gnome-terminal :)  But outside
> > > of the container stty -a was getting updated information.  I
> > > tried it both with lxc-console and python console API.  I can
> > > test natively inside an xterm tonight if it helps.
> > 
> > I couldn't reproduce it here: as root I ran gnome-terminal, then at
> > the prompt I did (mosh didn't like my LANG=C):
> > 
> > LANG=en_US.UTF-8
> > screen mosh <ip of container>
> > <login as root in container>
> > stty -a
> > <resize window>
> > stty -a
> > 
> > And the resize showed up for me. Not sure why its not working for
> > you, I'm guessing you are running it some other way because you
> > mentioned lxc-console and I'm a bit confused though as to the
> > relationship between mosh and lxc-console in your scenario :)
> > 
> > mosh is going to ssh into the container and get its own pty
> 
> Sorry, I was gnome-terminal on my laptop, from there mosh to connect
> to my server, ran screen on my server, and ran lxc-console from there.

Thanks for the scenario, I tried it here and it is working for me (ie.
gnome-terminal, mosh to server, then screen lxc-console -n <ct> -t 0,
then resize gnome-terminal). I did see something else though far more
concerning: in this scenario resizing the gnome-terminal made lxc-start
appear to hang, I gdb'ed it and it was stuck on the read() in
start.c:signal_handler. Doing a kill on lxc-start 'un-hung' it, but
something is not right, so I'll look into it.

> -serge




More information about the lxc-devel mailing list