From d1e6dc602b270583d6e3f93cb430be2e741217bd Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Wed, 1 Feb 2023 11:27:25 -0600 Subject: [PATCH] virt-manager-4.1.0-3.el9 - progress: Fix showing correct final total (rhbz#2156247) - virtinstall: Fix the allocating disk size printed by the progress bar (rhbz#2156247) - virtinstall: Hide total_size in the progress bar if it doesn't need (rhbz#2156247) Resolves: rhbz#2156247 --- ...ress-Fix-showing-correct-final-total.patch | 126 ++++++++++++++++++ ...isk-size-printed-by-the-progress-bar.patch | 39 ++++++ ...-the-progress-bar-if-it-doesn-t-need.patch | 87 ++++++++++++ virt-manager.spec | 10 +- 4 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 virt-manager-progress-Fix-showing-correct-final-total.patch create mode 100644 virt-manager-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch create mode 100644 virt-manager-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesn-t-need.patch diff --git a/virt-manager-progress-Fix-showing-correct-final-total.patch b/virt-manager-progress-Fix-showing-correct-final-total.patch new file mode 100644 index 0000000..aa2d231 --- /dev/null +++ b/virt-manager-progress-Fix-showing-correct-final-total.patch @@ -0,0 +1,126 @@ +From 3702eed072ae7b2d52398a3c9b1c1feb04ffdce3 Mon Sep 17 00:00:00 2001 +From: Cole Robinson +Date: Wed, 14 Dec 2022 12:57:10 -0500 +Subject: [PATCH] progress: Fix showing correct final total + +Reproducer: +Reproducer: +./virt-install --connect test:///default \ + --location tests/data/fakemedia/fake-f26-netinst.iso + +Before: +Starting install... +Retrieving 'vmlinuz' | 0 B 00:00:00 ... +Retrieving 'initrd.img' | 0 B 00:00:00 ... + +After: +Starting install... +Retrieving 'vmlinuz' | 9 B 00:00:00 ... +Retrieving 'initrd.img' | 9 B 00:00:00 ... + +progress.end() currently only reports the total amount of bytes +that were last written to the UI. It should report the total amount +that's been passed to update(). + +Reported-by: Toshiki Sonoda +Signed-off-by: Cole Robinson +(cherry picked from commit 4114fa1aa827b836d3a1d11c2ac2d367c9bb0463) + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2156247 + +Signed-off-by: Jonathon Jongsma +--- + tests/data/meter/meter1.txt | 2 +- + tests/data/meter/meter2.txt | 2 +- + tests/data/meter/meter3.txt | 2 +- + tests/data/meter/meter5.txt | 2 +- + tests/data/meter/meter6.txt | 2 +- + tests/test_misc.py | 4 +++- + virtinst/_progresspriv.py | 4 ++-- + 7 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/tests/data/meter/meter1.txt b/tests/data/meter/meter1.txt +index a3f7c7d2f..7e154c972 100644 +--- a/tests/data/meter/meter1.txt ++++ b/tests/data/meter/meter1.txt +@@ -9,4 +9,4 @@ Meter text test 20% [=== ] 413 B/s | 2.0 kB 00:19 ETA + + Meter text test 40% [======- ] 731 B/s | 3.9 kB 00:08 ETA + +-Meter text test | 3.9 kB 00:04 ... ++Meter text test | 4.4 kB 00:04 ... +diff --git a/tests/data/meter/meter2.txt b/tests/data/meter/meter2.txt +index 93e93dc31..7ccc31636 100644 +--- a/tests/data/meter/meter2.txt ++++ b/tests/data/meter/meter2.txt +@@ -9,4 +9,4 @@ Meter text test 20% [======= + + Meter text test 40% [============== ] 731 B/s | 3.9 kB 00:00:08 ETA + +-Meter text test | 3.9 kB 00:00:04 ... ++Meter text test | 4.4 kB 00:00:04 ... +diff --git a/tests/data/meter/meter3.txt b/tests/data/meter/meter3.txt +index 474e40f74..6f66608fe 100644 +--- a/tests/data/meter/meter3.txt ++++ b/tests/data/meter/meter3.txt +@@ -4,4 +4,4 @@ Meter text test 67 B/s | 200 B 00:02 + Meter text test 413 B/s | 2.0 kB 00:03 + Meter text test 731 B/s | 3.9 kB 00:04 + +-Meter text test | 3.9 kB 00:04 ++Meter text test | 4.4 kB 00:04 +diff --git a/tests/data/meter/meter5.txt b/tests/data/meter/meter5.txt +index 1d232a5de..7142a9718 100644 +--- a/tests/data/meter/meter5.txt ++++ b/tests/data/meter/meter5.txt +@@ -9,4 +9,4 @@ Meter text test 1000% [================] 413 B/s | 2.0 kB --:-- ETA + + Meter text test 2000% [================] 731 B/s | 3.9 kB --:-- ETA + +-Meter text test | 3.9 kB 00:04 !!! ++Meter text test | 4.4 kB 00:04 !!! +diff --git a/tests/data/meter/meter6.txt b/tests/data/meter/meter6.txt +index 07d99bfd8..dd5d3d47b 100644 +--- a/tests/data/meter/meter6.txt ++++ b/tests/data/meter/meter6.txt +@@ -9,4 +9,4 @@ Meter text test 100% [================] 413 B/s | 2.0 kB --:-- ETA + + Meter text test 100% [================] 731 B/s | 3.9 kB --:-- ETA + +-Meter text test | 3.9 kB 00:04 ++Meter text test | 4.4 kB 00:04 +diff --git a/tests/test_misc.py b/tests/test_misc.py +index aa610f4df..20f5a626b 100644 +--- a/tests/test_misc.py ++++ b/tests/test_misc.py +@@ -178,7 +178,9 @@ def test_misc_meter(): + m.update(2000) + with unittest.mock.patch("time.time", return_value=5.0): + m.update(4000) +- with unittest.mock.patch("time.time", return_value=6.0): ++ with unittest.mock.patch("time.time", return_value=5.1): ++ m.update(4500) ++ with unittest.mock.patch("time.time", return_value=5.5): + m.end() + + # Basic output testing +diff --git a/virtinst/_progresspriv.py b/virtinst/_progresspriv.py +index 5a31a18cc..a035c9c43 100644 +--- a/virtinst/_progresspriv.py ++++ b/virtinst/_progresspriv.py +@@ -112,10 +112,10 @@ class BaseMeter: + assert type(amount_read) is int + + now = time.time() ++ self.last_amount_read = amount_read ++ self.re.update(amount_read, now) + if (not self.last_update_time or + (now >= self.last_update_time + self.update_period)): +- self.re.update(amount_read, now) +- self.last_amount_read = amount_read + self.last_update_time = now + self._do_update(amount_read) + +-- +2.39.0 + diff --git a/virt-manager-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch b/virt-manager-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch new file mode 100644 index 0000000..1cd326f --- /dev/null +++ b/virt-manager-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch @@ -0,0 +1,39 @@ +From f68b3667591ab5f9edb9a40f9a7c0c798c923bc4 Mon Sep 17 00:00:00 2001 +From: Toshiki Sonoda +Date: Wed, 9 Nov 2022 18:33:56 +0900 +Subject: [PATCH] virtinstall: Fix the allocating disk size printed by the + progress bar + +When a sparse file is created during a disk allocation, +virt-install prints not the created disk size but a sparse file size. + +Therefore, we fix to print the created disk size during disk allocation +instead of the size of the sparse file by updating the meter with the +self.capacity. + +Signed-off-by: Toshiki Sonoda +Signed-off-by: Haruka Ohata +(cherry picked from commit 39c7a443146433766e4e71e48ab59145c74924b3) + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2156247 + +Signed-off-by: Jonathon Jongsma +--- + virtinst/storage.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/virtinst/storage.py b/virtinst/storage.py +index 509f5cb06..617b05e0d 100644 +--- a/virtinst/storage.py ++++ b/virtinst/storage.py +@@ -697,6 +697,7 @@ class StorageVolume(_StorageObject): + log.debug("Using vol create flags=%s", createflags) + vol = self.pool.createXML(xml, createflags) + ++ meter.update(self.capacity) + meter.end() + log.debug("Storage volume '%s' install complete.", self.name) + return vol +-- +2.39.0 + diff --git a/virt-manager-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesn-t-need.patch b/virt-manager-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesn-t-need.patch new file mode 100644 index 0000000..f240538 --- /dev/null +++ b/virt-manager-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesn-t-need.patch @@ -0,0 +1,87 @@ +From 91cd135f66b517cf247d031966c2f33343c23aa3 Mon Sep 17 00:00:00 2001 +From: Toshiki Sonoda +Date: Wed, 9 Nov 2022 18:33:57 +0900 +Subject: [PATCH] virtinstall: Hide total_size in the progress bar if it + doesn't need + +virt-install prints the total_size value to the progress bar even if it +is meaningless. +This value can be confusing to user, so for execute prosess that doesn't +copy files (total_size = 0B), we hide the total_size value. +For example, 'Creating domain...' doesn't need to print the total_size +value. + +Signed-off-by: Toshiki Sonoda +Signed-off-by: Haruka Ohata +(cherry picked from commit 6ec00474a659158f20248d6af3771d1a12ddac7b) + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2156247 + +Signed-off-by: Jonathon Jongsma +--- + tests/data/meter/meter-zero.txt | 4 ++++ + tests/test_misc.py | 14 ++++++++++++++ + virtinst/_progresspriv.py | 8 ++++++-- + 3 files changed, 24 insertions(+), 2 deletions(-) + create mode 100644 tests/data/meter/meter-zero.txt + +diff --git a/tests/data/meter/meter-zero.txt b/tests/data/meter/meter-zero.txt +new file mode 100644 +index 000000000..fc81f21fd +--- /dev/null ++++ b/tests/data/meter/meter-zero.txt +@@ -0,0 +1,4 @@ ++ ++Meter text test 100% [================] 0 B/s | 0 B --:-- ETA ++ ++Meter text test | 00:02 +diff --git a/tests/test_misc.py b/tests/test_misc.py +index 20f5a626b..2cabc3382 100644 +--- a/tests/test_misc.py ++++ b/tests/test_misc.py +@@ -224,6 +224,20 @@ def test_misc_meter(): + out = meter.output.getvalue().replace("\r", "\n") + utils.diff_compare(out, os.path.join(utils.DATADIR, "meter", "meter6.txt")) + ++ def _test_meter_zero(m, startval=0, text="Meter text test"): ++ with unittest.mock.patch("time.time", return_value=1.0): ++ m.start(text, startval) ++ with unittest.mock.patch("time.time", return_value=3.0): ++ m.update(0) ++ with unittest.mock.patch("time.time", return_value=3.1): ++ m.end() ++ ++ # meter with size 0 and startval size 0 ++ meter = _progresspriv.TextMeter(output=io.StringIO()) ++ _test_meter_zero(meter, 0) ++ out = meter.output.getvalue().replace("\r", "\n") ++ utils.diff_compare(out, os.path.join(utils.DATADIR, "meter", "meter-zero.txt")) ++ + # BaseMeter coverage + meter = _progresspriv.BaseMeter() + _test_meter_values(meter) +diff --git a/virtinst/_progresspriv.py b/virtinst/_progresspriv.py +index a035c9c43..207c64796 100644 +--- a/virtinst/_progresspriv.py ++++ b/virtinst/_progresspriv.py +@@ -247,11 +247,15 @@ class TextMeter(BaseMeter): + tl = TerminalLine(8) + # For big screens, make it more readable. + use_hours = bool(tl.llen > 80) +- ui_size = tl.add(' | %5sB' % total_size) + ui_time = tl.add(' %s' % format_time(self.re.elapsed_time(), + use_hours)) + ui_end, not_done = _term_add_end(tl, self.size, amount_read) +- dummy = not_done ++ if not not_done and amount_read == 0: ++ # Doesn't need to print total_size ++ ui_size = tl.add(' | %5s ' % ' ') ++ else: ++ ui_size = tl.add(' | %5sB' % total_size) ++ + out = '\r%-*.*s%s%s%s\n' % (tl.rest(), tl.rest(), self.text, + ui_size, ui_time, ui_end) + self.output.write(out) +-- +2.39.0 + diff --git a/virt-manager.spec b/virt-manager.spec index 499c399..6633c3c 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -8,7 +8,7 @@ Name: virt-manager Version: 4.1.0 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} %global verrel %{version}-%{release} Summary: Desktop tool for managing virtual machines via libvirt @@ -20,6 +20,9 @@ Source1: symlinks Patch1: virt-manager-cloner-Sync-uuid-and-sysinfo-system-uuid.patch Patch2: virt-manager-virtinstall-fix-regression-with-boot-and-no-install-method.patch +Patch3: virt-manager-progress-Fix-showing-correct-final-total.patch +Patch4: virt-manager-virtinstall-Fix-the-allocating-disk-size-printed-by-the-progress-bar.patch +Patch5: virt-manager-virtinstall-Hide-total_size-in-the-progress-bar-if-it-doesn-t-need.patch Requires: virt-manager-common = %{verrel} @@ -185,6 +188,11 @@ git config gc.auto 0 %changelog +* Wed Feb 1 2023 Jonathon Jongsma - 4.1.0-3 +- progress: Fix showing correct final total (rhbz#2156247) +- virtinstall: Fix the allocating disk size printed by the progress bar (rhbz#2156247) +- virtinstall: Hide total_size in the progress bar if it doesn't need (rhbz#2156247) + * Mon Dec 5 2022 Jonathon Jongsma - 4.1.0-2 - virtinstall: fix regression with --boot and no install method (rhbz#2144885)