4.0.0alpha.svn.7719
Amanda modules list
List of All Modules
All Amanda Releases

Amanda::Disklist

NAME

Amanda::Disklist - interface to the Amanda disklist

SYNOPSIS

  use Amanda::Config qw( :init :getconf );
  use Amanda::Disklist;

  # .. call config_init()
  my $cfgerr_level = Amanda::Disklist::read_disklist(
    filename => $ARGV[0],
    disk_class => "MyScript::Disk",
  );
  die("Config errors") if ($cfgerr_level >= $CFGERR_WARNINGS);
  my $dle = Amanda::Disklist::get_disk($ARGV[1], $ARGV[2]);
  die "No such DLE" unless defined($dle);

  print "Diskname for this DLE: ", $dle->{name}, "\n";
  print "Auth for this DLE's host: ", $dle->{host}->{auth}, "\n";
  print "'record':", dumptype_getconf($dle->{config}, $DUMPTYPE_RECORD), "\n";

OVERVIEW

The Amanda disklist is a part of its configuration, so this module is similar in function to Amanda::Config. In particular, read_disklist loads the disklist into process-global variables, and returns an error status similar to that of Amanda::Config. Those global variables are then used by the acces functions described below.

Amanda parses all DLE's as a simple tuple (host, diskname, device, dumptype, interface, spindle), linked to a dumptype. DLE's which specify additional dumptype parameters within the disklist file result in the creation of a "hidden" dumptype with those parameters. Consequently, most configuration data about a particular disk is available in an Amanda::Config::dumptype_t object, and that data is not reproduced by this package.

This package differs from the underlying C code in that it separates disk configuration from host configuration. Furthermore, the package does not provide storage for runtime parameters you might want to associate with hosts or disks. However, the objects this packages creates are simple hashrefs that can be blessed with arbitrary class names, so you can add whatever data and behaviors you like to these objects.

FUNCTIONS

read_disklist

my $cfgerr_level = Amanda::Disklist::read_disklist(filename => $diskfile);

reset_disklist

Amanda::Disklist::reset_disklist();

Reset the perl state from the C state.

match_disklist

Amanda::Disklist::match_disklist(user_msg => \&user_msg, exact_match => $exact_match, args => ["HOST", "DISK" ... ]);

Set the 'todo' field for dle entry matching the args.

do_on_match_disklist

Amanda::Disklist::match_disklist(user_msg => \&user_msg, exact_match => $exact_match, args => ["HOST", "DISK" ... ], disk_cb => \&disk_cb);

Call the disk_cb for each dles that match the args

add_holding_to_disklist

Amanda::Disklist::add_holding_to_disklist();

Add holding dle in the disklist if they are not there.

After calling Amanda::Config::config_init(), call read_disklist. The following parameters are available:

filename

Filename from which to read the disklist; defaults to the diskfile configuration parameter.

disk_class

Class with which to bless disk objects; defaults to Amanda::Disklist::Disk.

host_class

Class with which to bless host objects; defaults to Amanda::Disklist::Host.

interface_class

Class with which to bless interface objects; defaults to Amanda::Disklist::Interface.

read_disklist returns a config error level just like config_init. Once the disklist is loaded, call one of the following functions to access the disklist.

  get_host($host)           get the corresponding host object
  all_hosts()               get a list of all host objects
  get_disk($host, $disk)    get a specific disk object
  all_disks()               get a list of all disk objects
  get_interface($name)      get a specific interface object
  all_interfaces()          get a list of all interface objects

Objects

Amanda::Disklist::Disk

A disk object has the following keys:

host

Host object for this DLE

name

The disk name

device

The device, if one was specified separately from the disk name

spindle

The spindle specified in the disklist

config

An Amanda::Config::dumptype_t object giving the configuration for the disk; use dumptype_getconf and other functions from Amanda::Config to examine it.

Amanda::Disklist::Host

Note that, because host configuration parameters are specified in dumptypes, there is no config key for a host object. Instead, the relevant parameters are available as attributes of the object.

hostname

hostname of this host

amandad_path
client_username
ssh_keys
auth
maxdumps

configuration parameters

disks

an array containing the names of all of the disks on this host.

As a convenience, the Amanda::Disklist::Host class also provides methods get_disk($disk), to get a disk object on the host, and all_disks(), to get a list of all disk objects on this host.

Amanda::Disklist::Interface

Interface objects have only one key, config, containing a Amanda::Config::interface_t object; use interface_getconf and other functions from Amanda::Config to examine it.

ABOUT THIS PAGE

This page was automatically generated Tue Mar 19 07:08:16 2019 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.


4.0.0alpha.svn.7719