TWSD-567 - APV runs out of hard disk memory after upgrade several times

Review Request #716 — Created March 14, 2025 and submitted — Latest diff uploaded

jasonchang
APV10
rel_apv_10_7, rel_apv_10_7_2, rel_apv_10_7_3
timlai, timsu, weikai

APV runs out of hard disk memory after upgrade several times. The issue originates from /rel_apv_10_7/usr/click/tools/click_upgrade.pl, specifically at line 172. When a certain condition is met, the script proceeds to delete several folders under /caupgrade before starting the upgrade.

This results in a bug where the available disk space is miscalculated—the script considers the "remaining space" without accounting for the folders that will be deleted later. To fix this, I modified the code to first ensure the available space is accurately calculated and then verify if it is sufficient for the upgrade.

// before
my $available_size = $df -m $up_dir|$grep "^/" |$awk '{printf \$4}';

if ( $compress_rate * $package_size > (0 + $available_size)) {
print STDERR "Not enough disk space for upgrading\n"; # here
die "System update fails\n";
}

//after
my $remaining_size = $df -m $up_dir|$grep "^/" |$awk '{printf \$4}';
my $additional_size = get_additional_size();
my $available_size = $remaining_size + $additional_size;

if ( $compress_rate * $package_size > (0 + $available_size)) {
print STDERR "Not enough disk space for upgrading\n"; # here
die "System update fails\n";
}

I have successfully upgrade the APV more than 6 times without facing the problem of out of hard disk memory.

    Loading...