tacho / conman

Automatically exported from code.google.com/p/conman
GNU General Public License v3.0
1 stars 0 forks source link

error connecting to virsh console: unable to get tty attributes #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Enable a serial console on a kvm virtual machine.  Then edit conman.conf to 
access this console through libvirt:

  console name="foo" dev="/usr/bin/virsh console foo"

What is the expected output? What do you see instead?

Instead of successfully spawning a "virsh console" process that the client can 
interact with, the following output is observed in the console log for foo:

<ConMan> Console [foo] connected to "virsh" (pid 23456) at 06-10 12:34.
12:34:56.789: error : vshRunConsole:88 : unable to get tty attributes: Invalid 
argument
Connected to domain foo
Escape character is ^]
<ConMan> Console [foo] disconnected from "virsh" (pid 23456) after 0s at 06-10 
12:34.

What version of the software are you using? On what operating system?

conman-0.2.5
libvirt-bin-0.8.1-1 (Debian Squeeze)

Please provide any additional information below.

The virsh error is triggered by a failed call to 
tcgetattr(STDIN_FILENO,&ttyattr) in libvirt-0.8.1/tools/console.c.

Original issue reported on code.google.com by chris.m.dunlap on 10 Jun 2010 at 9:27

GoogleCodeExporter commented 9 years ago
So yeah.  Any progress on this one?  Any work-arounds to give virsh the tty it 
thinks it wants?

Original comment by br...@whamcloud.com on 5 Sep 2012 at 3:14

GoogleCodeExporter commented 9 years ago
I haven't made any progress on this yet.  I'd like to get 0.2.8 released before 
too much longer.  I need to set aside some time to finish that.  If there's 
time, I'll try to work this into 0.2.8.

Original comment by chris.m.dunlap on 5 Sep 2012 at 7:22

GoogleCodeExporter commented 9 years ago
I actually managed to get a little something working here.  I created a script 
I call "vcon":

#!/bin/bash

vm=$1

pty=$(virsh ttyconsole $vm)
#socat - $pty,raw,echo=0,crnl
exec socat - $pty,echo=0,ocrnl=1

and then configure conman to use that with the virtual machine name to connect 
to it's console.  I am not at all convinced this survives through a virsh 
destroy ...; virsh start ....  I usually just retstart conman when I restart a 
VM (which is almost never with any luck).

Any advise on how to make that more elegant with conman?  Should vcon block if 
the virtual machine is not up or is there some way for vcon to indicate to 
conman that it cannot connect to the machine such that conman will periodically 
retry?  Or some other way to prod conman?

Original comment by br...@whamcloud.com on 5 Sep 2012 at 7:26

GoogleCodeExporter commented 9 years ago
Oh, and I'm not positive the ocrnl=1 is actually needed.  I had it in there 
debugging something else and just forgot to remove it.  Feel free to season 
according to taste.

Original comment by br...@whamcloud.com on 5 Sep 2012 at 7:30

GoogleCodeExporter commented 9 years ago
As for vcon, the easy thing to do is just exit if the console is not up.  
conmand will immediately restart external processes that terminate.  If the new 
process immediately terminates, conmand will wait 1min before the next retry, 
followed by an exponential backoff up to a maximum of 30min between retries 
until the process survives for at least a minute (at which point the reconnect 
timer is set back to 0).

Original comment by chris.m.dunlap on 6 Sep 2012 at 12:22