mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-13 15:03:54 +00:00
drive-mirror: avoid division by zero bug
This commit is contained in:
parent
edb52f14a5
commit
6f70864360
@ -5200,13 +5200,15 @@ sub qemu_drive_mirror {
|
||||
die "mirroring job seem to have die. Maybe do you have bad sectors?" if !$stat;
|
||||
die "error job is not mirroring" if $stat->{type} ne "mirror";
|
||||
|
||||
my $transferred = $stat->{offset};
|
||||
my $total = $stat->{len};
|
||||
my $remaining = $total - $transferred;
|
||||
my $percent = sprintf "%.2f", ($transferred * 100 / $total);
|
||||
my $busy = $stat->{busy};
|
||||
|
||||
print "transferred: $transferred bytes remaining: $remaining bytes total: $total bytes progression: $percent % busy: $busy\n";
|
||||
if (my $total = $stat->{len}) {
|
||||
my $transferred = $stat->{offset} || 0;
|
||||
my $remaining = $total - $transferred;
|
||||
my $percent = sprintf "%.2f", ($transferred * 100 / $total);
|
||||
|
||||
print "transferred: $transferred bytes remaining: $remaining bytes total: $total bytes progression: $percent % busy: $busy\n";
|
||||
}
|
||||
|
||||
if ($stat->{len} == $stat->{offset}) {
|
||||
if ($busy eq 'false') {
|
||||
|
Loading…
Reference in New Issue
Block a user