AFS-Command
view release on metacpan or search on metacpan
lib/AFS/Command/FS.pm view on Meta::CPAN
}
if ( $operation eq 'quota' ) {
if ( /^\s*(\d{1,2})%/ ) {
$path->_setAttribute
(
path => $paths[0],
percent => $1,
);
delete $paths{$paths[0]};
shift @paths;
}
}
if ( $operation eq 'listquota' ) {
#
# This is a bit lame. We want to be lazy and split on white
# space, so we get rid of this one annoying instance.
#
s/no limit/nolimit/g;
my ($volname,$quota,$used,$percent,$partition) = split;
$quota = 0 if $quota eq "nolimit";
$percent =~ s/\D//g; # want numeric result
$partition =~ s/\D//g; # want numeric result
$path->_setAttribute
(
path => $paths[0],
volname => $volname,
quota => $quota,
used => $used,
percent => $percent,
partition => $partition,
);
delete $paths{$paths[0]};
shift @paths;
}
if ( $operation eq 'diskfree' ) {
my ($volname,$total,$used,$avail,$percent) = split;
$percent =~ s/%//g; # Don't need it -- want numeric result
$path->_setAttribute
(
path => $paths[0],
volname => $volname,
total => $total,
used => $used,
avail => $avail,
percent => $percent,
);
delete $paths{$paths[0]};
shift @paths;
}
if ( $operation eq 'examine' ) {
if ( /Volume status for vid = (\d+) named (\S+)/ ) {
lib/AFS/Command/FS.pod view on Meta::CPAN
my $result = $fs->diskfree
(
path => [ $afspath, $ufspath, $boguspath ],
) || die $fs->errors();
foreach my $pathobj ( $result->getPaths() ) {
my $path = $pathobj->path();
if ( $pathobj->hasAttribute('error') ) {
print "Path '$path' has errors '" . $pathobj->error() . "'\n";
} else {
foreach my $attr ( qw( volname used total avail percent ) ) {
print "Path '$path' has '$attr' of '" . $pathobj->$attr() . "'\n";
}
}
}
Each of these objects has the following attributes and methods:
B<AFS::Object::CacheManager>
Methods Returns
lib/AFS/Command/FS.pod view on Meta::CPAN
If no errors were encountered, then the following attributes will be present:
Attributes Values
---------- ------
path The pathname
volname The AFS volume name that contains the pathname
total The size (in KB) of the partition that contains 'volname'
used The amount of space (in KB) used on that partition
avail The amount of space (in KB) available on that partition
percent The amount of space used, as a percentage
=back
=head2 examine
=over
=item Arguments
The fs help string is:
lib/AFS/Command/FS.pod view on Meta::CPAN
my $result = $fs->listquota
(
path => [ $afspath, $ufspath, $boguspath ],
) || die $fs->errors();
foreach my $pathobj ( $result->getPaths() ) {
my $path = $pathobj->path();
if ( $pathobj->hasAttribute('error') ) {
print "Path '$path' has errors '" . $pathobj->error() . "'\n";
} else {
foreach my $attr ( qw( volname quota used percent partition ) ) {
print "Path '$path' has '$attr' of '" . $pathobj->$attr() . "'\n";
}
}
}
Each of these objects has the following attributes and methods:
B<AFS::Object::CacheManager>
Methods Returns
lib/AFS/Command/FS.pod view on Meta::CPAN
error The error string for that path
If no errors were encountered, then the following attributes will be present:
Attributes Values
---------- ------
path The pathname
volname The AFS volume name that contains the pathname
quota Volume quota, in KB
used The amount of space (in KB) used in that volume
percent The percentage of the allocated quota in use
partition The percentage of space used on the partition where the volume resides
=head2 lsmount
=over
=item Arguments
The fs help string is:
fs lsmount: list mount point
lib/AFS/Command/FS.pod view on Meta::CPAN
Attributes Values
---------- ------
path The pathname
error The error string for that path
If no errors were encountered, then the following attributes will be present:
Attributes Values
---------- ------
path The pathname
quota The percentage of the allocated quota in use
=back
=head2 storebehind
=over
=item Arguments
The fs help string is:
lib/AFS/Command/FS.pod view on Meta::CPAN
my $result = $fs->quota
(
path => [ $afspath, $ufspath, $boguspath ],
) || die $fs->errors();
foreach my $pathobj ( $result->getPaths() ) {
my $path = $pathobj->path();
if ( $pathobj->hasAttribute('error') ) {
print "Path '$path' has errors '" . $pathobj->error() . "'\n";
} else {
foreach my $attr ( qw( volname quota used percent partition ) ) {
print "Path '$path' has '$attr' of '" . $pathobj->$attr() . "'\n";
}
}
}
Each of these objects has the following attributes and methods:
B<AFS::Object::CacheManager>
Attributes Values
t/20fs_basic.t view on Meta::CPAN
}
$TestCounter++;
#
# All the common _paths_method methods
#
my $paths = [ $pathafs, $pathnotafs, $pathbogus ];
my %pathops =
(
diskfree => [qw( volname total used avail percent )],
examine => [qw( volname total avail id quota )],
listquota => [qw( volname quota used percent partition )],
quota => [qw( percent )],
storebehind => [qw( asynchrony )],
whereis => [qw( hosts )],
whichcell => [qw( cell )],
);
foreach my $pathop ( keys %pathops ) {
unless ( $fs->supportsOperation($pathop) ) {
my $total = scalar(@{$pathops{$pathop}}) + 2;
$total++ if $pathop eq 'storebehind';
( run in 0.451 second using v1.01-cache-2.11-cpan-05162d3a2b1 )