mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
virsh: Fix Ctrl-C behavior when watching a job
When watching a job (save, managedsave, dump, migrate) virsh spawns a thread to call the appropriate API and waits for the result while watching for interruption signals (SIGINT, Ctrl-C on the terminal). Whenever such signal is caught, virsh calls virDomainAbortJob, stops waiting for the job, and returns the result of virDomainAbortJob. This is wrong because the job might have finished in the meantime or it might have been cancelled by someone else and virsh would just report the failure to abort the job. However, we are not interested in the virDomainAbortJob's result at all, we need to keep waiting for the main job to finish and report its result instead. https://bugzilla.redhat.com/show_bug.cgi?id=1131755 Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
f4c67f0794
commit
e9507fd41c
@ -4207,12 +4207,9 @@ vshWatchJob(vshControl *ctl,
|
||||
if (ret > 0) {
|
||||
if (pollfd[1].revents & POLLIN &&
|
||||
saferead(STDIN_FILENO, &retchar, sizeof(retchar)) > 0) {
|
||||
if (vshTTYIsInterruptCharacter(ctl, retchar)) {
|
||||
if (vshTTYIsInterruptCharacter(ctl, retchar))
|
||||
virDomainAbortJob(dom);
|
||||
goto cleanup;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pollfd[0].revents & POLLIN &&
|
||||
@ -4232,9 +4229,8 @@ vshWatchJob(vshControl *ctl,
|
||||
if (intCaught) {
|
||||
virDomainAbortJob(dom);
|
||||
intCaught = 0;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user