On Mon, Apr 16, 2012 at 23:05:54 -0600, Eric Blake wrote:
I'm tired of shell-scripting to wait for completion of a block
pull,
when virsh can be taught to do the same. I couldn't quite reuse
vshWatchJob, as this is not a case of a long-running command where
a second thread must be used to probe job status (at least, not unless
I make virsh start doing blocking waits for an event to fire), but it
served as inspiration for my simpler single-threaded loop. There is
up to a half-second delay between sending SIGINT and the job being
aborted, but I didn't think it worth the complexity of a second thread
and use of poll() just to minimize that delay.
* tools/virsh.c (cmdBlockPull): Add new options to wait for
completion.
(blockJobImpl): Add argument.
(cmdBlockJob): Adjust caller.
* tools/virsh.pod (blockjob): Document new mode.
---
was independent patch previously
v5: address review comments, add an --async flag
tools/virsh.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
tools/virsh.pod | 14 +++++-
2 files changed, 127 insertions(+), 7 deletions(-)
Looks good and .5-second delay is a big issue. And if it is, we can improve
the implementation in the future. ACK, this can be pushed independently as
well.
Jirka