[libvirt] [PATCH] Ensure stream is aborted when exiting console
Dave Allan
dallan at redhat.com
Mon Aug 15 18:19:27 UTC 2011
On Mon, Aug 15, 2011 at 10:12:54AM -0700, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> After running 'virsh console' in interactive mode, there was a
> missing call to virStreamAbort, which meant the server kept the
> stream resources open
The combination of this patch and the other stream related patch makes
the problem I was seeing of garbled console following multiple console
connect/disconnects go away, but another problem remains in this area.
After connecting to the console in interactive virsh and
disconnecting, I often see all subsequent commands fail:
virsh # dominfo foo
error: failed to get domain 'foo'
error: An error occurred, but the cause is unknown
virsh # dominfo foo
error: failed to get domain 'foo'
error: no call waiting for reply with prog 536903814 vers 1 serial 300
virsh # define bar.xml
error: Failed to define domain from bar.xml
error: no call waiting for reply with prog 536903814 vers 1 serial 301
Closing and reopening the interactive virsh session makes the problem
go away.
Powering down the guest while the console is connected has made the
problem 100% reproducible in the 4 or 5 tries I've given it.
Dave
> * tools/console.c: Abort stream when exiting
> ---
> tools/console.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/console.c b/tools/console.c
> index 171ebc9..82ef537 100644
> --- a/tools/console.c
> +++ b/tools/console.c
> @@ -90,9 +90,11 @@ static void
> virConsoleShutdown(virConsolePtr con)
> {
> con->quit = true;
> - virStreamEventRemoveCallback(con->st);
> - if (con->st)
> + if (con->st) {
> + virStreamEventRemoveCallback(con->st);
> + virStreamAbort(con->st);
> virStreamFree(con->st);
> + }
> if (con->stdinWatch != -1)
> virEventRemoveHandle(con->stdinWatch);
> if (con->stdoutWatch != -1)
> --
> 1.7.6
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
More information about the libvir-list
mailing list