]> git.proxmox.com Git - pve-storage.git/commitdiff
offline migration: use telling variable for capture group
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 31 Aug 2023 13:21:30 +0000 (15:21 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 31 Aug 2023 13:21:46 +0000 (15:21 +0200)
With that the if/else branches are pretty clear, so drop the rather
noisy comments that describe what one can get from the code already
anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Storage.pm

index 7990e0ec431dd4a41c88c032493bd31e8cb08481..8ad493f897da719389688873c39ae126bc025e8e 100755 (executable)
@@ -826,13 +826,13 @@ sub storage_migrate {
        my $line = shift;
        my $show = 1;
 
-       # rate-limit dd logs
-       if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) {
-           if ($1 < 60) { # if < 60s, print every 3s
+       if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) { # rate-limit dd logs
+           my $elapsed = int($1);
+           if ($elapsed < 60) {
                $show = !($1 % 3);
-           } elsif ($1 < 600) { # if < 10mins, print every 10s
+           } elsif ($elapsed < 600) {
                $show = !($1 % 10);
-           } else { # else, print every 30s
+           } else {
                $show = !($1 % 30);
            }
        }