]> git.ipfire.org Git - thirdparty/libvirt.git/commit
tools: console: pass stream/fd errors to user
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Thu, 14 Feb 2019 14:41:21 +0000 (17:41 +0300)
committerNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Thu, 4 Apr 2019 07:36:04 +0000 (10:36 +0300)
commit29f2b5248c6d19d9df91b49358c2877a0627d708
tree35afb787e629d1e21f6d801aadd9ee6d8311f8b3
parent4525de73569a0f662e12ce9fa3705be45947594e
tools: console: pass stream/fd errors to user

If the console was disconnected due to a connection problem or a problem on the
server side it is convinient to provide the cause to the user. If the error
come from the API then the error is saved in a virsh global variable. However,
since success is returned from virshRunConsole after we reach the waiting stage,
then the error is never reported. Let's track the error in the event loop.

Next after failure we do a cleanup and this cleanup can overwrite
root cause. Thus let's save root cause immediately and then set it to
virsh error after all cleanup is done.

Since we'll be sending the error to the consumer, each failure path from
the event handlers needs to be augmented to provide what error generated
the failure.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
tools/virsh-console.c