AFS-Command

 view release on metacpan or  search on metacpan

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

    }

    $errors++ unless $self->_reap_cmds();
    $errors++ unless $self->_restore_stderr();

    return if $errors;
    return $result;

}

sub getrestart {

    my $self = shift;
    my (%args) = @_;

    my $result = AFS::Object::BosServer->new();

    $self->{operation} = "getrestart";

    return unless $self->_parse_arguments(%args);

    return unless $self->_save_stderr();

    my $errors = 0;

    $errors++ unless $self->_exec_cmds();

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

	if ( /restarts at (.*)/ || /restarts (never)/ ) {
	    $result->_setAttribute( restart => $1 );
	} elsif ( /binaries at (.*)/ || /binaries (never)/ ) {
	    $result->_setAttribute( binaries => $1 );
	}

    }

    $errors++ unless $self->_reap_cmds();
    $errors++ unless $self->_restore_stderr();

    return if $errors;

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

	    if ( /currently (.*)\.$/ ) {
		$instance->_setAttribute( status => $1 );
	    }

	}

	if ( /Auxiliary status is: (.*)\.$/ ) {
	    $instance->_setAttribute( auxiliary => $1 );
	}

	if ( /Process last started at (.*) \((\d+) proc starts\)/ ) {
	    $instance->_setAttribute
	      (
	       startdate		=> $1,
	       startcount		=> $2,
	      );
	}

	if ( /Last exit at (.*)/ ) {
	    $instance->_setAttribute( exitdate => $1 );
	}

	if ( /Last error exit at ([^,]+),/ ) {

	    $instance->_setAttribute( errorexitdate => $1 );

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

    ----------			------
    log				Contents of the logfile, or the redirect pathname

If redirect was given, then this attribute is simply same pathname.
If redirect was not given, then the value of this attribute is the
contents of the requested logfile, as a single (potentially huge)
string.

NOTE: Since this method is usually invoked to retrieve one of the AFS
logfiles, which can be enormous on heavily loaded servers that have
not been restarted in a while, use of the redirect option is strongly
encouraged.  If not used, the memory allocated to store the logfile
may be prohibitively large.  Developer beware.

=back

=head2 getrestart

=over

=item Arguments

The bos help string is:

    bos getrestart: get restart times
    Usage: bos getrestart -server <machine name> [-cell <cell name>]
			  [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->getrestart
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=item Return Values

This method returns an AFS::Object::BosServer object, which
contains two attributes.

    my $result = $bos->getrestart
      (
       server			=> $server,
       cell			=> $cell,
      ) || die $bos->errors();
    print "Binary restart time is " . $result->binaries() . "\n";
    print "Server restart time is " . $result->restart() . "\n";

The object has the following attributes:

B<AFS::Object::BosServer>

    Attributes			Values
    ----------			------
    restart			The server restart time
    binaries			The restart time when there are new, updated binaries

=back

=head2 listhosts

=over

=item Arguments

The bos help string is:

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

    Attributes			Values
    ----------			------
    auxiliary			Auxiliary status (date the next execution)

The following attributes are always available when the 'long' argument
is specified:

    Attributes			Values
    ----------			------
    type			"cron", "simple", or "fs"
    startdate			Date when the process was last started
    startcount			Number of times the process has started,
				since the bosserver was started
    exitdate			Date when the process last exited

The following attributes are optionally available, depending on the
state of the instance, when the 'long' argument is specified:

    Attributes			Values
    ----------			------
    notifier			Path to the notifier application for this instance
    state			"temporarily disabled", or "disabled", or "temporarily enabled"
    errorstop			Boolean, indicating the process was

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

      (
       # Required arguments
       server			=> $server,
       user			=> $user, # OR [ $user1, $user2, ... ]
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 restart

The bos help string is:

    bos restart: restart processes
    Usage: bos restart -server <machine name> [-instance <instances>+] [-bosserver]
		       [-all] [-cell <cell name>] [-noauth] [-localauth]
    Where: -bosserver  restart bosserver
	   -all        restart all processes

The corresponding method invocation looks like:

    my $result = $bos->restart
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       bosserver		=> 1,
       all			=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,

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

      (
       # Required arguments
       server			=> $server,
       name			=> $name,
       # Optional arguments
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 setrestart

The bos help string is:

    bos setrestart: set restart times
    Usage: bos setrestart -server <machine name> -time <time to restart server>
			  [-general] [-newbinary] [-cell <cell name>]
			  [-noauth] [-localauth]
    Where: -general    set general restart time
	   -newbinary  set new binary restart time

The corresponding method invocation looks like:

    my $result = $bos->setrestart
      (
       # Required arguments
       server			=> $server,
       time			=> $time,
       # Optional arguments
       general			=> 1,
       newbinary		=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,

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

       # Required arguments
       server			=> $server,
       # Optional arguments
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       wait			=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 start

The bos help string is:

    bos start: start running a server
    Usage: bos start -server <machine name> -instance <server process name>+
		     [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->start
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 startup

The bos help string is:

    bos startup: start all processes
    Usage: bos startup -server <machine name> [-instance <instances>+]
		       [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->startup
      (
       # Required arguments
       server			=> $server,
       # Optional arguments
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

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


=head2 exportafs

=over

=item Arguments

The fs help string is:

    fs exportafs: enable/disable translators to AFS
    Usage: fs exportafs -type <exporter name> [-start <start/stop translator (on | off)>]
		       [-convert <convert from afs to unix mode (on | off)>]
		       [-uidcheck <run on strict 'uid check' mode (on | off)>]
		       [-submounts <allow nfs mounts to subdirs of /afs/.. (on  | off)>]

The corresponding method invocation looks like:

    my $result = $fs->exportafs
      (
       # Required arguments
       type			=> $type,	# 'nfs' is the only supported value
       # Optional arguments
       start			=> $start,	# 'on' or 'off'
       convert			=> $convert,	# 'on' or 'off'
       uidcheck			=> $uidcheck,	# 'on' or 'off'
       submounts		=> $submounts,	# 'on' or 'off'
      );

NOTE: In a future release, the 4 optional arguments will probably take
boolean values, with "off" being a special case that means false, in
order to simply the interface (and be backwards compatible).

=item Return Values

This method returns an AFS::Object::CacheManager object with one or
more attributes.

    my $result = $fs->exportafs
      (
       type			=> 'nfs',
       start			=> 'on',
      ) || die $fs->errors();
    foreach my $attr ( qw( convert uidcheck submounts ) ) {
	print "Translator has '$attr' set to '" . $result->$attr() . "'\n";
    }

The object has the following attribute:

B<AFS::Object::CacheManager>

    Attributes			Values

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

	    }

	    $result->_addVolumeHeader($header);

	    next;

	}

	#
	# 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 ); }

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

    return unless $self->_save_stderr();

    my $errors = 0;

    $errors++ unless $self->_exec_cmds();

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

	chomp;

	next if /^\s*$/;	# If it starts with a blank line, then
				# its not a volume name.
	#
	# Skip the introductory lines of the form:
	# "VLDB entries for all servers"
	# "VLDB entries for server ny91af01"
	# "VLDB entries for server ny91af01 partition /vicepa"
	#
	next if /^VLDB entries for /;

	s/\s+$//g;		# Might be trailing whitespace...

t/10bos_basic.t  view on Meta::CPAN

if ( $file->getline() eq "$firstline\n" ) {
    print "ok $TestCounter\n";
} else {
    print "not ok $TestCounter..$TestTotal\n";
    warn("Contents of bos->getlog() do not match when fetched\n" .
	 "with and without 'redirect' option\n");
}
$TestCounter++;

#
# bos getrestart
#
$result = $bos->getrestart
  (
   server		=> $dbserver,
   cell			=> $cell,
  );
if ( ref $result && $result->isa("AFS::Object::BosServer") ) {
    print "ok $TestCounter\n";
    $TestCounter++;
} else {
    print "not ok $TestCounter..$TestTotal\n";
    die("Unable to getrestart for bosserver:\n" . $bos->errors());
}

foreach my $attr ( qw(restart binaries) ) {
    if ( $result->$attr() ) {
	print "ok $TestCounter\n";
    } else {
	print "not ok $TestCounter\n";
	warn("Unable to get $attr time from bos->getrestart()\n");
    }
    $TestCounter++;
}

#
# bos listhosts
#
$result = $bos->listhosts
  (
   server		=> $dbserver,

t/10bos_basic.t  view on Meta::CPAN

}

foreach my $name ( qw(vlserver ptserver) ) {

    my $instance = $result->getInstance($name);
    if ( ref $instance && $instance->isa("AFS::Object::Instance") ) {

	print "ok $TestCounter\n";
	$TestCounter++;

	foreach my $attr ( qw(status type startdate startcount) ) {
	    if ( $instance->$attr() ) {
		print "ok $TestCounter\n";
	    } else {
		print "not ok $TestCounter\n";
		warn("No attribute '$attr' for instance '$name' from getInstance()\n");
	    }
	    $TestCounter++;
	}

	my @commands = $instance->getCommands();



( run in 0.613 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )