]> andersk Git - moira.git/commitdiff
Send zgrams if the disk usage is over 90% or the quota change, if used, would bring...
authorprobe <probe>
Thu, 27 Oct 1994 17:10:10 +0000 (17:10 +0000)
committerprobe <probe>
Thu, 27 Oct 1994 17:10:10 +0000 (17:10 +0000)
incremental/afs_quota.pl

index de75feee8e2c5eb2077d9dac3d29007b189d7d37..860f083516aab4d0ec135ba9265724eb3844737d 100644 (file)
@@ -1,7 +1,8 @@
 #!/afs/athena/contrib/perl/perl
 # Usage: afs_quota path quota
 
-require "/moira/bin/afs_utils.pl";
+$incdir = "/mit/moiradev/src/incremental";
+require "$incdir/afs_utils.pl";
 
 die "Usage: $0 path quota\n" unless (@ARGV==2);
 
@@ -34,17 +35,41 @@ chop(@tmp=<PROG>);
 close(PROG);
 die "Unable to get volume information about $vname ($path)\n" if ($?);
 
-shift(@tmp), $_ = shift(@tmp);
+$_ = shift(@tmp);
+($vusage, $vusage, $vusage, $vusage) = split(/\s+/,$_);
+$_ = shift(@tmp);
 ($asrv,$asrv,$apart) = split(/\s+/,$_);
 
+open(PROG,"$vos partinfo $asrv $apart -cell $cell|");
+chop($_ = <PROG>);
+close(PROG);
+die "Unable to get partition information about $asrv $apart\n" if ($?);
+
+@tmp = split(/\s+/,$_);
+$dtotal = $tmp[11];
+$dusage = $dtotal - $tmp[5];
+
 system("$fs","sq",$path,$newq);
 die "Unable to change quota on $path\n" if ($?);
 
 &afs_quota_adj($cell,$asrv,$apart,$newq-$oldq);
 
-system("$zwrite","-c","afsadm","-m",
-       "Changed quota on volume $vname ($asrv:$apart) from $oldq to $newq")
-    if (($newq-$oldq > 39999) || ($oldq-$newq > 39999));
+if ($dusage > (0.9 * $dtotal)) {
+    system("$zwrite","-c","afsadm","-m",
+          "WARNING: Disk usage on $asrv:$apart is greater than 90%
+Used $dusage K out of $dtotal K");
+}
+elsif (($dusage + ($newq-$vusage)) > (0.9 * $dtotal)) {
+    system("$zwrite","-c","afsadm","-m",
+          "Quota change on volume $vname, if used completely will cause
+$asrv:$apart to be over 90% used.
+
+Current volume usage: $vusage, old quota $oldq, new quota $newq");
+}
+elsif ($newq-$oldq > 39999) {
+    system("$zwrite","-c","afsadm","-m",
+          "Increased quota on volume $vname ($asrv:$apart) from $oldq to $newq");
+}
 
 #$stat_fs = $?;
 #$stat_qa = &afs_quota_adj($cell,$asrv,$apart,($stat_fs ? 0 : $newq-$oldq));
This page took 0.335915 seconds and 5 git commands to generate.