From: Leonardo Garcia <[email protected]>

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@fedora18 virt-manager]$ ./virt-clone --connect
qemu+ssh://[email protected]/system --original=Fedora18-test --auto-clone
[email protected]'s password:
Allocating 'Fedora18-test-clone.img'                                  |  20 GB  
00:00:56

Clone 'Fedora18-test-clone' created successfully.
[laggarcia@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

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to