mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
ba510abfd7
commit
4c29772845
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user