]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Improve error reporting when virsh console is run without a TTY
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 15 Feb 2012 13:12:11 +0000 (13:12 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 24 Feb 2012 16:43:26 +0000 (16:43 +0000)
commitaf6b61ba06002239fad248e88553b437e538b5c4
tree1b59216b0ce9ad4a48eee02f43ec341c460409ff
parenteda0fc7a823c4053548a3f1dc1b02eea5e8a8b14
Improve error reporting when virsh console is run without a TTY

If attempting to run

  ssh root@somehost virsh console someguest

You'll get an error

  2012-02-15 13:11:47.683+0000: 4765: info : libvirt version: 0.9.10, package: 1.fc18 (Unknown, 2012-02-15-11:48:57, lettuce.camlab.fab.redhat.com)
  2012-02-15 13:11:47.683+0000: 4765: error : vshRunConsole:320 : unable to get tty attributes: Invalid argument
  Connected to domain f16x86_64
  Escape character is ^]

There are several problems here

 - The actual error message is bad for users
 - We shouldn't rely on VIR_ERROR for this case
 - The prompt makes it look like we still connected
   because we didn't flush stdout.

* virsh.c: Flush stdout before starting console and check
  for a valid tty
tools/virsh.c