[virt-tools-list] [virt-manager][PATCH] Fix progres bar output bug in virt-clone.

lagarcia at linux.vnet.ibm.com lagarcia at linux.vnet.ibm.com
Sun Jun 9 19:19:35 UTC 2013


From: Leonardo Garcia <lagarcia at br.ibm.com>

The loop in StorageVolume._progress_thread that updates the cloning progress
bar has a call to sleep in the beginning of the loop which causes issues with
the progress bar. An example output (shorten to use less columns) with the
problem:

[laggarcia at fedora18 virt-manager]$ ./virt-clone --connect
qemu+ssh://root@192.168.122.1/system --original=Fedora18-test --auto-clone
root at 192.168.122.1's password:
Allocating 'Fedora18-test-clone.img'                                  |  20 GB  00:00:56

Clone 'Fedora18-test-clone' created successfully.
[laggarcia at fedora18 virt-manager]$ '    4% [===-     ] -300039887.4 B/s | 881 MB  --:--:-- ETA

As the StorageVolume._progress_thread sleeps for one second when the loop
starts, it might occur that, when the cloning procedure finishes, the loop is
still awaiting to update the progress bar, which will cause a bad progress bar
update.

This simple fix solves this issue.
---
 virtinst/Storage.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/virtinst/Storage.py b/virtinst/Storage.py
index 54ee631..b29532a 100644
--- a/virtinst/Storage.py
+++ b/virtinst/Storage.py
@@ -1279,9 +1279,9 @@ class StorageVolume(StorageObject):
             return
 
         while not self._install_finished:
-            time.sleep(1)
             ignore, ignore, alloc = vol.info()
             meter.update(alloc)
+            time.sleep(1)
 
 
     def is_size_conflict(self):
-- 
1.7.1




More information about the virt-tools-list mailing list