]> xenbits.xensource.com Git - libvirt.git/commit
cmdMigrate: move vshConnect before vshWatchJob
authorChunyan Liu <cyliu@suse.com>
Fri, 8 Aug 2014 08:44:36 +0000 (16:44 +0800)
committerJán Tomko <jtomko@redhat.com>
Tue, 19 Aug 2014 09:32:51 +0000 (11:32 +0200)
commit7eabd5503e3de147b703c1a1e6dff81cdc46d1e7
tree9346f486eb6f397cd9e9c4db97173c7346c24144
parent337a1362824d29733f61778fc8e2a5f1d3fa9f09
cmdMigrate: move vshConnect before vshWatchJob

A possible fix to issue:
http://www.redhat.com/archives/libvir-list/2014-August/thread.html#00227

While doing migration on KVM host, found problem sometimes:
VM is already running on the target host and disappears from source
host, but 'virsh migrate' command line hangs, cannot exit normally.
If pressing "ENTER" key, it will exit.

The code hangs at tools/virsh-domain.c: cmdMigrate
->vshWatchJob->poll():
poll() is trying to select pipe_fd, which is used to receive message
from doMigrate thread. In debugging, found that doMigrate finishes
and at the end it does call safewrite() to write the retval ('0' or
'1') to pipe_fd, and the write is completed. But cmdMigrate poll()
cannot get the event. If pressing "ENTER" key, poll() can get the
event and select pipe_fd, then command line can exit.

In current code, authentication thread which is called by vshConnect
will use stdin, and at the same time, in cmdMigrate main process,
poll() is listening to stdin, that probably affect poll() to get
pipe_fd event. Better to move authentication before vshWatchJob. With
this change, above problem does not exist.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
tools/virsh-domain.c
tools/virsh.h