AFS-Command
view release on metacpan or search on metacpan
lib/AFS/Command/VOS.pod view on Meta::CPAN
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
# Enhanced arguments
gzip => $gzip,
bzip2 => $bzip2,
filterout => [ @command ], # OR [ [ @cmd1 ], [ @cmd2 ], ... ]
);
The first thing to notice is that 'file' is optional to the vos dump
command itself, but required in this API. The second thing to notice
is the addition of three new arguments: gzip, bzip2 and filterout.
=over
=item file
This argument specifies the file to which the vos dump output should
be written. If this file ends in '.gz' or '.bz2', then gzip or bzip2
will be used to compress the output before it is written to the
filesystem. This is accomplished using a pipe, so there is no
intermediate file written to disk first.
By default, 'vos dump' will write the volume dump to stdout, which is
not what you want in most applications. If you really want the volume
to be written to stdout, then you have to explicitly say so:
my $result = $vos->dump
(
...
file => 'stdout',
...
);
=item gzip, bzip2
Both of these arguments will turn on compression explicitly, and if
the file specified doesn't end in the appropriate extension already
('.gz' for gzip, and '.bz2' for bzip2), then the extension is appended
to the filename.
The value of these arguments specifies the degree of compression used,
an should be a single numeric digit, from 0 to 9. See the gzip and
bzip2 man pages for more information.
These arguments are also mutually exclusive.
=item filterout
This is an advanced feature, and one that allows the volume dump to be
filtered through any arbitrary number of commands before it is
compressed (optionally) and written to the filesystem. The value of
this argument is either an ARRAY reference to a list of command line
arguments, suitable for passing to exec(), or an ARRAY or such ARRAYS,
when more than one filter command is being used.
For example, the author has a requirement to pass all volume dumps
through a simple filter called 'newversion', which reads a volume
dump, changes the directory version numbers to the current utime
value, and writes the volume dump to stdout. Trust me, you really
don't want to know why.
my $result = $vos->dump
(
...
filterout => [ 'newversion' ],
...
);
If there were command line arguments for this command, then they must
be given as follows:
my $result = $vos->dump
(
...
filterout => [ 'newversion', '-arg1', '-value1' ],
...
);
These args are passed directly to exec, with no shell involved. When
more than one command is given, then an ARRAY or ARRAYs must be
specified as follows:
my $result = $vos->dump
(
...
filterout => [
[ 'command1', '-arg1', '-value1' ],
[ 'command2', '-arg2', '-value2' ],
[ 'command3', '-arg3', '-value3' ],
],
...
);
If B<ANY> of the filterout commands exits with a non-zero status, then
the entire dump method invocation is considered to fail. You may or
may not get a valid volume dump file, compressed or otherwise,
depending on the behavior of the commands you specify.
=back
=head2 restore
The vos help string is:
vos restore: restore a volume
Usage: vos restore -server <machine name> -partition <partition name>
-name <name of volume to be restored> [-file <dump file>]
[-id <volume ID>] [-overwrite <abort | full | incremental>]
[-offline] [-readonly]
[-creation <dump | keep | new>] [-lastupdate <dump | keep | new>]
[-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
Where: -offline leave restored volume offline
-readonly make restored volume read-only
The corresponding method invocation looks like:
my $result = $vos->restore
lib/AFS/Command/VOS.pod view on Meta::CPAN
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=item Return Values
This method returns an AFS::Object::FileServer object, which
contains one or more AFS::Object::Partition objects. Because
'listpart' returns nothing other than the partition names, the
underlying Partition objects have only one attribute ('partition'), so
the API for access this data is trivial:
my $result = $vos->listpart
(
server => 'fs1.ms.com',
) || die $vos->errors();
foreach my $partition ( $result->getPartitionNames() ) {
print "Server '$server' has partition '$partition'\n";
}
The FileServer object has no attributes at all, it merely contains the
Partition objects. Since the Partition objects are indexed by name,
there's no need to extract the partition objects and query their
attributes, since once you have the names, you have all the information
already.
Compare this with 'vos partinfo', which provides a lot more
information. For pedantic completeness (the author is kinda
anal-retentive in that way), here's the description of the complete
interface.
B<AFS::Object::FileServer>
This object has no attributes, and is merely a container for the
AFS::Object::Partition objects. It has the following methods
for extracting the objects is contains.
Methods Returns
------- -------
getPartitionNames() list of strings (partition names)
getPartitions() list of AFS::Object::Partition objects
getPartition($partname) a single AFS::Object::Partition object,
for the partition named $partname
B<AFS::Object::Partition>
This object has one boring attribute:
Attributes Values
---------- ------
partition Fileserver /vice partition name
When used to encapsulate 'vos listpart' output, this object has no
relevant methods. Note, however, that this version of the API reuses
this object to represent other partition-related data (see 'vos
listvol' method documentation, for example), but they are not relevant
in this usage of the object. This multiple personality of the objects
may be changed in a future release, so don't get too attached to the
specific class names.
See the AFS::Object documentation for a discussion of the
planned evolution of the API.
=back
=head2 listvldb
=over
=item Arguments
The vos help string is:
vos listvldb: list volumes in the VLDB
Usage: vos listvldb [-name <volume name or ID>] [-server <machine name>]
[-partition <partition name>] [-locked] [-quiet] [-nosort]
[-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt]
Where: -locked locked volumes only
-quiet generate minimal information
-nosort do not alphabetically sort the volume names
The corresponding method invocation looks like:
my $result = $vos->listvldb
(
# Optional arguments
name => $name,
server => $server,
partition => $partition,
locked => 1,
quiet => 1,
nosort => 1,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=item Return Values
This method returns an AFS::Object::VLDB object, which has a
few attributes, and contains one or more
AFS::Object::VLDBEntry objects, which in turn contain
AFS::Object::VLDBSite objects, as well as their own
attributes.
NOTE: the VLDBEntry and VLDBSite objects are the same as those used by
the 'examine' method, since that command also queries the VLDB for
part of its return values. See that discussion above for some
relevant details on the parsing of those objects, which will no be
repeated here.
my $result = $vos->listvldb
(
cell => $cell,
) || die $vos->errors();
lib/AFS/Command/VOS.pod view on Meta::CPAN
# 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,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 changeaddr
The vos help string is:
vos changeaddr: change the IP address of a file server
Usage: vos changeaddr -oldaddr <original IP address> [-newaddr <new IP address>]
[-remove] [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
Where: -remove remove the IP address from the VLDB
The corresponding method invocation looks like:
my $result = $vos->changeaddr
(
# Required arguments
oldaddr => $oldaddr,
# Optional arguments
newaddr => $newaddr,
remove => 1,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 changeloc
The vos help string is:
vos changeloc: change an RW volume's location in the VLDB
Usage: vos changeloc -server <machine name for new location>
-partition <partition name for new location>
-id <volume name or ID> [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->changeloc
(
# Required arguments
server => $server,
partition => $partition,
id => $id,
# Optional arguments
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 clone
The vos help string is:
vos clone: make clone of a volume
Usage: vos clone -id <volume name or ID>
[-server <server>] [-partition <partition>]
[-toname <volume name on destination>] [-toid <volume ID on destination>]
[-offline] [-readonly] [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->clone
(
# Required arguments
id => $id,
# Optional arguments
server => $server,
partition => $partition,
toname => $newname,
toid => $newid,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 convertROtoRW
The vos help string is:
vos convertROtoRW: convert a RO volume into a RW volume (after loss of old RW volume)
Usage: vos convertROtoRW -server <machine name> -partition <partition name>
-id <volume name or ID> [-force] [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->convertROtoRW
(
# Required arguments
server => $server,
partition => $partition,
id => $id,
# Optional arguments
lib/AFS/Command/VOS.pod view on Meta::CPAN
partition => $partition,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 remsite
The vos help string is:
vos remsite: remove a replication site
Usage: vos remsite -server <machine name> -partition <partition name>
-id <volume name or ID> [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->remsite
(
# Required arguments
id => $id,
server => $server,
partition => $partition,
# Optional arguments
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 rename
The vos help string is:
vos rename: rename a volume
Usage: vos rename -oldname <old volume name > -newname <new volume name >
[-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->rename
(
# Required arguments
oldname => $oldname,
newname => $newname,
# Optional arguments
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 setfields
The vos help string is:
vos setfields: change volume info fields
Usage: vos setfields -id <volume name or ID> [-maxquota <quota (KB)>]
[-clearuse] [-cell <cell name>] [-noauth]
[-localauth] [-verbose] [-encrypt]
Where: -clearuse clear dayUse
The corresponding method invocation looks like:
my $result = $vos->setfields
(
# Required arguments
id => $id,
# Optional arguments
maxquota => $maxquota,
clearuse => 1,
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 shadow
The vos help string is:
vos shadow: make or update a shadow volume
Usage: vos shadow -id <volume name or ID on source> -fromserver <machine name on source>
-frompartition <partition name on source> -toserver <machine name on destination>
-topartition <partition name on destination> [-toname <volume name on destination>]
[-toid <volume ID on destination>] [-offline] [-readonly] [-live] [-incremental]
[-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt]
The corresponding method invocation looks like:
my $result = $vos->shadow
(
# Required arguments
id => $id,
fromserver => $server,
frompartition => $partition,
toserver => $newserver,
topartition => $newpartition,
# Optional arguments
toname => $newname
toid => $newid
cell => $cell,
noauth => 1,
localauth => 1,
verbose => 1,
encrypt => 1,
);
=head2 syncserv
The vos help string is:
vos syncserv: synchronize server with VLDB
Usage: vos syncserv -server <machine name> [-partition <partition name>]
[-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt]
( run in 0.869 second using v1.01-cache-2.11-cpan-39bf76dae61 )