AFS-Command

 view release on metacpan or  search on metacpan

lib/AFS/Command/VOS.pod  view on Meta::CPAN

       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
      (
       # Required arguments
       server			=> $server,
       partition		=> $partition,
       name			=> $name,
       file			=> $file, # SPECIAL CASE!!! (see below)
       # Optional arguments
       id			=> $id,
       overwrite		=> 'abort' | 'full' | 'incremental',
       offline			=> 1,
       readonly			=> 1,
       creation			=> 'dump' | 'keep' | 'new',
       lastupdate		=> 'dump' | 'keep' | 'new',
       cell                     => $cell,
       noauth                   => 1,
       localauth                => 1,
       verbose                  => 1,
       encrypt                  => 1,
       # Enhanced arguments
       gunzip			=> 1,
       bunzip2			=> 1,
       filterin			=> [ @command ], # OR [ [ @cmd1 ], [ @cmd2 ], ... ]
      );

NOTE: The 'creation' and 'lastupdate' options are available only in a
very recent patch to the vos command, which should be available in the
OpenAFS 1.2.11 or 1.2.12 releases.  These options control how the
Creation and LastUpdate timestamps are set on the restored volume.

The 3 values these options can take, and their meanings, are:

=over

=item dump

Use the timestamp from the volume dump file being restored to the
volume.  This is the default behavior for the LastUpdate timestamp.

=item keep

Preserve the existing timestamp on the volume.

=item new

Set the timestamp to the current time.  This is the default behavior
for the Creation timestamp.

=back

Note that the default behavior creates the condition where the
Creation time is newer than the LastUpdate time, and when this is
true, "vos examine" (or any command that display the timestamps in the
volume header, really) will show the Creation time as the LastUpdate
time, presumably because it would be confusing to show the volume as
having been updated before it was created.

Similar to 'vos dump', the 'file' argument is optional to 'vos
restore', but required in this API.  There are also three new
arguments: gunzip, bunzip2, and filterin.  The analogy with 'vos dump'
is by design entirely symmetrical.

=over

=item file

This argument specifies the file from which the vos restore input
should be read.  If the file ends in '.gz' or '.bz2', then gunzip or
bunzip2 will be used to uncompress the input before it is read by vos
restore.  This is accomplished using a pipe, so there is no
intermediate file written to disk first.

By default, 'vos restore' will read the volume dump from stdin, which
is not what you want in most applications.  If you really want the
volume to be read from stdin, then you have to explicitly say so:

   my $result = $vos->restore
     (
      ...
      file			=> 'stdin',
      ...
     );

=item gunzip, bunzip2

Both of these arguments will turn on uncompression explicitly,
although they only need to be specified if the need for uncompression
can not be determined dynamically from the filename.  If the files are
compressed, but lack the proper extension ('.gz' or '.bz2'), or if the

lib/AFS/Command/VOS.pod  view on Meta::CPAN

    type			"RO" | "RW" | "BK"
    status			Site status.

Note that the status is the field indicating the state of the volume
during a 'vos release' command, and this will be an empty string for
VLDB entries which are completely in sync.

B<AFS::Object::VolumeHeader>

This object is created by parsing the volume header stanza, such as:

    root.afs                          536908042 RW         23 K  Off-line
        npiafa3 /viceph
        RWrite  536908042 ROnly  536908046 Backup          0
        MaxQuota          0 K
        Creation    Sat Sep 23 03:41:50 2006
        Copy        Fri Aug 31 01:12:21 2007
        Backup      Fri Oct 17 20:59:02 2003
        Last Update Sat Nov  7 15:12:40 1998
        0 accesses in the past day (i.e., vnode references)

Note that there may very well be more than one of these, if a
.readonly is examined, since the volume headers for all of the RO
volumes will be queried.

The attributes available in this object depend on the method
arguments, as well as the state of the volume (less information can be
obtained when a volume is busy, for example).

The following attributes should always be present.

    Attributes			Values
    ----------			------
    id				Numeric Volume ID
    status			online | offline | busy
    attached			Boolean

The 'attached' attribute is a Boolean that indicates whether or not
the volume is attached by the volserver.  A volume which can not be
brought online due to volume header problems will be offline, and
unattached (attached == 0), but a volume can be offline for other
reasons, (eg. vos offline, or more than one volume with the same ID on
the same server), and still be attached (attached == 1).

The following attributes are present only if the volume's status is
'online':

    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):

    Attributes			Values
    ----------			------
    files			Number of files in the volume
    raw				Generic AFS::Object object
    author			Generic AFS::Object object

The 'raw' and 'author' stats are implemented as a hierarchy of simple,
generic AFS::Object objects, which have nothing but a couple
of attributes, and no special methods associated with them.

The 'raw' object has the following attributes:

    Attributes			Values
    ----------			------
    reads			Generic AFS::Object object
    writes			Generic AFS::Object object

Both of the 'reads' and 'writes' objects have the following
attributes:

    Attributes			Values
    ----------			------
    same			Generic AFS::Object object
    diff			Generic AFS::Object object

Both of the 'same' and 'diff' objects have the following attributes:

    Attributes			Values
    ----------			------
    total			Numeric value
    auth			Numeric value

The 'author' object has the following attributes:

    Attributes			Values
    ----------			------
    0sec			Generic AFS::Object object
    1min			Generic AFS::Object object
    10min			Generic AFS::Object object
    1hr				Generic AFS::Object object
    1day			Generic AFS::Object object
    1wk				Generic AFS::Object object

Each of the above interval value objects has the following attributes:

    Attributes			Values
    ----------			------

lib/AFS/Command/VOS.pod  view on Meta::CPAN

    getVolumeIds()			List of volume ids
    getVolumeNames()			List of volume names
    getVolumeHeaderById($id)		the AFS::Object::VolumeHeader object for $id
    getVolumeHeaderByName($name)	the AFS::Object::VolumeHeader object for $name
    getVolumeHeaders()			list of AFS::Object::VolumeHeader objects
    getVolumeHeader( id => $id )	the AFS::Object::VolumeHeader object for $id
    getVolumeHeader( name => $name )	the AFS::Object::VolumeHeader object for $name

Note that both of the following are equivalent, but merely differ in style:

    getVolumeHeaderById($id)
    getVolumeHeader( id => $id )

And it should be obvious, but these are also equivalent we well:

    getVolumeHeaderByName($name)
    getVolumeHeader( name => $name )

B<AFS::Object::VolumeHeader>

The following attributes should always be present.

    Attributes			Values
    ----------			------
    id				Numeric Volume ID
    status			online | offline | busy
    attached			Boolean

The 'attached' attribute is a Boolean that indicates whether or not
the volume is attached by the volserver.  A volume which can not be
brought online due to volume header problems will be offline, and
unattached (attached == 0), but a volume can be offline for other
reasons, (eg. vos offline, or more than one volume with the same ID on
the same server), and still be attached (attached == 1).

If the 'fast' argument was specified, then none of the other
attributes will be present.

The following attributes are present only if the volume's status is
'online':

    Attributes			Values
    ----------			------
    name			Volume Name
    type			"RO" | "RW" | "BK"
    size			Numeric size in KB

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

The vos help string is:

    vos partinfo: list partition information
    Usage: vos partinfo -server <machine name> [-partition <partition name>]
			[-cell <cell name>] [-noauth] [-localauth]
			[-verbose] [-encrypt]

The corresponding method invocation looks like:

    my $result = $vos->partinfo
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       partition		=> $partition,
       cell                     => $cell,
       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, which
have more interesting attributes than those returned by 'vos
partinfo'.

    my $result = $vos->partinfo
      (
       server			=> $server,
       cell			=> $cell,
      ) || die $vos->errors();
    foreach my $partition ( $result->getPartitions() ) {
	my $partname		= $partition->partition();
	my $available		= $partition->available();
	my $total		= $partition->total();
	print("Partition $partname has $available KB of " .
              "space available out of $total KB total\n");
    }

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.

lib/AFS/Command/VOS.pod  view on Meta::CPAN

       # Required arguments
       id			=> $id,
       # Optional arguments
       server			=> $server,
       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]

The corresponding method invocation looks like:

    my $result = $vos->syncserv
      (
       # Required arguments
       server			=> $server,
       # Optional arguments



( run in 0.442 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )