File 704dfd6b-block-job.patch of Package libvirt.11696
commit 704dfd6b0fafe7eafca93a03793389239f8ab869
Author: Michael Chapman <mike@very.puzzling.org>
Date: Wed Jan 27 13:24:51 2016 +1100
virsh: avoid unnecessary progress updates
There is no need to call virshPrintJobProgress() unless the block job's
cur or end cursors have changed since the last iteration.
Signed-off-by: Michael Chapman <mike@very.puzzling.org>
Index: libvirt-1.2.18.4/tools/virsh-domain.c
===================================================================
--- libvirt-1.2.18.4.orig/tools/virsh-domain.c
+++ libvirt-1.2.18.4/tools/virsh-domain.c
@@ -1846,7 +1846,7 @@ vshBlockJobWait(vshBlockJobWaitDataPtr d
unsigned int abort_flags = 0;
int ret = -1;
- virDomainBlockJobInfo info;
+ virDomainBlockJobInfo info, last;
int result;
if (!data)
@@ -1869,6 +1869,8 @@ vshBlockJobWait(vshBlockJobWaitDataPtr d
return -1;
}
+ last.cur = last.end = 0;
+
while (true) {
pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask);
result = virDomainGetBlockJobInfo(data->dom, data->dev, &info, 0);
@@ -1900,8 +1902,9 @@ vshBlockJobWait(vshBlockJobWaitDataPtr d
goto cleanup;
}
- if (data->verbose)
+ if (data->verbose && (info.cur != last.cur || info.end != last.end))
vshPrintJobProgress(data->job_name, info.end - info.cur, info.end);
+ last = info;
if (data->timeout && virTimeMillisNow(&curr) < 0) {
vshSaveLibvirtError();