view release on metacpan or search on metacpan
lib/AFS/Command/VOS.pm view on Meta::CPAN
$header->_setAttribute
(
name => $1,
id => $2,
type => $3,
size => $4,
);
$header->_setAttribute( rwrite => $2 ) if $3 eq 'RW';
$header->_setAttribute( ronly => $2 ) if $3 eq 'RO';
$header->_setAttribute( backup => $2 ) if $3 eq 'BK';
my $status = $5;
$status = 'offline' if $status eq 'Off-line';
$status = 'online' if $status eq 'On-line';
$header->_setAttribute
(
status => $status,
attached => 1,
);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$header->_setAttribute
(
name => $1,
id => $2,
type => $3,
size => $4,
files => $5,
);
$header->_setAttribute( rwrite => $2 ) if $3 eq 'RW';
$header->_setAttribute( ronly => $2 ) if $3 eq 'RO';
$header->_setAttribute( backup => $2 ) if $3 eq 'BK';
my $status = $6;
$status = 'offline' if $status eq 'Off-line';
$status = 'online' if $status eq 'On-line';
$header->_setAttribute
(
status => $status,
attached => 1,
);
lib/AFS/Command/VOS.pm view on Meta::CPAN
#
# Q: Do we want to check that the id already found
# matches one of these?? Not yet...
#
if ( /^\s+RWrite\s+(\d+)\s+ROnly\s+(\d+)\s+Backup\s+(\d+)/ ) {
$header->_setAttribute
(
rwrite => $1,
ronly => $2,
backup => $3,
);
if ( /RClone\s+(\d+)/ ) {
$header->_setAttribute( rclone => $1 );
}
next;
}
if ( /^\s+MaxQuota\s+(\d+)/ ) {
lib/AFS/Command/VOS.pm view on Meta::CPAN
$header->_setAttribute( creation => $1 );
next;
}
if ( /^\s+Copy\s+(.*)\s*$/ ) {
$header->_setAttribute( copyTime => $1 );
next;
}
if ( /^\s+Backup\s+(.*)\s*$/ ) {
$header->_setAttribute( backupTime => $1 );
next;
}
if ( /^\s+Last Access\s+(.*)\s*$/ ) {
$header->_setAttribute( access => $1 );
next;
}
if ( /^\s+Last Update\s+(.*)\s*$/ ) {
$header->_setAttribute( update => $1 );
lib/AFS/Command/VOS.pm view on Meta::CPAN
#
# The rest of the information we get will be from the
# VLDB. This will start with the volume ids, which we DO want
# to check against those found above, since they are from a
# different source, and a conflict is cause for concern.
#
if ( /^\s+RWrite:\s+(\d+)/ ) {
if ( /RWrite:\s+(\d+)/ ) { $entry->_setAttribute( rwrite => $1 ); }
if ( /ROnly:\s+(\d+)/ ) { $entry->_setAttribute( ronly => $1 ); }
if ( /Backup:\s+(\d+)/ ) { $entry->_setAttribute( backup => $1 ); }
if ( /RClone:\s+(\d+)/ ) { $entry->_setAttribute( rclone => $1 ); }
next;
} # if ( /^\s+RWrite:....
#
# Next we are looking for the number of sites, and then we'll
# suck that data in as well.
#
lib/AFS/Command/VOS.pm view on Meta::CPAN
last if /^\s*$/; # Volume info ends with a blank line
#
# Code to parse this output lives in examine.pl. This
# will need to be made generic and used here to parse and
# return the full vldb entry.
#
if ( /RWrite:\s+(\d+)/ ) { $entry->_setAttribute( rwrite => $1 ); }
if ( /ROnly:\s+(\d+)/ ) { $entry->_setAttribute( ronly => $1 ); }
if ( /Backup:\s+(\d+)/ ) { $entry->_setAttribute( backup => $1 ); }
if ( /RClone:\s+(\d+)/ ) { $entry->_setAttribute( rclone => $1 ); }
if ( /^\s+number of sites ->\s+(\d+)/ ) {
my $sites = $1;
while ( defined($_ = $self->{handle}->getline()) ) {
chomp;
lib/AFS/Command/VOS.pm view on Meta::CPAN
while ( defined($_ = $self->{handle}->getline()) ) {
last if /^\s*$/;
if ( /^\s+RWrite\s+(\d+)\s+ROnly\s+(\d+)\s+Backup\s+(\d+)/ ) {
$volume->_setAttribute
(
rwrite => $1,
ronly => $2,
backup => $3,
);
if ( /RClone\s+(\d+)/ ) {
$volume->_setAttribute( rclone => $1 );
}
next;
}
if ( /^\s+MaxQuota\s+(\d+)/ ) {
$volume->_setAttribute( maxquota => $1 );
next;
lib/AFS/Command/VOS.pm view on Meta::CPAN
$volume->_setAttribute( creation => $1 );
next;
}
if ( /^\s+Copy\s+(.*)\s*$/ ) {
$volume->_setAttribute( copyTime => $1 );
next;
}
if ( /^\s+Backup\s+(.*)\s*$/ ) {
$volume->_setAttribute( backupTime => $1 );
next;
}
if ( /^\s+Last Access\s+(.*)\s*$/ ) {
$volume->_setAttribute( access => $1 );
next;
}
if ( /^\s+Last Update\s+(.*)\s*$/ ) {
$volume->_setAttribute( update => $1 );
lib/AFS/Command/VOS.pod view on Meta::CPAN
name Volume name
rwrite Numeric Volume ID for the RW volume
locked Boolean value, indicating the VLDB entry is locked or not
The following attributes may be present, if there are volumes of the
associated type in the VLDB entry:
Attributes Values
---------- ------
ronly Numeric Volume ID for the RO volume
backup Numeric Volume ID for the BK volume
rclone Numeric Volume ID for the RClone volume, if present
Note that the 'rclone' attribute is only present if the volume was
actively being cloned while being examined. This is true when a 'vos
release' command is actively updating the RO volumes.
The following methods are available:
Methods Returns
------- -------
lib/AFS/Command/VOS.pod view on Meta::CPAN
Attributes Values
---------- ------
name Volume Name
type "RO" | "RW" | "BK"
size Numeric size in KB
server Fileserver hostname
partition Fileserver /vice partition
maxquota Volume quota in KB
creation Volume creation date (ctime format, eg: Sat Oct 6 04:39:50 2001)
copyTime Volume copy date (also in ctime format)
backupTime Volume backup date (also in ctime format)
access Volume Last Access date (also in ctime format)
update Volume update date (also in ctime format)
accesses Number of volume accesses since the last reset
rwrite Numeric Volume ID for the RW volume
ronly Numeric Volume ID for the RO volume
backup Numeric Volume ID for the BK volume
rclone Numeric Volume ID for the RClone volume, if present
Note that the 'rclone' attribute is only present if the volume was
actively being cloned while being examined. This is true when a 'vos
release' command is actively updating the RO volumes.
The following attributes are only present if the 'extended' argument
was specified (see below for details on access the raw and author
stats):
lib/AFS/Command/VOS.pod view on Meta::CPAN
This object also has a few attributes, and a few methods. The 'name'
attribute is always present, but the others vary, depending on the
volume (again, see the 'examine' documentation for more verbosity).
Attributes Values
---------- ------
name Volume name
rwrite Numeric Volume ID for the RW volume
ronly Numeric Volume ID for the RO volume
backup Numeric Volume ID for the BK volume
rclone Numeric Volume ID for the RClone volume, if present
locked Boolean, indicating whether or not the VLDB entry is locked
Methods Returns
------- -------
getVLDBSites() list of AFS::Object::VLDBSite objects
B<AFS::Object::VLDBSite>
The following attributes are always available:
lib/AFS/Command/VOS.pod view on Meta::CPAN
The following attributes are present only if the 'long' argument was
specified:
Attributes Values
---------- ------
server Fileserver hostname
partition Fileserver /vice partition
maxquota Volume quota in KB
creation Volume creation date (ctime format, eg: Sat Oct 6 04:39:50 2001)
copyTime Volume copy date (also in ctime format)
backupTime Volume backup date (also in ctime format)
access Volume Last Access date (also in ctime format)
update Volume update date (also in ctime format)
accesses Number of volume accesses since the last reset
rwrite Numeric Volume ID for the RW volume
ronly Numeric Volume ID for the RO volume
backup Numeric Volume ID for the BK volume
rclone Numeric Volume ID for the RClone volume, if present
=back
=head2 partinfo
=over
=item Arguments
lib/AFS/Command/VOS.pod view on Meta::CPAN
partition => $partition,
id => $id,
# Optional arguments
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 backup
The vos help string is:
vos backup: make backup of a volume
Usage: vos backup -id <volume name or ID> [-cell <cell name>]
[-noauth] [-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->backup
(
# Required arguments
id => $id,
# Optional arguments
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 backupsys
The vos help string is:
vos backupsys: en masse backups
Usage: vos backupsys [-prefix <common prefix on volume(s)>+] [-server <machine name>]
[-partition <partition name>] [-exclude]
[-xprefix <negative prefix on volume(s)>+] [-dryrun]
[-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt]
Where: -exclude exclude common prefix volumes
-dryrun no action
The corresponding method invocation looks like:
my $result = $vos->backupsys
(
# Optional arguments
prefix => $prefix, # OR [ $prefix1, $prefix2, ... ]
server => $server,
partition => $partition,
exclude => 1,
prefix => $xprefix, # OR [ $xprefix1, $xprefix2, ... ]
dryrun => 1,
cell => $cell,
noauth => 1,
lib/AFS/Command/VOS.pod view on Meta::CPAN
verbose => 1,
encrypt => 1,
);
=head2 zap
The vos help string is:
vos zap: delete the volume, don't bother with VLDB
Usage: vos zap -server <machine name> -partition <partition name> -id <volume ID>
[-force] [-backup] [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
Where: -force force deletion of bad volumes
-backup also delete backup volume if one is found
The corresponding method invocation looks like:
my $result = $vos->zap
(
# Required arguments
server => $server,
partition => $partition,
id => $id,
# Optional arguments
force => 1,
backup => 1,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head1 SEE ALSO
AFS::Command(1), AFS::Object(1)
lib/AFS/Object/VLDB.pm view on Meta::CPAN
sub _addVLDBEntry {
my $self = shift;
my $entry = shift;
unless ( ref $entry && $entry->isa("AFS::Object::VLDBEntry") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBEntry object");
}
foreach my $id ( $entry->rwrite(), $entry->ronly(),
$entry->backup(), $entry->rclone() ) {
next unless $id; # Some, in fact most, of those won't exist
$self->{_ids}->{$id} = $entry;
}
return $self->{_names}->{$entry->name()} = $entry;
}
1;
t/00vos_basic.t view on Meta::CPAN
} else {
warn("Volume header 'type' is '" .
$header->type() . "', should be 'RW'\n");
print "not ok $TestCounter\n";
$errors++;
}
$TestCounter++;
#
# Check the volume IDs. rwrite shold be numeric, ronly and
# backup should b e 0.
#
$rwrite = $header->rwrite();
if ( $rwrite =~ /^\d+$/ ) {
print "ok $TestCounter\n";
} else {
warn("Volume header 'rwrite' is '$rwrite', should be a numeric value\n");
print "not ok $TestCounter\n";
$errors++;
}
t/00vos_basic.t view on Meta::CPAN
if ( $header->ronly() == 0 ) {
print "ok $TestCounter\n";
} else {
warn("Volume header 'ronly' is '" .
$header->ronly() . "', should be zero\n");
print "not ok $TestCounter\n";
$errors++;
}
$TestCounter++;
if ( $header->backup() == 0 ) {
print "ok $TestCounter\n";
} else {
warn("Volume header 'backup' is '" .
$header->backup() . "', should be zero\n");
print "not ok $TestCounter\n";
$errors++;
}
$TestCounter++;
#
# This is a new volume, so access should be 0, and size 2
#
if ( $header->accesses() == 0 ) {
print "ok $TestCounter\n";
t/00vos_basic.t view on Meta::CPAN
die Data::Dumper->Dump([$result],['result']) if $errors;
} else {
print "not ok $TestCounter..$TestTotal\n";
die("Unable to examine volume '$volname' in cell '$cell':\n" .
$vos->errors());
}
#
# Create a backup, an verify that the changes in the examine output.
#
$result = $vos->backup
(
id => $volname,
cell => $cell,
);
if ( $result ) {
print "ok $TestCounter\n";
$TestCounter++;
} else {
print "not ok $TestCounter..$TestTotal\n";
die("Unable to backup volume '$volname' in cell '$cell':\n" .
$vos->errors());
}
$result = $vos->examine
(
id => $volname,
cell => $cell,
);
if ( ref $result && $result->isa("AFS::Object::Volume") ) {
t/00vos_basic.t view on Meta::CPAN
my $rwrite = 0;
if ( ref $header && $header->isa("AFS::Object::VolumeHeader") ) {
print "ok $TestCounter\n";
$TestCounter++;
#
# This time through, we're looking for just the things we
# expect a vos backup to change, and nothing else.
#
if ( $header->backup() =~ /^\d+/ ) {
print "ok $TestCounter\n";
$TestCounter++;
if ( $header->backup() > 0 ) {
print "ok $TestCounter\n";
} else {
print "not ok $TestCounter\n";
warn("Volume header 'backup' is '" .
$header->backup() . "', should be non-zero\n");
}
} else {
print "not ok $TestCounter\n";
$TestCounter++;
print "not ok $TestCounter\n";
warn("Volume header 'backup' is '" .
$header->backup() . "', should be numeric\n");
$errors++;
}
$TestCounter++;
} else {
warn("Invalid object -- getVolumeHeaders() did not return an " .
"AFS::Object::VolumeHeader object\n");
print "not ok $TestCounter\n";
$errors++;