AFS-Command

 view release on metacpan or  search on metacpan

ToDo  view on Meta::CPAN


And how about passing the AFS::Object::Path objects returned from
$fs->whichcell directly to an $fs->listquota call, so that the final
AFS::Object::Path objects have all of the attributes returned by both
calls, but in one set of objects?

Look for this in version 1.1

=head2 stderr handling

stderr processing needs to be handled in the _exec_cmds() method, and
for that matter, _reap_cmds() needs to be folded into _exec_cmds().

The problem is that each API method calls _save_stderr(), and then
later calls _restore_stderr(), and we leave stderr redirected for
longer than necessary.  The contents of the redirected output should
be *only* the output from the commands we run, and right now, some of
our own carping can creep in there.

Worse, its possible that a failure in the API can leave stderr
redirected, resulting in a lot of confusion.

ToDo  view on Meta::CPAN

=head1 Bugs

=head2 stdout/stderr buffering will break the fs examine/diskfree commands

Actually, all of the commands that parse per-path output, really.
Currently the code assumes the stderr output will appear first, which
is a side effect of the buffering.  Some attempts to turn of buffering
didn't change this, and in any case, we don't want to be sensitive to
this (we currently are).

We need to process stderr first, to determine which paths had errors,
and then parse stdout.  This will require the change descibred above
for how we handle stderr.

=cut

ToDo.html  view on Meta::CPAN

Look for this in version 1.1


<P>

<P>
<HR>
<H2><A NAME="stderr_handling">stderr handling

</A></H2>
stderr processing needs to be handled in the <CODE>_exec_cmds()</CODE>
method, and for that matter, <CODE>_reap_cmds()</CODE> needs to be folded
into <CODE>_exec_cmds().</CODE>


<P>

The problem is that each API method calls <CODE>_save_stderr(),</CODE> and
then later calls <CODE>_restore_stderr(),</CODE> and we leave stderr
redirected for longer than necessary. The contents of the redirected output
should be *only* the output from the commands we run, and right now, some

ToDo.html  view on Meta::CPAN

</A></H2>
Actually, all of the commands that parse per-path output, really. Currently
the code assumes the stderr output will appear first, which is a side
effect of the buffering. Some attempts to turn of buffering didn't change
this, and in any case, we don't want to be sensitive to this (we currently
are).


<P>

We need to process stderr first, to determine which paths had errors, and
then parse stdout. This will require the change descibred above for how we
handle stderr.


<P>

</DL>
    </BODY>

    </HTML>

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


=head2 status

=over

=item Arguments

The bos help string is:

    bos status: show server instance status
    Usage: bos status -server <machine name> [-instance <server process name>+]
		      [-long] [-cell <cell name>] [-noauth] [-localauth]
    Where: -long       long status

The corresponding method invocation looks like:

    my $result = $bos->status
      (
       # Required arguments
       server			=> $server,
       # Optional arguments

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

       long			=> 1,
       noauth			=> 1,
       localauth		=> 1,
      );

=item Return Values

This method returns an AFS::Object::BosServer object, which
contains one optional attribute, and one or more
AFS::Object::Instance objects, each of which represents a
single instance of a bosserver managed process on the server.

    my $result = $bos->status
      (
       server			=> $server,
       long				=> 1,
      ) || die $bos->errors();
    foreach my $instanceobj ( $result->getInstances() ) {
	my $instance		= $instanceobj->instance();
	my $status			= $instanceobj->status();
	print "Instance $instance has status $status\n";

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
				"stopped for too many errors"
    core			Boolean, indicating the instance has a core file
    errorexitdate		Date when the process last exited with an error
    errorexitdue		"shutdown", or "signal", or "code" (present only when
				"errorexitdate" attribute is present)
    errorexitsignal		Signal that cause the error exit (present only when
				"errorexitdue" eq "signal")
    errorexitcode		Exit code from last error exit (present only when
				"errorexitdue" eq "code")

The following methods can be used to extract the command objects,
which are also only present when the 'long' argument is specified.

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

       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 create

The bos help string is:

    bos create: create a new server instance
    Usage: bos create -server <machine name> -instance <server process name>
		      -type <server type> -cmd <command lines>+ [-notifier <Notifier program>]
		      [-cell <cell name>] [-noauth] [-localauth]

The corresponding method invocation looks like:

    my $result = $bos->create
      (
       # Required arguments
       server			=> $server,
       instance			=> $instance,

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

       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 delete

The bos help string is:

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

The corresponding method invocation looks like:

    my $result = $bos->delete
      (
       # Required arguments
       server			=> $server,
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       # Optional arguments

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

       # 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,

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

       newbinary		=> 1,
       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 shutdown

The bos help string is:

    bos shutdown: shutdown all processes
    Usage: bos shutdown -server <machine name> [-instance <instances>+]
			[-wait] [-cell <cell name>] [-noauth] [-localauth]
    Where: -wait       wait for process to stop

The corresponding method invocation looks like:

    my $result = $bos->shutdown
      (
       # 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

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

       cell			=> $cell,
       noauth			=> 1,
       localauth		=> 1,
      );

=head2 stop

The bos help string is:

    bos stop: halt a server instance
    Usage: bos stop -server <machine name> -instance <server process name>+
		    [-wait] [-cell <cell name>] [-noauth] [-localauth]
    Where: -wait       wait for process to stop

The corresponding method invocation looks like:

    my $result = $bos->stop
      (
       # Required arguments
       server			=> $server,
       instance			=> $instance, # OR [ $inst1, $inst2, ... ]
       # Optional arguments
       wait			=> 1,

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

			if ( /^Usage:/ ) {
			    $operations{offline}++;
			    $operations{online}++;
			}
		    }
		}

	    }

	    unless ( waitpid($pid,0) ) {
		$self->_Carp("Unable to get status of child process ($pid)");
		return;
	    }

	    if ( $? ) {
		$self->_Carp("Error running @{$self->{command}} help.  Unable to configure $class");
		return;
	    }

	}

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

    #
    if ( $self->isa("AFS::Command::VOS") && $operation eq 'release' ) {
	if ( exists $arguments->{optional}->{f} ) {
	    $arguments->{aliases}->{force} = 'f';
	} elsif ( exists $arguments->{optional}->{force} ) {
	    $arguments->{aliases}->{f} = 'force';
	}
    }

    unless ( waitpid($pid,0) ) {
	$self->_Carp("Unable to get status of child process ($pid)");
	$errors++;
    }

    if ( $? ) {
	$self->_Carp("Error running @command $operation -help.  Unable to configure @command $operation");
	$errors++;
    }

    return if $errors;
    return $self->{_arguments}->{$operation} = $arguments;

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

carp and/or croak subroutines were properly configured.  If the values
are not CODE references, then this method will itself croak.

=head1 INSTANCE METHODS

=head2 errors

This method takes no arguments, and it returns a string, containing the
unparsed errors from the last command method invoked.  This string is
reset with each subsequent command method invocation.  The string is
normally the output written to stderr by the process, but in the case
of unparsed boolean commands, it contains both the stdout as well as
the stderr output.

    my $result = $vos->examine
      (
       id		=> $volname,
       cell		=> $cell,
      );
    unless ( $result ) {
        die "Unable to examine volname '$volname' in cell '$cell':" .

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

       # Optional arguments
       enable			=> 1,
       disable			=> 1,
       clear			=> 1,
      );

=head2 rxstatproc

The fs help string is:

    fs rxstatproc: Manage per process RX statistics
    Usage: fs rxstatproc [-enable] [-disable] [-clear]
    Where: -enable   Enable RX stats
	   -disable  Disable RX stats
	   -clear    Clear RX stats

The corresponding method invocation looks like:

    my $result = $fs->rxstatproc
      (
       # Optional arguments

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

=item filterin

This is an advanced feature, and one that allows the volume dump to be
filtered through any arbitrary number of commands after it is
uncompressed (optionally) and read by vos restore.  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.

Lacking a better example, let's assume the author's 'newversion'
utility is being applied to the restore process, rather than the dump.

    my $result = $vos->restore
      (
       ...
       filterin			=> [ 'newversion' ],
       ...
      );

If there were command line arguments for this command, then they must
be given as follows:



( run in 0.377 second using v1.01-cache-2.11-cpan-8d75d55dd25 )