AFS-Command

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    online
    On-line

Likewise, when offline, one of:

    offline
    Off-line

These values have all been normalized to: online, offline

=head2 AFS::Command::VOS->examine parses busy and offline messages

When a volume is busy or can not be attached, "vos examine" will be
unable to display the volume headers.  Instead, a one line message is
printed, such as one of the following:

    **** Volume 123456789 is busy ****
    **** Could not attach volume 123456789 ****

The examine method now parses these, and the AFS::Object::VolumeHeader
object will have only the 'id' and 'status' attributes.  Previously,
those lines were incorrectly parsed and the 'name' attribute set to
'****', which is pretty obviously wrong.




Changes.html  view on Meta::CPAN

	<LI><A HREF="#Enhancements">Enhancements</A>
	<UL>

		<LI><A HREF="#Test_suite_is_disabled_by_defaul">Test suite is disabled by default.</A>
	</UL>

	<LI><A HREF="#Bugs">Bugs</A>
	<UL>

		<LI><A HREF="#Volume_status_value_inconsistenc">Volume status value inconsistency</A>
		<LI><A HREF="#AFS_Command_VOS_examine_parse">AFS::Command::VOS->examine parses busy and offline messages</A>
	</UL>

	<LI><A HREF="#Changes_in_1_3">Changes in 1.3</A>
	<LI><A HREF="#Enhancements">Enhancements</A>
	<UL>

		<LI><A HREF="#AFS_Command_VOS_release_suppo">AFS::Command::VOS->release support both -f and -force</A>
	</UL>

	<LI><A HREF="#Bugs">Bugs</A>

Changes.html  view on Meta::CPAN


<P>

These values have all been normalized to: online, offline


<P>

<P>
<HR>
<H2><A NAME="AFS_Command_VOS_examine_parse">AFS::Command::VOS->examine parses busy and offline messages

</A></H2>
When a volume is busy or can not be attached, ``vos examine'' will be
unable to display the volume headers. Instead, a one line message is
printed, such as one of the following:


<P>

<PRE>    **** Volume 123456789 is busy ****
    **** Could not attach volume 123456789 ****
</PRE>

<P>

The examine method now parses these, and the AFS::Object::VolumeHeader
object will have only the 'id' and 'status' attributes. Previously, those
lines were incorrectly parsed and the 'name' attribute set to '****', which
is pretty obviously wrong.

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

	# This code parses the volume header information.  If we match
	# this line, then we go after the information we expect to be
	# right after it.  We also test for this first, because we
	# might very well have several of these chunks of data for RO
	# volumes.
	#
	if ( /^\*{4}/ ) {

	    my $header = AFS::Object::VolumeHeader->new();

	    if ( /Volume (\d+) is busy/ ) {
		$header->_setAttribute
		  (
		   id			=> $1,
		   status		=> 'busy',
		   attached		=> 1,
		  );
	    } elsif ( /Could not attach volume (\d+)/ ) {
		$header->_setAttribute
		  (
		   id			=> $1,
		   status		=> 'offline',
		   attached		=> 0,
		  );
	    }

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

	while ( defined($_ = $self->{handle}->getline()) ) {

	    chomp;

	    last if /^\s*$/ && $args{fast};

	    next if /^\s*$/;

	    s/\s+$//;

	    if ( /^Total volumes onLine (\d+) ; Total volumes offLine (\d+) ; Total busy (\d+)/ ) {
		$partition->_setAttribute
		  (
		   online		=> $1,
		   offline		=> $2,
		   busy			=> $3,
		  );
		last;		# Done with this partition
	    }

	    if ( /Volume (\d+) is busy/ ) {
		my $volume = AFS::Object::VolumeHeader->new
		  (
		   id			=> $1,
		   status		=> 'busy',
		   attached		=> 1,
		  );
		$partition->_addVolumeHeader($volume);
		next;
	    } elsif ( /Could not attach volume (\d+)/ ) {
		my $volume = AFS::Object::VolumeHeader->new
		  (
		   id			=> $1,
		   status		=> 'offline',
		   attached		=> 0,

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

        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

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

    my $result = $vos->listvol
      (
       server			=> $server,,
       cell				=> $cell,
      ) || die $vos->errors();
    foreach my $partition ( $result->getPartitions() ) {
	my $partname 		= $partition->partition();
	my $total			= $partition->total();
	my $online			= $partition->online();
	my $offline			= $partition->offline();
	my $busy			= $partition->busy();
	print("Partition $partname has $total total volumes, of which " .
	      "$online are online, $offline are offline, and $busy are busy.\n");
	foreach my $header ( $partition->getVolumeHeaders() ) {
	    # Do something interesting with $header.
	}
    }

There are several other ways to get at the headers, of course.

	foreach my $name ( $partition->getVolumeNames() ) {
	    my $header = $partition->getVolumeHeaderByName($name)
	    # Do something interesting with $header.

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


This objects has several attributes, and several methods for
extracting the VolumeHeader objects.

    Attributes				Values
    ----------				------
    partition				Partition name
    total				Total number of volumes on the partition
    online				Total number of online volumes
    offline				Total number of offline volumes
    busy				Total number of busy volumes

    Methods				Returns
    -------				-------
    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

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

    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

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

       verbose                  => 1,
       encrypt                  => 1,
      );

=head2 offline

The vos help string is:

    Usage: vos offline -server <server name> -partition <partition name>
 		       -id <volume name or ID> [-sleep <seconds to sleep>]
                       [-busy] [-cell <cell name>]
 		       [-noauth] [-localauth] [-verbose] [-encrypt]

The corresponding method invocation looks like:

    my $result = $vos->offline
      (
       # Required arguments
       id			=> $id,
       server			=> $server,
       partition		=> $partition,
       # Optional arguments
       sleep			=> $sleep,
       busy			=> 1,
       cell                     => $cell,
       noauth                   => 1,
       localauth                => 1,
       verbose                  => 1,
       encrypt                  => 1,
      );

=head2 online

The vos help string is:



( run in 0.597 second using v1.01-cache-2.11-cpan-87723dcf8b7 )