]> andersk Git - moira.git/blob - incremental/afs_quota.pl
de75feee8e2c5eb2077d9dac3d29007b189d7d37
[moira.git] / incremental / afs_quota.pl
1 #!/afs/athena/contrib/perl/perl
2 # Usage: afs_quota path quota
3
4 require "/moira/bin/afs_utils.pl";
5
6 die "Usage: $0 path quota\n" unless (@ARGV==2);
7
8 ($path,$newq) = @ARGV;
9 $path =~ s:^/afs/([^.]):/afs/.\1:;
10
11 system("$fs checkb >/dev/null");
12
13 open(PROG,"$fs lv $path|");
14 chop(@fs=<PROG>);
15 close(PROG);
16 die "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
23 open(PROG,"$fs whichcell $path|");
24 chop($_=<PROG>);
25 close(PROG);
26 die "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
32 open(PROG,"$vos ex $vname -cell $cell|");
33 chop(@tmp=<PROG>);
34 close(PROG);
35 die "Unable to get volume information about $vname ($path)\n" if ($?);
36
37 shift(@tmp), $_ = shift(@tmp);
38 ($asrv,$asrv,$apart) = split(/\s+/,$_);
39
40 system("$fs","sq",$path,$newq);
41 die "Unable to change quota on $path\n" if ($?);
42
43 &afs_quota_adj($cell,$asrv,$apart,$newq-$oldq);
44
45 system("$zwrite","-c","afsadm","-m",
46        "Changed quota on volume $vname ($asrv:$apart) from $oldq to $newq")
47     if (($newq-$oldq > 39999) || ($oldq-$newq > 39999));
48
49 #$stat_fs = $?;
50 #$stat_qa = &afs_quota_adj($cell,$asrv,$apart,($stat_fs ? 0 : $newq-$oldq));
51 #die "Unable to change quota on $path\n" if ($stat_fs && $stat_qa);
52 #warn "Unable to change quota on $path\n" if ($stat_fs);
This page took 0.029875 seconds and 3 git commands to generate.