提交 4c297728 编写于 作者: E Eric Blake

virsh: nicer abort of blockcopy

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: NEric Blake <eblake@redhat.com>
上级 ba510abf
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册