116 lines
4.6 KiB
Plaintext
Executable File
116 lines
4.6 KiB
Plaintext
Executable File
.\"############################################################################
|
|
.\" $Id: gendlib.3,v 1.8 2010-02-02 00:04:34 chu11 Exp $
|
|
.\"############################################################################
|
|
.\" Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC.
|
|
.\" Copyright (C) 2001-2007 The Regents of the University of California.
|
|
.\" Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
|
.\" Written by Jim Garlick <garlick@llnl.gov> and Albert Chu <chu11@llnl.gov>.
|
|
.\" UCRL-CODE-2003-004.
|
|
.\"
|
|
.\" This file is part of Genders, a cluster configuration database.
|
|
.\" For details, see <http://www.llnl.gov/linux/genders/>.
|
|
.\"
|
|
.\" Genders is free software; you can redistribute it and/or modify it under
|
|
.\" the terms of the GNU General Public License as published by the Free
|
|
.\" Software Foundation; either version 2 of the License, or (at your option)
|
|
.\" any later version.
|
|
.\"
|
|
.\" Genders is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
.\" WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
.\" FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
.\" details.
|
|
.\"
|
|
.\" You should have received a copy of the GNU General Public License along
|
|
.\" with Genders. If not, see <http://www.gnu.org/licenses/>.
|
|
.\"############################################################################
|
|
.TH GENDLIB 3 "10/10/97" "LLNL" "GENDLIB"
|
|
.SH NAME
|
|
gendlib \- perl library for querying genders file
|
|
.SH SYNOPSIS
|
|
require ``/usr/lib/genders/gendlib.pl'';
|
|
.SH DESCRIPTION
|
|
This package contains common functions for manipulating the genders file.
|
|
Previously this code existed only in the nodeattr command, but applications
|
|
that must repeatedly call nodeattr would spend a great deal of time reading
|
|
and parsing the genders file. These functions create an in-memory
|
|
cache of genders on the first call; subsequent calls need
|
|
only reference the in-memory copy and are thus speeded up.
|
|
.LP
|
|
.B Initialization:
|
|
.LP
|
|
Genders::init([$path_genders])
|
|
.IP
|
|
Function normally called internally for initialization. It can be called
|
|
externally with a non-default genders file path and subsequent operations
|
|
will use this non-default data. May be called more than once to change
|
|
genders file.
|
|
.LP
|
|
.B Simple Queries:
|
|
.LP
|
|
Genders::hasattr($attribute, [$node])
|
|
.IP
|
|
Return 1 if node has attribute, 0 if not. If node is not specified,
|
|
use local node.
|
|
.LP
|
|
Genders::getattrval($attribute, [$node])
|
|
.IP
|
|
Return value of attribute held by node, or empty string if no value or
|
|
node does not have attribute. If node is not specified, use local node.
|
|
.LP
|
|
Genders::getnode([$attribute])
|
|
.IP
|
|
Return a list of nodes having the specified attribute. If a value is
|
|
also specified ("attr=val"), only nodes with the specified attribute and
|
|
value are returned. If no attribute is specified, getnode returns all
|
|
the nodes listed in the genders file.
|
|
.LP
|
|
Genders::getattr([$node])
|
|
.IP
|
|
Return a list of attributes held by node. If node is not specified, use
|
|
local node.
|
|
.LP
|
|
.B Complex Queries:
|
|
.LP
|
|
Genders::getallattr()
|
|
.IP
|
|
Return a list of all attributes in the genders file (one cluster only).
|
|
.LP
|
|
Genders::get_node_hash(\\%node)
|
|
.IP
|
|
Get a copy of hash of attributes to node lists for the current cluster
|
|
(a "hash of lists"). Ensure that keys exist for all possible attributes
|
|
across clusters (though they may point to empty lists).
|
|
.LP
|
|
Genders::get_clusters()
|
|
.IP
|
|
Return a list with the local cluster name as the first and only
|
|
element. get_clusters() returns a list instead of a scalar for
|
|
backwards compatability. If the local cluster name is not known, null
|
|
is returned.
|
|
.LP
|
|
Genders::gendexp($exp, [$node])
|
|
.IP
|
|
Evaluate expression involving genders attributes and return the result
|
|
of the evaluation. Any legal perl expresion using numeric constants,
|
|
genders attributes (which are converted into $variables), and the following
|
|
operators is valid: !, ||, &&, *, +, -, /. If $node is not specified,
|
|
assume the local host.
|
|
.LP
|
|
.B Conversion:
|
|
.LP
|
|
Genders::to_altnames()
|
|
.IP
|
|
Given a list of hostnames as they appear in the genders file, return
|
|
a list of alternate names. On the SP, genders names are assumed to be the
|
|
initial_hostnames, and we use the SDR to convert to reliable_hostnames.
|
|
On other systems, we look for the value of the altname attribute in the
|
|
genders file. If the input hostname cannot be converted, it is preserved
|
|
in the output.
|
|
.LP
|
|
Genders::to_gendnames()
|
|
.IP
|
|
Performs the inverse of the to_altnames() function. Just like to_altnames(),
|
|
an input hostname is preserved in the output if it cannot be converted.
|
|
.SH "SEE ALSO"
|
|
nodeattr(1), libgenders(3), Libgenders(3)
|