I attempted 'virsh blockcopy $dom vda $path --wait --verbose', then hit Ctrl-C; I was a bit surprised to see this error message: Block Copy: [ 3 %]error: failed to query job for disk vda when I had been expecting: Block Copy: [ 3 %] Copy aborted * tools/virsh-domain.c (cmdBlockCopy): Print graceful exit message rather than error when ctrl-c interrupts job. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- tools/virsh-domain.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8cafce4..4081451 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1810,10 +1810,13 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) result = virDomainGetBlockJobInfo(dom, path, &info, 0); pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); - if (result <= 0) { + if (result < 0) { vshError(ctl, _("failed to query job for disk %s"), path); goto cleanup; } + if (result == 0) + break; + if (verbose) print_job_progress(_("Block Copy"), info.end - info.cur, info.end); if (info.cur == info.end) @@ -1840,13 +1843,14 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) } } - if (pivot) { + if (!quit && pivot) { abort_flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT; if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) { vshError(ctl, _("failed to pivot job for disk %s"), path); goto cleanup; } - } else if (finish && virDomainBlockJobAbort(dom, path, abort_flags) < 0) { + } else if (finish && !quit && + virDomainBlockJobAbort(dom, path, abort_flags) < 0) { vshError(ctl, _("failed to finish job for disk %s"), path); goto cleanup; } -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list