[pve-devel] r5660 - in pve-storage/pve2: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Mar 9 10:57:30 CET 2011


Author: dietmar
Date: 2011-03-09 10:57:30 +0100 (Wed, 09 Mar 2011)
New Revision: 5660

Modified:
   pve-storage/pve2/ChangeLog
   pve-storage/pve2/PVE/Storage.pm
   pve-storage/pve2/pvesm
Log:
report sizes like 'df'


Modified: pve-storage/pve2/ChangeLog
===================================================================
--- pve-storage/pve2/ChangeLog	2011-03-09 09:38:04 UTC (rev 5659)
+++ pve-storage/pve2/ChangeLog	2011-03-09 09:57:30 UTC (rev 5660)
@@ -1,5 +1,7 @@
 2011-03-09  Proxmox Support Team  <support at proxmox.com>
 
+	* pvesm (status): report sizes like 'df'
+
 	* PVE/Storage.pm (file_size_info): allow to pass timeout
 	(important when NFS server is down)
 	(__activate_storage_full): avoid call to mkpath if not necessary

Modified: pve-storage/pve2/PVE/Storage.pm
===================================================================
--- pve-storage/pve2/PVE/Storage.pm	2011-03-09 09:38:04 UTC (rev 5659)
+++ pve-storage/pve2/PVE/Storage.pm	2011-03-09 09:57:30 UTC (rev 5660)
@@ -2045,7 +2045,7 @@
 	    next if !$res || !$res->{total};
 
 	    $info->{$storeid}->{total} = $res->{total}; 
-	    $info->{$storeid}->{avail} = $res->{used} + $res->{avail}; 
+	    $info->{$storeid}->{avail} = $res->{avail}; 
 	    $info->{$storeid}->{used} = $res->{used}; 
 	    $info->{$storeid}->{active} = 1;
 
@@ -2061,7 +2061,7 @@
 		$free = $vgs->{$vgname}->{free};
 
 		$info->{$storeid}->{total} = $total; 
-		$info->{$storeid}->{avail} = $total; 
+		$info->{$storeid}->{avail} = $free; 
 		$info->{$storeid}->{used} = $total - $free; 
 		$info->{$storeid}->{active} = 1;
 	    }

Modified: pve-storage/pve2/pvesm
===================================================================
--- pve-storage/pve2/pvesm	2011-03-09 09:38:04 UTC (rev 5659)
+++ pve-storage/pve2/pvesm	2011-03-09 09:57:30 UTC (rev 5660)
@@ -185,11 +185,12 @@
     foreach my $res (sort { $a->{storage} cmp $b->{storage} } @$res) {
 	my $storeid = $res->{storage};
 
-	my $per = $res->{avail} ? (0.5 + ($res->{used}*100)/$res->{avail}) : 100;
+	my $sum = $res->{used} + $res->{avail};
+	my $per = $sum ? (0.5 + ($res->{used}*100)/$sum) : 100;
 
-	printf "%-${maxlen}s %5s %1d %1d %15d %15d %.2f%%\n", $storeid, 
+	printf "%-${maxlen}s %5s %1d %1d %15d %15d %15d %.2f%%\n", $storeid, 
 	$res->{type},$res->{disable}, $res->{active},
-	$res->{used}/1024, $res->{avail}/1024, $per; 
+	$res->{total}/1024, $res->{used}/1024, $res->{avail}/1024, $per; 
     }
 };
 



More information about the pve-devel mailing list