]> andersk Git - moira.git/blame - incremental/afs_quota.pl
rais threshold for zephyring quota increases from +40M to +150M
[moira.git] / incremental / afs_quota.pl
CommitLineData
6231b320 1#!/afs/athena/contrib/perl/perl
2# Usage: afs_quota path quota
3
e2666aac 4require "/moira/bin/afs_utils.pl";
6231b320 5
6die "Usage: $0 path quota\n" unless (@ARGV==2);
7
8($path,$newq) = @ARGV;
9$path =~ s:^/afs/([^.]):/afs/.\1:;
10
11system("$fs checkb >/dev/null");
12
13open(PROG,"$fs lv $path|");
14chop(@fs=<PROG>);
15close(PROG);
16die "Unable to get information about $path\n" if ($?);
17
18@tmp = split(/\s+/, shift(@fs));
19$vname = pop(@tmp);
20@tmp = split(/\s+/, shift(@fs));
21$oldq = pop(@tmp);
22
23open(PROG,"$fs whichcell $path|");
24chop($_=<PROG>);
25close(PROG);
26die "Unable to get information about $path\n" if ($?);
27
28@tmp=split(/\s+/,$_);
29($cell=pop(@tmp)) =~ s/^'(.*)'$/\1/;
30$cell =~ tr/a-z/A-Z/;
31
32open(PROG,"$vos ex $vname -cell $cell|");
33chop(@tmp=<PROG>);
34close(PROG);
35die "Unable to get volume information about $vname ($path)\n" if ($?);
36
564ed5a8 37$_ = shift(@tmp);
38($vusage, $vusage, $vusage, $vusage) = split(/\s+/,$_);
39$_ = shift(@tmp);
6231b320 40($asrv,$asrv,$apart) = split(/\s+/,$_);
41
564ed5a8 42open(PROG,"$vos partinfo $asrv $apart -cell $cell|");
43chop($_ = <PROG>);
44close(PROG);
45die "Unable to get partition information about $asrv $apart\n" if ($?);
46
47@tmp = split(/\s+/,$_);
48$dtotal = $tmp[11];
49$dusage = $dtotal - $tmp[5];
50
6231b320 51system("$fs","sq",$path,$newq);
52die "Unable to change quota on $path\n" if ($?);
39e0b5bb 53
9205b505 54&afs_quota_adj($cell,$asrv,$apart,$newq-$oldq,$dusage);
119f209e 55
564ed5a8 56if ($dusage > (0.9 * $dtotal)) {
7a4e84fa 57 system("$zwrite","-q","-n","-c","afsadm","-i","moira","-m",
564ed5a8 58 "WARNING: Disk usage on $asrv:$apart is greater than 90%
59Used $dusage K out of $dtotal K");
60}
61elsif (($dusage + ($newq-$vusage)) > (0.9 * $dtotal)) {
7a4e84fa 62 system("$zwrite","-q","-n","-c","afsadm","-i","moira","-m",
564ed5a8 63 "Quota change on volume $vname, if used completely will cause
64$asrv:$apart to be over 90% used.
65
66Current volume usage: $vusage, old quota $oldq, new quota $newq");
67}
50a8df6f 68elsif ($newq-$oldq > 149999) {
7a4e84fa 69 system("$zwrite","-q","-n","-c","afsadm","-i","moira","-m",
564ed5a8 70 "Increased quota on volume $vname ($asrv:$apart) from $oldq to $newq");
71}
This page took 0.075643 seconds and 5 git commands to generate.