IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26679


Ignore:
Timestamp:
Jan 25, 2010, 12:28:09 PM (16 years ago)
Author:
watersc1
Message:

Updated neb-df to report the current usage on allocated volumes as well, as this is in someways the number we actually care about.

Also fixed a bug in the code that's probably been there for a long time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/bin/neb-df

    r17547 r26679  
    4444my $total_total = 0;
    4545my $total_used  = 0;
     46my $allocated_total = 0;
     47my $allocated_used = 0;
    4648foreach my $row (@$stats) {
    4749    my %vol;
    48     @vol{qw(mountpoint total used vol_id name path allocate available xattr)}
     50    @vol{qw(mountpoint total used vol_id name host path allocate available xattr)}
    4951        = @$row;
    50 
    51     my $path        = $vol{path};
     52    my $path        = $vol{host};
    5253    my $total       = $vol{total};
    5354    $total_total    += $total;
     
    5859    my $mountpoint  = $vol{mountpoint};
    5960
     61    if ($vol{allocate} == 1) {
     62        $allocated_total += $total;
     63        $allocated_used += $used;
     64    }
    6065    # indicated the part of the nebulous volume name that matches up with a
    6166    # local volume (mountpoint)
     
    101106    );
    102107
     108my $allocated_available   = $allocated_total - $allocated_used;
     109my $allocated_usedper     = ($allocated_used / $allocated_total) * 100;
     110
     111# summary
     112printf ("%s\n%20s", "/summmary_of_allocated_volumes", "");
     113printf(" %*s %*s %*s %*.0f%% %s\n",
     114        9,
     115        $allocated_total,
     116        9,
     117        $allocated_used,
     118        9,
     119        $allocated_available,
     120        3,
     121        $allocated_usedper,
     122        "/allocated",
     123    );
     124
    103125__END__
    104126
Note: See TracChangeset for help on using the changeset viewer.