fence-agents: v3.9.1 annotated tag has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=839076...
Commit: 8390769c62390fee594b616321eb77553cfbdd30
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2013-07-01 13:34 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2013-07-01 13:34 +0000
annotated tag: v3.9.1 has been created
at 8390769c62390fee594b616321eb77553cfbdd30 (tag)
tagging 494e4cad8ac1db7d868510cd0a84199eb83adb6e (commit)
replaces v3.1.12
v3.9.1
Jan Pokorný (2):
lib: remove static metadata from fence.rng.head
fence2rng.xsl: parametrize and make more flexible
Marek 'marx' Grac (31):
fencing: Text in help is changed from foo=<value> to foo=[value]
fence agents: Text in help is changed from foo=<value> to foo=[value]
fence_vmnware_soap: Fix traceback when hostname cannot be resolved to IP address
fence_vmware_soap: Fix previous patch - fix traceback when hostname cannot be resolved
fence_cisco_ucs: fence agent does not respect "delay" attribute
fence_cisco_ucs: Fix traceback when hostname cannot be resolved to IP address
fence_virsh: Replace constant (1) with variable from --power-wait
fencing: Testing tool and dummy fence agent
fence agents: Fence agents errors are logged to syslog
testing: Add test suite for fence_drac on Dell DRAC IV
testing: Add verbose mode to testing library
fence_apc: Add support for firmware 5.x
fencing: Fix documentation for action 'monitor'
fencing: present default values for --ipport in --help
fencing: Fix indentation in --help message
fencing: All command prompt defaults should be list
fencing: Support multiple plugs for actions (e.g. --n 2,3,4)
testing: Add test for multiple ports feature
fencing: Install non-fence agents to libexec
fencing: Monitor/list is not working correctly
fencing: Validation if password/password_script or identity file is used was not processed
fence_scsi: Add "delay" option
fencing: Action 'monitor' is not working properly for fence agents without '--plugs'
fencing: Actions to set power status are not working properly for fence agents without --plug
fencing: Improve work with invalid power states
fence_dummy: Add a 'fail' test dummy agent
fence_dummy: An option to add random delay to start of this fence agents
fence_apc: Problem with <ENTER> prompt
fence_na: Remove fence agent node assassin
fencing: Add notice that command prompt is expected as python regex
fencing: --command-prompt option was useless because user cannot prepare list on command line
10 years, 10 months
fence-agents: v4.0.1 annotated tag has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=596272...
Commit: 5962729a17c3086fb565c94d630726c97ff4fa0e
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2013-07-01 12:59 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2013-07-01 12:59 +0000
annotated tag: v4.0.1 has been created
at 5962729a17c3086fb565c94d630726c97ff4fa0e (tag)
tagging c6d8c625c33451990473fef5ee735b18e28cdad1 (commit)
replaces v4.0.0
v4.0.1 release
Marek 'marx' Grac (13):
fencing: Monitor/list is not working correctly
fencing: Validation if password/password_script or identity file is used was not processed
fence_scsi: Add 'unfence' to manual page
fence_scsi: Add "delay" option
fencing: Action 'monitor' is not working properly for fence agents without '--plugs'
fence_dummy: Add a 'fail' test dummy agent
fencing: Actions to set power status are not working properly for fence agents without --plug
fencing: Improve work with invalid power states
fence_dummy: An option to add random delay to start of this fence agents
fence_apc: Problem with <ENTER> prompt
fence_na: Remove fence agent node assassin
fencing: Add notice that command prompt is expected as python regex
fencing: --command-prompt option was useless because user cannot prepare list on command line
10 years, 10 months
fence-agents: master - fencing: --command-prompt option was useless because user cannot prepare list on command line
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c6d8c6...
Commit: c6d8c625c33451990473fef5ee735b18e28cdad1
Parent: 801d4575bff12924ae6ab56d4148e81a9e1cedd4
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Jul 1 14:49:18 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Jul 1 14:49:18 2013 +0200
fencing: --command-prompt option was useless because user cannot prepare list on command line
User input is automatically translated into list.
---
fence/agents/lib/fencing.py.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 89b1385..097c167 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -904,6 +904,9 @@ def fence_login(options):
if (options.has_key("eol") == False):
options["eol"] = "\r\n"
+ if options.has_key("--command-prompt") and type(options["--command-prompt"]) is not list:
+ options["--command-prompt"] = [ options["--command-prompt"] ]
+
## Do the delay of the fence device before logging in
## Delay is important for two-node clusters fencing but we do not need to delay 'status' operations
if options["--action"] in ["off", "reboot"]:
10 years, 10 months
fence-agents: master - fencing: Add notice that command prompt is expected as python regex
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=801d45...
Commit: 801d4575bff12924ae6ab56d4148e81a9e1cedd4
Parent: 83e028b1271721d4744cfb51be3f215ab65decca
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Jul 1 14:23:50 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Jul 1 14:23:50 2013 +0200
fencing: Add notice that command prompt is expected as python regex
---
fence/agents/lib/fencing.py.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 12521de..89b1385 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -151,8 +151,8 @@ all_opt = {
"cmd_prompt" : {
"getopt" : "c:",
"longopt" : "command-prompt",
- "help" : "-c, --command-prompt=[prompt] Force command prompt",
- "shortdesc" : "Force command prompt",
+ "help" : "-c, --command-prompt=[prompt] Force Python regex for command prompt",
+ "shortdesc" : "Force Python regex for command prompt",
"required" : "0",
"order" : 1 },
"secure" : {
10 years, 10 months
fence-agents: master - fence_na: Remove fence agent node assassin
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=83e028...
Commit: 83e028b1271721d4744cfb51be3f215ab65decca
Parent: 825e2739411c1421fba2090a71244ad1a3299a7b
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Jul 1 12:08:09 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Jul 1 12:08:09 2013 +0200
fence_na: Remove fence agent node assassin
Fence agent temporary removed as requested by author because project
is in "extended hiatus"
http://www.redhat.com/archives/cluster-devel/2013-June/msg00183.html
---
configure.ac | 1 -
fence/agents/node_assassin/Makefile.am | 49 --
fence/agents/node_assassin/fence_na.conf.in | 87 ---
fence/agents/node_assassin/fence_na.lib.in | 978 ---------------------------
fence/agents/node_assassin/fence_na.pl | 171 -----
fence/agents/node_assassin/fence_na.pod.in | 188 -----
6 files changed, 0 insertions(+), 1474 deletions(-)
diff --git a/configure.ac b/configure.ac
index de4124d..f3acb13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -276,7 +276,6 @@ AC_CONFIG_FILES([Makefile
fence/agents/lpar/Makefile
fence/agents/manual/Makefile
fence/agents/mcdata/Makefile
- fence/agents/node_assassin/Makefile
fence/agents/nss_wrapper/Makefile
fence/agents/rackswitch/Makefile
fence/agents/rhevm/Makefile
diff --git a/fence/agents/node_assassin/Makefile.am b/fence/agents/node_assassin/Makefile.am
deleted file mode 100644
index 6c0f708..0000000
--- a/fence/agents/node_assassin/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-TARGET = fence_na
-
-EXTRA_DIST = $(TARGET).pl \
- $(TARGET).conf.in \
- $(TARGET).lib.in \
- $(TARGET).pod.in
-
-fencelibdir = ${FENCEAGENTSLIBDIR}
-
-fencelib_DATA = $(TARGET).lib
-
-conffiledir = ${DEFAULT_CONFIG_DIR}
-
-conffile_DATA = $(TARGET).conf
-
-sbin_SCRIPTS = $(TARGET)
-
-man_MANS = $(TARGET).8
-
-$(TARGET): $(TARGET).pl
- cat $^ | sed \
- -e 's#@''NACONFFILE(a)#${conffiledir}/$(TARGET).conf#g' \
- -e 's#@''FENCEAGENTSLIBDIR@#${FENCEAGENTSLIBDIR}#g' \
- > $@
-
-$(TARGET).pod: $(TARGET).pod.in
- cat $^ | sed \
- -e 's#@''NACONFFILE(a)#${conffiledir}/$(TARGET).conf#g' \
- > $@
-
-$(TARGET).8: $(TARGET).pod
- pod2man --section=8 $< $@
-
-$(TARGET).conf: $(TARGET).conf.in
- cat $^ | sed \
- -e 's#@''LOGDIR@#${LOGDIR}#g' \
- -e 's#@''CONFDIR@#${DEFAULT_CONFIG_DIR}#g' \
- -e 's#@''CONFFILE@#${DEFAULT_CONFIG_FILE}#g' \
- > $@
-
-$(TARGET).lib: $(TARGET).lib.in
- cat $^ | sed \
- -e 's#@''NACONFFILE(a)#${conffiledir}/$(TARGET).conf#g' \
- > $@
-
-clean-local:
- rm -f $(TARGET) $(TARGET).pod $(TARGET).8 $(TARGET).conf $(TARGET).lib
diff --git a/fence/agents/node_assassin/fence_na.conf.in b/fence/agents/node_assassin/fence_na.conf.in
deleted file mode 100644
index 53a8956..0000000
--- a/fence/agents/node_assassin/fence_na.conf.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# This is the main configuration file for the Node Assassin fence device.
-#
-# This can support one or more fence devices.
-#
-# Node Assassin - Fence Agent
-# Digimer; digimer(a)alteeve.com
-# Nov. 27, 2010
-# Version: 1.1.6
-#
-# This software is released under the GPL v2. See the LICENSE file for a copy
-# of the GPL v2.
-
-###############################################################################
-# System: #
-# - Here you setup general values for the fence agent and any/all nodes. #
-###############################################################################
-
-# This must be set to the number of Node Assassin devices you are using. It
-# must be a positive integer.
-#system::na_num = 1
-system::na_num = 1
-
-# Version of the fence_na fence agent.
-system::agent_version = 1.1.6
-
-# This is the log file. If unset, no logging will occur. If using '/var/log/',
-# be sure that this agent is able to create or edit the file. The default is to
-# write to '/tmp' to prevent accidental failure of the agent due to
-# misconfiguration.
-#system::log = @LOGDIR(a)/fence_na.log
-system::log = @LOGDIR(a)/fence_na.log
-
-# If set to '1', messages to STDOUT will be surpressed except in the event of
-# errors. This can be overridden at the command line with the '-q' switch.
-system::quiet = 0
-
-# Set this to '1' to enable extra debug information. Ignored if 'system::quiet'
-# is set.
-system::debug = 0
-
-# This is the authentication information... It is currently a simple plain text
-# compare, but this will change prior to first release.
-system::username = admin
-system::password = secret
-
-
-###############################################################################
-# Devices: #
-# - Here you setup each fence device. There must be a corresponding #
-# 'node::X::var' for each node where 'X' is between 1 and 'system::na_num'. #
-###############################################################################
-
-### Define values for Node 1.
-
-# The node assassin name. This must match exactly with the name programmed into
-# the given node.
-na::1::na_name = fence_na01
-
-# This is the IP address and port where I will connect to this node at.
-# NOTE: THIS MUST MATCH THE VALUE USED IN '@CONFDIR@/@CONFFILE@'! If you
-# used a resolvable name there, use the same name here. Vice versa for IP
-# addresses. If this doesn't match the 'ipaddr' argument sent by the 'fenced'
-# daemon the fence will not work properly!
-na::1::ipaddr = fence_na01.domain.com
-na::1::tcp_port = 238
-
-# This is the number of nodes supported by this Node Assassin
-# (1 node = 2 ports; odd # = reset, even # = power)
-na::1::max_nodes = 4
-
-# These values are set when the node assassin program switch is run.
-# NOT YET IMPLEMENTED.
-na::1::mac = 02:00:00:FF:F0:AA
-na::1::netmask = 255.255.255.0
-na::1::gateway = 192.168.1.1
-
-# These are aliases for each Node Assassin port. They should match the name or
-# URI of the node connected to the given port. This is optional but will make
-# the fenced 'list' argument more accurate and sane. If a port is listed here,
-# then the 'list' action will return '<node_id>,<value>'. If a port is not
-# defined, 'list' will return '<node_id>,<node::X::name-node_id>'. If a port is
-# set to 'unused', it will be skipped when replying to a 'list'.
-na::1::alias::1 = node01.domain.com
-na::1::alias::2 = node02.domain.com
-na::1::alias::3 = unused
-na::1::alias::4 = unused
-
diff --git a/fence/agents/node_assassin/fence_na.lib.in b/fence/agents/node_assassin/fence_na.lib.in
deleted file mode 100644
index dec734a..0000000
--- a/fence/agents/node_assassin/fence_na.lib.in
+++ /dev/null
@@ -1,978 +0,0 @@
-#!/usr/bin/perl
-#
-# This is the function library for the Node Assassin fence agent.
-#
-# Node Assassin - Fence Agent
-# Digimer; digimer(a)alteeve.com
-# Nov. 27, 2010.
-# Version: 1.1.6
-#
-# This software is released under the GPL v2. See the LICENSE file for a copy
-# of the GPL v2.
-
-
-# This connects to a Node Assassin and puts the handle in
-# $conf->{'system'}{handle}.
-sub connect_to_na
-{
- my ($conf, $log)=@_;
- $conf->{na}{handle}=new Net::Telnet(
- Timeout => 10,
- Errmode => 'die',
- Port => $conf->{na}{tcp_port},
- Prompt => '/EOM$/',
- Errmode => 'return'
- ) or do_exit($conf, $log, 1);
- $conf->{na}{handle}->open($conf->{na}{ipaddr});
- if ($conf->{na}{handle}->errmsg)
- {
- record($conf, $log, "Connection to Node Assassin: [$conf->{na}{ipaddr}] failed.\nError was: [".$conf->{na}{handle}->errmsg."]\n", 1);
- $conf->{na}{handle}="";
- };
- record($conf, $log, "na::handle: [$conf->{na}{handle}]\n") if $conf->{'system'}{debug};
-
- return ($conf->{na}{handle});
-}
-
-# This handles the actual execution of an action plan.
-sub do_actions
-{
- my ($conf, $log)=@_;
-
- # In the next step, when a 'check' is seen, the node's power feed is
- # checked and an exit status is stored here. Exits 0, 1 and 2 have
- # special meaning, so I default to 9 as it has no meaning to the
- # FenceAgentAPI.
- my $exit_code=9;
-
- # Process the orders.
- print "Processing: [$conf->{'system'}{call_order}]\n";
- foreach my $order (split/,/, $conf->{'system'}{call_order})
- {
- record($conf, $log, "Calling: [$order]\n") if $conf->{'system'}{debug};
-
- # Handle a 'release_all' call.
- if ($order eq "release_all")
- {
- set_all_state($conf, $log, 0);
- next;
- }
-
- # Handle a 'fence_all' call.
- if ($order eq "fence_all")
- {
- set_all_state($conf, $log, 1);
- next;
- }
-
- # handle a sleep request. This defaults to one second when no
- # integer was included.
- if ($order=~/^sleep/)
- {
- my $time=$order=~/sleep (\d+)/ ? $1 : 1;
- record ($conf, $log, "Sleeping: $time, ");
- if ($time == 1)
- {
- sleep 1;
- record ($conf, $log, "Done.\n");
- }
- else
- {
- while ($time)
- {
- $time--;
- sleep 1;
- record ($conf, $log, "$time, ") if $time > 1;
- record ($conf, $log, "$time. Done.\n") if $time == 1;
- }
- }
- next;
- }
-
- # Handle a status check via Node Assassin.
- record($conf, $log, "order: [$order]\n") if $conf->{'system'}{debug};
- if ($order=~/(\d\d):(\D+)/)
- {
- my $node=$1;
- my $check=$2;
-
- # Verify the state of the port.
- record($conf, $log, "Status check on node: [$node] -> [$check]\n") if $conf->{'system'}{debug};
-
- # Get the state.
- my $states=get_states($conf, $log);
- if ($states == 1)
- {
- # I had a connection problem. Exit with error
- # code '1' as per:
- # http://sources.redhat.com/cluster/wiki/FenceAgentAPI
- do_exit($conf, $log, 1);
- }
-
- # Make the states a bit easier to type.
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
-
- # Return the status of the requested node.
- record($conf, $log, "Node Assassin: [#$conf->{'system'}{na_id}/$conf->{na}{na_name}], Node: [$node] Power/Reset/Feed states: [$power_state/$reset_state/$feed_state]\n") if $conf->{'system'}{debug};
- if ($check eq "check")
- {
- # Return '2' if the node is off and '0' if it
- # is on.
- $exit_code=$feed_state ? 0 : 2;
- }
- elsif ($check eq "off")
- {
- # 'off' was called, make sure the node is now
- # off. This may be called by 'reboot' in which
- # case 'exit_code' will simply be over-written
- # when the final 'reboot' state check is called.
- $exit_code=$feed_state ? 1 : 0;
- }
- elsif ($check eq "on")
- {
- # 'on' was called, make sure the node is now
- # off.
- $exit_code=$feed_state ? 0 : 1;
- }
- elsif ($check eq "reboot")
- {
- # Make sure that 'exit_code' was set to '0' by
- # the earlier call. We checked again to make
- # sure the node came back up, and will log an
- # error if it didn't, but we return '0' just
- # the same, as per the API.
- if (not $exit_code)
- {
- # The power off portion worked. Check if the
- # node booted properly and record an error if
- # not.
- if (not $feed_state)
- {
- record($conf, $log, "\nWARNING: Node: [$node] failed to boot after a successful power off during a\n", 1);
- record($conf, $log, "WARNING: reboot action. This is a non-critical error as the node was fenced\n", 1);
- record($conf, $log, "WARNING: successfully but may indicate a hardware failure with the node or\n", 1);
- record($conf, $log, "WARNING: with Node Assassin itself.\n\n", 1);
- }
- }
- else
- {
- # The power off portion failed, exit with '1'.
- $exit_code=1;
- }
- $exit_code=$feed_state ? 0 : 1;
- }
- next;
- }
-
- # Handle a fence call.
- my @set_state=$conf->{na}{handle}->cmd("$order");
- foreach my $line (@set_state)
- {
- chomp $line;
- next if not $line;
- record($conf, $log, "$line\n");
- }
- record($conf, $log, "Call complete.\n") if $conf->{'system'}{debug};
- }
-
- return ($exit_code);
-}
-
-# This cleanly exits the agent.
-sub do_exit
-{
- ($conf, $log, $exit_status)=@_;
- $exit_status=9 if not defined $exit_status;
-
- # Close the Node Assassin and log file handle, if they exist.
- $conf->{na}{handle}->close() if $conf->{na}{handle};
- $log->close() if $log;
-
- exit ($exit_status);
-}
-
-# This gets the states for the active node and returns the states in a hash
-# reference.
-sub get_states
-{
- my ($conf, $log)=@_;
-
- # Create the hash reference to store the states in.
- my $states={};
-
- # Call '00:0' to get the states. If it fails, return 1 as per
- # FenceAgentAPI requirements.
- my @check_state=$conf->{na}{handle}->cmd("00:0") or return(1);
-
- # Loop through the output.
- foreach my $line (@check_state)
- {
- # Chomp the newline off and then pull the port and state out.
- chomp $line;
- my ($this_node, $power_state, $reset_state, $feed_state)=($line=~/^- Node (\d+): P(\d+), R(\d+), F(\d+)$/);
- # Skip if this isn't a status line.
- next if not $this_node;
- # Convert the state to a simple on/off.
- # Store the state.
- $states->{$this_node}{power_state}=$power_state;
- $states->{$this_node}{reset_state}=$reset_state;
- $states->{$this_node}{feed_state}=$feed_state;
- record($conf, $log, "Node: [$this_node], Power State: [$states->{$this_node}{power_state}], Reset State: [$states->{$this_node}{reset_state}], Feed State: [$states->{$this_node}{feed_state}].\n") if $conf->{'system'}{debug};
- }
-
- # Return the hash reference.
- return ($states);
-}
-
-# This returns the 'help' message.
-sub help
-{
- my ($conf, $log)=@_;
-
- # Point the user at the man page.
- print "See 'man fence_na' for instructions on using the Node Assassin Fence Agent.\n";
-
- do_exit($conf, $log, 0);
-}
-
-# This error message is printed when there was a connection problem with a
-# given Node Assassin.
-sub no_connection_error
-{
- my ($conf, $log, $na_id)=@_;
- record ($conf, $log, "\nERROR: Unable to query Node Assassin: [$conf->{na}{$na_id}{na_name}]!\n", 1);
- record ($conf, $log, "ERROR: Please check that it is connected, that the information in\n", 1);
- record ($conf, $log, "ERROR: '@NACONFFILE@' is accurate and that the proper\n", 1);
- record ($conf, $log, "ERROR: configuration has be uploaded to the device.\n\n", 1);
- return (0);
-}
-
-# This handles the actual actions.
-sub process_action
-{
- my ($conf, $log)=@_;
- record($conf, $log, "In the 'process_action' function.\n") if $conf->{'system'}{debug};
-
- # Make this more readable.
- my $na_id=$conf->{'system'}{na_id};
- my $action=$conf->{na}{action};
- my $node=$conf->{na}{port};
- record($conf, $log, "na_id: [$na_id], action: [$action], port: [$node]\n") if $conf->{'system'}{debug};
-
- # The following actions require a port. Error if I don't have one.
- if ($node eq "00")
- {
- # These are the incompatible calls.
- if (($action eq "on") || ($action eq "off") || ($action eq "reboot") || ($action eq "status"))
- {
- record($conf, $log, "\nERROR! Action request: [$action] requires a port number!\n", 1) if $conf->{'system'}{debug};
- record($conf, $log, "ERROR: I got: [$node] which does not seem to be valid.\n\n", 1);
- do_exit($conf, $log, 9);
- }
- }
-
- # Make sure my call order is clear.
- $conf->{'system'}{call_order}="";
- if ($action eq "on")
- {
- # Release the fence, if fenced, and boot the node.
- $states=get_states($conf, $log);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- if ($feed_state)
- {
- # Node is already running.
- record($conf, $log, "Asked to turn on node: [$node], but it's already running.\n");
- do_exit($conf, $log, 0);
- }
- elsif (($power_state) || ($reset_state))
- {
- # Node was fenced, release it first.
- $conf->{'system'}{call_order}="$node:0,sleep,";
- }
- $conf->{'system'}{call_order}.="$node:2,sleep,$node:on";
- }
- elsif ($action eq "off")
- {
- # Fence the node.
- $conf->{'system'}{call_order}="$node:1,sleep,$node:off";
- }
- elsif ($action eq "reboot")
- {
- # I don't do this gracefully because the API says this should
- # be an 'off' -> 'on' process, and 'off' is fence...
- $conf->{'system'}{call_order}="$node:1,sleep,$node:0,sleep,$node:off,$node:2,sleep,$node:on";
- }
- elsif ($action eq "status")
- {
- # This checks the node's power feed.
- $conf->{'system'}{call_order}="$node:check";
- }
- ### ALL ACTIONS BELOW HERE ARE OUTSIDE OF THE FenceAgentAPI!
- elsif ($action eq "release")
- {
- # Release the given node without booting it.
- $conf->{'system'}{call_order}="$node:0";
- }
- elsif ($action eq "release_all")
- {
- # Release all ports.
- $conf->{'system'}{call_order}="release_all";
- }
- elsif ($action eq "fence_all")
- {
- # Fence all ports.
- $conf->{'system'}{call_order}="fence_all";
- }
- elsif ($action eq "boot")
- {
- # Boot the specific node if it is off.
- $states=get_states($conf, $log);
-
- # Decide how, or if, to proceed based on the current state of
- # each node.
- $node=sprintf("%02d", $node);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- if (($power_state) || ($reset_state))
- {
- # Node was fenced, release first.
- $conf->{'system'}{call_order}.="$node:0,sleep,";
- }
- if (not $feed_state)
- {
- # Boot the node.
- $conf->{'system'}{call_order}.="$node:2,sleep,";
- }
- else
- {
- record($conf, $log, "WARNING: Node: [$node] seems to be already on, taking no action.\n", 1);
- }
- $conf->{'system'}{call_order}=~s/,$//;
- }
- elsif ($action eq "boot_all")
- {
- # Boot all nodes that are off.
- $states=get_states($conf, $log);
-
- # Decide how, or if, to proceed based on the current state of
- # each node.
- foreach my $node (1..$conf->{na}{max_nodes})
- {
- $node=sprintf("%02d", $node);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- if (($power_state) || ($reset_state))
- {
- # Node was fenced, release first.
- $conf->{'system'}{call_order}.="$node:0,sleep,";
- }
- if (not $feed_state)
- {
- # Boot the node.
- $conf->{'system'}{call_order}.="$node:2,sleep,";
- }
- }
- $conf->{'system'}{call_order}=~s/,$//;
- }
- elsif ($action eq "shutdown")
- {
- # Shutdown a specific node that is on cleanly via ACPI.
- $states=get_states($conf, $log);
- $node=sprintf("%02d", $node);
- my $feed_state=$states->{$node}{feed_state};
- if ($feed_state)
- {
- # shutdown the node.
- $conf->{'system'}{call_order}.="$node:2";
- }
- else
- {
- record($conf, $log, "WARNING: Node: [$node] seems to be already off, taking no action. Is the cable connected?\n", 1);
- }
- $conf->{'system'}{call_order}=~s/,$//;
- }
- elsif ($action eq "shutdown_all")
- {
- # Shutdown all nodes that are on cleanly via ACPI.
- $states=get_states($conf, $log);
-
- # Decide how, or if, to proceed based on the current state of
- # each node.
- foreach my $node (1..$conf->{na}{max_nodes})
- {
- $node=sprintf("%02d", $node);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- if ($feed_state)
- {
- # Shutdown the node.
- $conf->{'system'}{call_order}.="$node:2,sleep,";
- }
- }
- $conf->{'system'}{call_order}=~s/,$//;
- }
- elsif ($action eq "forcedown_all")
- {
- # Shutdown all nodes that are on by holding the power button
- # until they go down.
- $states=get_states($conf, $log);
-
- # Decide how, or if, to proceed based on the current state of
- # each node.
- foreach my $node (1..$conf->{na}{max_nodes})
- {
- $node=sprintf("%02d", $node);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- if ($feed_state)
- {
- # Boot the node.
- $conf->{'system'}{call_order}.="$node:3,sleep,";
- }
- }
- $conf->{'system'}{call_order}=~s/,$//;
- }
- else
- {
- record($conf, $log, "\nERROR: Unknown action request: [$action]!\n\n", 1);
- do_exit($conf, $log, 9);
- }
-}
-
-# Read in the config file.
-sub read_conf
-{
- my ($conf)=@_;
- $conf={} if not $conf;
-
- # I can't call the 'record' method here because I've not read in the
- # log file and thus don't know where to write the log to yet. Comment
- # out or delete 'print' statements before release.
- my $read=IO::Handle->new();
- my $shell_call="$conf->{'system'}{conf_file}";
- record($conf, $log, "Shell call: [$shell_call]\n") if $conf->{'system'}{debug};
- open ($read, "<$shell_call") or die "Failed to read: [$shell_call], error was: $!\n";
- while (<$read>)
- {
- chomp;
- my $line=$_;
- next if not $line;
- next if $line !~ /=/;
- $line=~s/^\s+//;
- $line=~s/\s+$//;
- next if $line =~ /^#/;
- next if not $line;
- my ($var, $val)=(split/=/, $line, 2);
- $var=~s/^\s+//;
- $var=~s/\s+$//;
- $val=~s/^\s+//;
- $val=~s/\s+$//;
- next if (not $var);
- record($conf, $log, "Storing: [$var] = [$val]\n") if $conf->{'system'}{debug};
- _make_hash_reference($conf, $var, $val);
- }
- $read->close();
-
- return (0);
-}
-
-# Read in command line arguments
-sub read_cla
-{
- my ($conf, $log, $bad)=@_;
-
- # Loop through the passed arguments, if any.
- record($conf, $log, "Got args:\n") if $conf->{'system'}{debug};
- my $set_next="";
- foreach my $arg (@ARGV)
- {
- record($conf, $log, "[$arg]\n") if $conf->{'system'}{debug};
- $conf->{'system'}{got_cla}=1;
-
- # If 'set_next' has a value, push this argument into the 'conf'
- # hash.
- if ($set_next)
- {
- # It's set, use it's contents as the hash key.
- $conf->{na}{$set_next}=$arg;
- record($conf, $log, "Setting: 'na::$set_next': [$conf->{na}{$set_next}]\n") if $conf->{'system'}{debug};
-
- # Clear it now for the next go-round.
- $set_next="";
- next;
- }
- if ($arg=~/-h/)
- {
- # Print the help message and then exit.
- help($conf, $log);
- }
- elsif ($arg=~/-v/)
- {
- # Print the version information and then exit.
- $conf->{'system'}{version}=1;
- record($conf,$log,"Setting version\n") if $conf->{'system'}{debug};
- }
- elsif ($arg=~/-q/)
- {
- # Suppress all non-critical messages from STDOUT.
- $conf->{'system'}{quiet}=1;
- }
- elsif ($arg=~/-d/)
- {
- # Enable debug mode.
- $conf->{'system'}{debug}=1;
- }
- elsif ($arg=~/^-/)
- {
- $arg=~s/^-//;
-
- ### These are the switches set by Red Hat.
- if ($arg eq "a")
- {
- # This is the IP address or hostname of the
- # Node Assassin to call.
- $set_next="ipaddr";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- elsif ($arg eq "l")
- {
- # This is the login name.
- $set_next="login";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- elsif ($arg eq "p")
- {
- # This is the password. If it starts with '/'
- # it is interpreted to be a file containing the
- # password which will be read in and it's
- # contents will replace# this value.
- $set_next="passwd";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- elsif ($arg eq "n")
- {
- # This is the node to work on.
- $set_next="port";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- elsif ($arg eq "o")
- {
- # This is the action to take.
- $set_next="action";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- elsif ($arg eq "S")
- {
- # This is the script to run to retrieve the
- # password when it is not stored in
- # 'cluster.conf'. This script should echo/print
- # the password to STDOUT.
- $set_next="passwd_script";
- record ($conf, $log, "Next argument will be stored in: [$set_next]\n") if $conf->{'system'}{debug};
- }
- }
- else
- {
- ### MADI: I might want to pick up arguments via multiple lines.
- # Bad argument.
- record($conf, $log, "\nERROR: Argument: [$arg] is not valid!\n");
- record($conf, $log, "ERROR: Please run: [man fence_na] to see a list of valid arguments.\n\n");
- $bad=1;
- }
- }
-}
-
-# Read arguments from STDIN. This is adapted from the 'fence_brocade' agent.
-sub read_stdin
-{
- my ($conf, $log, $bad)=@_;
-
- return (0) if $conf->{'system'}{got_cla};
-
- my $option;
- my $line_count=0;
- while(defined (my $option=<>))
- {
- # Get rid of newlines.
- chomp $option;
-
- # Record the line for now, but comment this out before release.
- record ($conf, $log, "Processing option line: [$option]\n") if $conf->{'system'}{debug};
-
- # strip leading and trailing whitespace
- $option=~s/^\s*//;
- $option=~s/\s*$//;
-
- # skip comments
- next if ($option=~ /^#/);
-
- # Increment my option line count.
- $line_count++;
-
- # Go to the next line if the option line is empty.
- next if not $option;
-
- # Split the option up into the name and the value.
- ($name,$value)=split /\s*=\s*/, $option;
-
- # Record the line for now, but comment this out before release.
- record ($conf, $log, "Name: [$name], value: [$value].\n") if $conf->{'system'}{debug};
-
- # Set my variables depending on the veriable name.
- if ($name eq "agent")
- {
- # This is only used by 'fenced', but I record it for
- # potential debugging.
- $conf->{na}{agent}=$value;
- }
- elsif ($name eq "fm")
- {
- # This is a deprecated argument that should no longer
- # be used. Now 'port' should be used.
- if (not $conf->{na}{port})
- {
- # Port isn't set yet, use this value which may
- # be replaced if 'port' is set later.
- (undef, $value) = split /\s+/,$value;
- $conf->{na}{port}=$value;
- record($conf, $log, "Warning! The argument 'fm' is deprecated, use 'port' instead.\n", 1);
- record($conf, $log, "Warning! Value: [$value] set for 'port'\n", 1);
- }
- else
- {
- # Port was already set, so simply ignore this.
- record($conf, $log, "Warning! The argument 'fm' is deprecated, use 'port' instead.\n", 1);
- record($conf, $log, "Warning! Value: [$value] ignored.\n", 1);
- }
- }
- elsif ($name eq "ipaddr")
- {
- # Record the IP Address or name of the Node Assassin to
- # use.
- $conf->{na}{ipaddr}=$value;
- }
- elsif ($name eq "login")
- {
- # Record the login name that was passed.
- $conf->{na}{login}=$value;
- }
- elsif ($name eq "name")
- {
- # Depricated argument used formerly for login name.
- if (not $conf->{na}{login})
- {
- # Login isn't set yet, use this value which may
- # be replaced if 'login' is seen later.
- $conf->{na}{login}=$value;
- record($conf, $log, "Warning! The argument 'name' is deprecated, use 'login' instead.\n", 1);
- record($conf, $log, "Warning! Value: [$value] set for 'login'.\n", 1);
- }
- else
- {
- # I've already seen the 'login' value so I will
- # ignore this value.
- record($conf, $log, "Warning! The argument 'name' is deprecated, use 'login' instead.\n", 1);
- record($conf, $log, "Warning! Value: [$value] ignored.\n", 1);
- }
- }
- elsif (($name eq "action") or ($name eq "option"))
- {
- # 'option' is deprecated.
- record($conf, $log, "Please use 'action', not 'option', as the later is deprecated.\n", 1) if $name eq "option";
- $conf->{na}{action}=$value;
- }
- elsif ($name eq "passwd")
- {
- # This is the login password.
- $conf->{na}{passwd}=$value;
- }
- elsif ($name eq "passwd_script")
- {
- # This is the path to the script that will return the
- # password to the agent. At this time, this is not
- # implemented.
- $conf->{na}{passwd_script}=$value;
- }
- elsif ($name eq "port")
- {
- # This sets the port number to act on.
- $conf->{na}{port}=$value;
- }
- elsif ($name eq "nodename")
- {
- # This is passed by 'fenced' via 'cluster.conf' as of
- # cluster version 3, but it's not yet documented.
- $conf->{'system'}{nodename}=$value;
- }
- elsif ($name eq "quiet")
- {
- # This is passed by 'fenced' via 'cluster.conf' as a
- # custom argument to supress output to STDOUT.
- $conf->{'system'}{quiet}=1;
- }
- else
- {
- record($conf, $log, "\nERROR: Illegal name in option: [$option] at line: [$line_count]\n\n", 1);
- # 'rohara' from #linux-cluster suggested it's better to
- # simply ignore unknown input, as that is the behaviour
- # the fenced authors expect.
- #$bad=1;
- }
- }
- return ($bad);
-}
-
-# This function simply prints messages to both the log and to stdout.
-sub record
-{
- my ($conf, $log, $msg, $critical)=@_;
- $critical=0 if not $critical;
-
- # The log file gets everything.
- print $log $msg;
- print $msg if not $conf->{'system'}{quiet};
-
- # Critical messages have to print, so this ensure that it gets out
- # when 'quiet' is in use.
- print $msg if (($critical) && ($conf->{'system'}{quiet}));
-
- return(0);
-}
-
-# This sets all ports of a given Node Assassin to the requested state.
-sub set_all_state
-{
- my ($conf, $log, $state)=@_;
- $state=0 if not defined $state;
-
- my $max_port=$conf->{na}{max_nodes};
- foreach my $node (1..$max_port)
- {
- $node=sprintf("%02d", $node).":$state";
- record ($conf, $log, "Calling: [$node]\n") if $conf->{'system'}{debug};
- my @set_state=$conf->{na}{handle}->cmd("$node");
- foreach my $line (@set_state)
- {
- chomp $line;
- next if not $line;
- record($conf, $log, "$line\n");
- }
- }
-
- return (9);
-}
-
-# When asked to 'monitor' or 'list', show a CSV of all nodes and their aliases,
-# when found in the config file.
-sub show_list
-{
- my ($conf, $log)=@_;
- record($conf, $log, "In 'show_list' function.\n") if $conf->{'system'}{debug};
-
- # Get an up to date list of the ports.
- my $na_id=$conf->{'system'}{na_id};
- record($conf, $log, "na_id: [$na_id], max_node: [$conf->{na}{max_nodes}]\n") if $conf->{'system'}{debug};
-
- for (1..$conf->{na}{max_nodes})
- {
- my $node=$_;
- my $alias=$conf->{na}{$na_id}{alias}{$node} ? $conf->{na}{$na_id}{alias}{$node} : "--";
- record ($conf, $log, "$node,$alias\n", 1);
- }
-
- do_exit($conf, $log, 0);
-}
-
-# This prints the version information of this fence agent and of any configured
-# fence devices.
-sub version
-{
- my ($conf, $log)=@_;
-
- # Print the Fence Agent version first.
- record ($conf, $log, "Fence Agent: ..... Node Assassin ver. $conf->{'system'}{agent_version}\n", 1);
- record ($conf, $log, "Node Assassins: .. $conf->{'system'}{na_num}\n", 1);
- for my $na_id (1..$conf->{'system'}{na_num})
- {
- $conf->{'system'}{na_id}=$na_id;
- $conf->{na}{ipaddr}= $conf->{na}{$na_id}{ipaddr};
- $conf->{na}{tcp_port}= $conf->{na}{$na_id}{tcp_port};
- $conf->{na}{na_name}= $conf->{na}{$na_id}{na_name};
- my $build_date="";
- my $serial_number="";
- my $firmware_ver="";
- connect_to_na($conf, $log);
- if ($conf->{na}{handle})
- {
- # Get the NAOS version and serial numbers.
- my @details=$conf->{na}{handle}->cmd("00:1");
- foreach my $line (sort {$a cmp $b} @details)
- {
- chomp $line;
- ($build_date)=($line=~/\s(\S+)$/) if ($line =~ /Build Date/i );
- ($serial_number)=($line=~/\s(\S+)$/) if ($line =~ /Serial Number/i );
- ($firmware_ver)=($line=~/\s(\S+)$/) if ($line =~ /NAOS Version/i );
- record($conf, $log, "line: [$line]\n") if $conf->{'system'}{debug};
- }
- }
- else
- {
- $build_date="??";
- $serial_number="??";
- $firmware_ver="??";
- }
- record ($conf, $log, " - Node Assassin: #$na_id\n", 1);
- record ($conf, $log, " - Name: ....... $conf->{na}{$na_id}{na_name}\n", 1);
- record ($conf, $log, " - IP Address: . $conf->{na}{$na_id}{ipaddr}\n", 1);
- record ($conf, $log, " - TCP Port: ... $conf->{na}{$na_id}{tcp_port}\n", 1);
- record ($conf, $log, " - MAC Address: $conf->{na}{$na_id}{mac}\n", 1);
- record ($conf, $log, " - Netmask: .... $conf->{na}{$na_id}{netmask}\n", 1);
- record ($conf, $log, " - Gateway: .... $conf->{na}{$na_id}{gateway}\n", 1);
- record ($conf, $log, " - Serial #: ... $serial_number\n", 1);
- record ($conf, $log, " - Firmware: ... $firmware_ver\n", 1);
- record ($conf, $log, " - Build Date: . $build_date (yyyy-mm-dd)\n", 1);
- record ($conf, $log, " - Max Nodes: .. $conf->{na}{$na_id}{max_nodes}\n", 1);
-
- # Get the node states.
- $states=get_states($conf, $log);
- for (1..$conf->{na}{$na_id}{max_nodes})
- {
- my $node=sprintf("%02d", $_);
- my $power_state=$states->{$node}{power_state};
- my $reset_state=$states->{$node}{reset_state};
- my $feed_state=$states->{$node}{feed_state};
- record ($conf, $log, " - Node $node: .. p[$power_state], r[$reset_state], f[$feed_state]\n", 1);
- }
-
- # Close the handle for the next loop.
- if ($conf->{na}{handle})
- {
- show_list($conf, $log, "version", 1);
- $conf->{na}{tcp_port}->close();
- }
- else
- {
- no_connection_error($conf, $log, $na_id);
- }
- }
- do_exit($conf, $log, 0);
-}
-
-
-###############################################################################
-# Private functions below here. #
-###############################################################################
-
-### Contributed by Shaun Fryer and Viktor Pavlenko by way of TPM.
-# This is a helper to the above '_add_href' method. It is called each time a
-# new string is to be created as a new hash key in the passed hash reference.
-sub _add_hash_reference
-{
- my $href1=shift;
- my $href2=shift;
-
- for my $key (keys %$href2)
- {
- if (ref $href1->{$key} eq 'HASH')
- {
- _add_hash_reference($href1->{$key}, $href2->{$key});
- }
- else
- {
- $href1->{$key}=$href2->{$key};
- }
- }
-}
-
-### Contributed by Shaun Fryer and Viktor Pavlenko by way of TPM.
-# This takes a string with double-colon seperators and divides on those
-# double-colons to create a hash reference where each element is a hash key.
-sub _make_hash_reference
-{
- my $href=shift;
- my $key_string=shift;
- my $value=shift;
-# print "variable: [$key_string], value: [$value]\n";
-
- my $chomp_root=0;
- if ($chomp_root) { $key_string=~s/\w+:://; }
-
- my @keys = split /::/, $key_string;
- my $last_key = pop @keys;
- my $_href = {};
- $_href->{$last_key}=$value;
- while (my $key = pop @keys)
- {
- my $elem = {};
- $elem->{$key} = $_href;
- $_href = $elem;
- }
- _add_hash_reference($href, $_href);
-}
-
-sub show_metadata
-{
- print <<METADATA;
-<?xml version="1.0" ?>
-<resource-agent name="fence_na.py" shortdesc="Fence agent for Node Assassin over telnet" >
-<longdesc>fence_na is an I/O Fencing agent which can be used with the Node Assassin network power switch. It logs into device via telnet and reboots a specified outlet. Lengthy telnet/ssh connections should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions.</longdesc>
-<vendor-url>http://www.altavee.ca/w/Node_Assassin_v1.1.4</vendor-url>
-<parameters>
- <parameter name="action" unique="0" required="1">
- <getopt mixed="-o <action>" />
- <content type="string" default="reboot" />
- <shortdesc lang="en">Fencing Action</shortdesc>
- </parameter>
- <parameter name="ipaddr" unique="0" required="1">
- <getopt mixed="-a <ip>" />
- <content type="string" />
- <shortdesc lang="en">IP Address or Hostname</shortdesc>
- </parameter>
- <parameter name="login" unique="0" required="1">
- <getopt mixed="-l <name>" />
- <content type="string" />
- <shortdesc lang="en">Login Name</shortdesc>
- </parameter>
- <parameter name="passwd" unique="0" required="0">
- <getopt mixed="-p <password>" />
- <content type="string" />
- <shortdesc lang="en">Login password or passphrase</shortdesc>
- </parameter>
- <parameter name="port" unique="0" required="1">
- <getopt mixed="-n;" />
- <content type="string" />
- <shortdesc lang="en">Physical plug number</shortdesc>
- </parameter>
- <parameter name="version" unique="0" required="0">
- <getopt mixed="-V" />
- <content type="boolean" />
- <shortdesc lang="en">Display version information and exit</shortdesc>
- </parameter>
- <parameter name="help" unique="0" required="0">
- <getopt mixed="-h" />
- <content type="boolean" />
- <shortdesc lang="en">Display help and exit</shortdesc>
- </parameter>
-</parameters>
-<actions>
- <action name="on" />
- <action name="off" />
- <action name="reboot" />
- <action name="status" />
- <action name="list" />
- <action name="monitor" />
- <action name="metadata" />
-</actions>
-</resource-agent>
-METADATA
-}
-
-1;
diff --git a/fence/agents/node_assassin/fence_na.pl b/fence/agents/node_assassin/fence_na.pl
deleted file mode 100644
index bdcaf69..0000000
--- a/fence/agents/node_assassin/fence_na.pl
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/usr/bin/perl
-#
-# Node Assassin - Fence Agent
-# Digimer; digimer(a)alteeve.com
-# Nov. 25, 2010
-# Version: 1.1.6
-#
-# This software is released under the GPL v2. See the LICENSE file in the
-# configuration directory for a copy of the GPL v2.
-#
-# Bugs;
-# - None known, many expected
-#
-
-# Play safe!
-use strict;
-use warnings;
-
-# Load our library.
-require '@FENCEAGENTSLIBDIR(a)/fence_na.lib';
-
-# IO::Handle is used for logging and Net::Telnet is used for communicating with
-# the Node Assassin(s).
-use IO::Handle;
-use Net::Telnet;
-
-# These are the default values and will be over-written by the config file's
-# variables which in turn can, in some cases, be over-written by command line
-# arguments.
-# Please see '@NACONFFILE@' for details on each option.
-my $conf={
- 'system' => {
- max_valid_state => 3,
- conf_file => "@NACONFFILE@",
- quiet => "",
- version => 0,
- list => "",
- monitor => "",
- na_id => 0,
- got_cla => 0, # This is set if command line arguments are read.
- debug => 0,
- },
- na => {
- ipaddr => "",
- tcp_port => "238",
- port => "",
- login => "",
- passwd => "",
- port => "",
- set_state => "",
- passwd_script => "",
- action => "",
- agent => "", # This is only used by 'fenced'
- na_name => "", # This is used for the 'list' function.
- handle => "",
- max_node => 0,
- set_state => [], # This array will store the states to set based on the action passed for the proper ports.
- }
-};
-
-# This method can't pass in the '$log' handle, obviously, as it does not yet
-# exist.
-read_conf($conf);
-
-# Log file for output.
-my $log=IO::Handle->new();
-print "Opening: [$conf->{'system'}{'log'}] for logging.\n" if $conf->{'system'}{debug};
-open ($log, ">$conf->{'system'}{'log'}") || die "Failed to open: [$conf->{'system'}{'log'}] for writing; Error: $!\n";
-
-# Set STDOUT and $log to hot (unbuffered) output.
-if (1)
-{
- select $log;
- $|=1;
- select STDOUT;
- $|=1;
-}
-
-# If this gets set in the next two function, the agent will exit.
-my $bad=0;
-
-# Read in arguments from the command line.
-($bad)=read_cla($conf, $log, $bad);
-
-# Now read in arguments from STDIN, which is how 'fenced' passes arguments.
-($bad)=read_stdin($conf, $log, $bad);
-
-# This makes sure the node ID is either zero-padded or '00'.
-$conf->{na}{port}=$conf->{na}{port} ? $conf->{na}{port}=sprintf("%02d", $conf->{na}{port}) : "00";
-record($conf, $log, "Will use port: [$conf->{na}{port}]\n") if $conf->{'system'}{debug};
-
-# Find the TCP port from the config file.
-foreach my $i (1..$conf->{'system'}{na_num})
-{
- if ((lc($conf->{na}{$i}{ipaddr}) eq lc($conf->{na}{ipaddr})))
- {
- $conf->{'system'}{na_id}=$i;
- record($conf, $log, __LINE__."; system::na_id: [$conf->{'system'}{na_id}]\n") if $conf->{'system'}{debug};
- $conf->{na}{tcp_port}=$conf->{na}{$i}{tcp_port};
- record($conf, $log, __LINE__."; na::tcp_port: [$conf->{na}{tcp_port}]\n") if $conf->{'system'}{debug};
- $conf->{na}{na_name}=$conf->{na}{$i}{na_name} ? $conf->{na}{$i}{na_name} : "Node Assassin #$i";
- record($conf, $log, __LINE__."; na::na_name: [$conf->{na}{na_name}]\n") if $conf->{'system'}{debug};
- $conf->{na}{max_nodes}=$conf->{na}{$i}{max_nodes};
- record($conf, $log, __LINE__."; na::max_nodes: [$conf->{na}{max_nodes}]\n") if $conf->{'system'}{debug};
- }
-}
-
-die "Exiting on errors.\n" if $bad;
-
-if ($conf->{na}{action} eq "metadata") {
- show_metadata();
- do_exit($conf, $log, 0);
-}
-
-my @ny=("no", "yes");
-record($conf, $log, "Node Assassin: . [$conf->{na}{ipaddr}].\n");
-record($conf, $log, "TCP Port: ...... [$conf->{na}{tcp_port}].\n");
-record($conf, $log, "Node: .......... [$conf->{na}{port}].\n");
-record($conf, $log, "Login: ......... [$conf->{na}{login}].\n");
-record($conf, $log, "Password: ...... [$conf->{na}{passwd}].\n");
-record($conf, $log, "Action: ........ [$conf->{na}{action}].\n");
-record($conf, $log, "Version Request: [".$ny[$conf->{'system'}{version}]."].\n");
-record($conf, $log, "Done reading args.\n");
-
-# If I've been asked to show the version information, do so and then exit.
-record($conf, $log, "Version: ..... [$conf->{'system'}{version}].\n") if $conf->{'system'}{debug};
-if ($conf->{'system'}{version})
-{
- version($conf, $log);
- do_exit($conf, $log, 0);
-}
-
-# Connect to the Node Assassin.
-connect_to_na($conf, $log);
-
-# Validate credentials.
-# NOTE: Checking before the telnet fails on the exit. Also, this will be moved
-# into the Node Assassin soon anyway.
-if (($conf->{na}{login} ne $conf->{'system'}{username}) or ($conf->{na}{passwd} ne $conf->{'system'}{password}))
-{
- record($conf, $log, "Username and/or password invalid. Did you use the command line switches properly?\n");
- do_exit($conf, $log, 8);
-}
-
-###############################################################################
-# What do? #
-###############################################################################
-
-# When asked to 'monitor' or 'list'. being multi-port, this will return a CSV
-# of nodes and their aliases where found in the config file.
-record($conf, $log, "Action: ........ [$conf->{na}{action}].\n") if $conf->{'system'}{debug};
-if (($conf->{na}{action} eq "monitor") or ($conf->{na}{action} eq "list"))
-{
- record($conf, $log, "Calling the 'show_list' function.\n") if $conf->{'system'}{debug};
- show_list($conf, $log);
- do_exit($conf, $log, 0);
-}
-
-# If I made it this far, I am setting a state. Sort out what state from the
-# values in my conf->{na} hash.
-record($conf, $log, "Setting node: [$conf->{na}{port}] to action: [$conf->{na}{action}] using the Node Assassin: [$conf->{na}{ipaddr}] using the login: [$conf->{na}{login}]\n") if $conf->{'system'}{debug};
-
-# Convert the action into Node Assassin protocol arguments.
-process_action($conf, $log);
-
-# Now execute the action plan.
-my $exit_code=do_actions($conf, $log);
-record($conf, $log, "All calls complete, exiting.\n") if $conf->{'system'}{debug};
-
-# Cleanup and exit.
-do_exit($conf, $log, $exit_code);
diff --git a/fence/agents/node_assassin/fence_na.pod.in b/fence/agents/node_assassin/fence_na.pod.in
deleted file mode 100644
index 7bd6a3c..0000000
--- a/fence/agents/node_assassin/fence_na.pod.in
+++ /dev/null
@@ -1,188 +0,0 @@
-=pod
-
-=encoding utf8
-
-=head1 NAME
-
-B<fence_na>
-
-This is the fence agent for the Node Assassin fence device.
-
-=head1 SYNOPSIS
-
- fence_na -a fence_na01.domain.com -n 2 -l admin -p secret -o off
-
-=head1 DESCRIPTION
-
-This fence agent takes argument from the command line or from the 'fenced' program and interprets them into calls to send to the Node Assassin fence device. It analyzes the returned information and exits with an appropriate exit code as dictated by the FenceAgentAPI.
-
-=head1 USAGE
-
-Arguments are read from STDIN as 'variable=value' pairs, one pair per new line. This is the method used by 'fenced'.
-
-For testing or manual control, arguments may be passed as command line arguments.
-
-=head1 OVERVIEW
-
-This takes arguments that defined which Node Assassin to call, what node to work on and what action should be taken. These arguments are defined by the FenceAgentAPI. These actions are then translated into a set of Node Assassin states which then get passed to the device.
-
-=head1 NODE ASSASSIN "PORTS"
-
-The FenceAgentAPI refers to "ports" while the Node Assassin refers to "nodes". These two terms are thus used interchangably. The reason for the difference is that, internally, Node Assassin maps each node to three "ports"; The node's power and reset buttons plus the node's power feed.
-
-Each node in the Node Assassin can be set to one of four states described in the next section.
-
-=head1 NODE ASSASSIN STATES
-
-Each Node Assassin port can be set to one of four states. They are:
-
-=head2 C<0>
-
-This will release the fence on the specified NA node's power and reset ports.
-
-=head2 C<1>
-
-This state will fence the node specified by the "port" argument. The fence will remain active until released. Further, the fence will "lock out" the node's front-panel buttons until the fence is released.
-
-=head2 C<2>
-
-This will fence the node for one second. This is meant to provide a mechanism to boot or initiate a clean shut down of a node.
-
-=head2 C<3>
-
-This state will fence the node for five seconds to 30 seconds, depending on how long it takes for the power feed to drop low. This is meant to provide a way to force crashed nodes to power off without the front-panel lock.
-
-=head1 OPTIONS
-
-Which options are valid depends on how the arguments are passed in. The "main" method of passing arguments is via STDIN as a series of 'varible=value' pairs, one per line. All arguments accepted this way have command-line arguments passed in via single-dashes switches. Each option below shows either calling method's arguments, where available.
-
-=head2 C<-h>
-
-Prints this help message.
-
-=head2 C<-v>, C<-V>
-
-Prints the version of this fence agent and then the version of any configured, reachable Node Assassins.
-
-=head2 C<-q>
-
-Tells this fence agent to only print critical messages.
-
-=head2 C<-d>
-
-Tells this fence agent to print debug messages.
-
-=head2 C<-a address>, C<ipaddr=address>
-
-Tells the fence agent which Node Assassin to use.
-
-I<NOTE!> The name or IP addresses *MUST* match a name or IP address defined in C<@NACONFFILE@>! Specifically, it must match one of the C<node::X::ipaddr> entries where C<X> is the ID of the Node Assassin.
-
-=head2 C<-l name>, C<login=name>
-
-This is the login name used to connect to this fence agent. It must match the value C<system::username> in C<@NACONFFILE@>.
-
-=head2 C<-p secret>, C<passwd=secret>
-
-This is the login password used to connect to this fence agent. It must match the value C<system::password> in C<@NACONFFILE@>.
-
-=head2 C<-n #>, C<port=#>
-
-This tells the fence agent which node to act on.
-
-I<NOTE!> Please do not confuse this with the Node Assassin's internal concept of a port.
-
-=head2 C<-o val>, C<action=val>
-
-This is the C<action> (formerly C<option>) to perform on the selected node. Valid actions and how Node Assassin implements them are:
-
-=head3 C<off>
-
-This set's the node to state 1; Fenced. Internally, it will hit the reset switch for one second to immediately disable the node. Then it will release the reset switch for another second before pressing and holding the power switch. After five seconds, Node Assassin will check the node's power feed. If it is still on, it will wait another 25 seconds and check again. If the node is still on, an error will be generated. If the node turns off successfully, the fence is declared a success. reboot
-
-=head3 C<on>
-
-This sets the node to state '0'; Unfenced. Both the power and reset switches are opened, the Node Assassin will pause for one second and then the power switch will be closed for one second to boot the node (that is, the node is set to "state 2").
-
-=head3 C<reboot>
-
-I<Note>: This will do a hard reboot! Do not use when a normal restart would suffice.
-
-This essetially just calls an C<off> and then an C<on>. However, the B<fence_na> agent will return a success (exit C<0>) even if the C<on> stage succeeded. As per the FenceAgentAPI, a reboot does not need to successfully boot the node to be concidered a success, it only needs to shut it down.
-
-=head3 C<status>
-
-This checks the power feed for the requested node is checked. If the node is on, the agent will exit with code C<0>. If the node is off (or disconnected), it will exit with code C<1>. If an error occurred calling the Node Assassin, this will exit with code C<2>.
-
-Note that this argument is designed to be used by the fence agent and will not print any output to C<STDOUT>.
-
-=head3 C<monitor>, C<list>
-
-=head2 Node Assassin Specific Actions
-
-I<NOTE>: The following states are supported by Node Assassin only. These states are not used by the C<fenced> daemon and are provided here as a convenience for the user.
-
-Any commands named C<*_all> ignore the node value, if set.
-
-=head2 C<release>
-
-If the node is fenced, the fence will be released. The difference from C<on> being that this will not boot the node after the fence is released.
-
-=head2 C<release_all>
-
-This does a C<release> on all fenced nodes.
-
-=head2 C<fence_all>
-
-All nodes are fenced. See the C<off> state above.
-
-=head2 C<boot>
-
-The power feed of the specific node on the Node Assassin is checked. If it is found to be off, it will be set to state C<2> to initiate boot.
-
-=head2 C<boot_all>
-
-The power feeds of all nodes on the Node Assassin are checked. Any found to be off are set to state C<2> to initiate boot.
-
-=head2 C<shutdown>
-
-The power feed of the specific node on the Node Assassin is checked. If it is found to be on, it will be set to state C<2> to initiate an ACPI-induced soft shutdown.
-
-=head2 C<shutdown_all>
-
-The power feeds of all nodes on the Node Assassin are checked. Any found to be on are set to state C<2> to initiate an ACPI-induced soft shutdown.
-
-=head2 C<forcedown_all>
-
-The power feeds of all nodes on the Node Assassin are checked. Any found to be on are set to state C<3>. This state is similar to state C<1> (see "C<off>" above), except that the node's front-panel switches are not disabled after the fence completes.
-
-=head1 EXAMPLES
-
-To simulate how 'fenced' calls the script, create a text file called C<args.txt> containing:
-
- # Test file used as input for the NA fence agent.
- ipaddr=fence_na01.domain.com
- port=02
- login=admin
- passwd=secret
- action=reboot
-
-Now use C<cat> to pipe the contents into the fence agent:
-
- cat args.txt | fence_na
-
-This will call the C<off> function against node #02 connected to the Node Assassin at C<fence_na01.domain.com>, fencing it. Change the C<action> line to C<action=on> and re-run the script to release the fence and boot the node.
-
-To duplicate the same call using command line arguments:
-
- fence_na -a fence_na01.domain.com -n 2 -l admin -p secret -o reboot
-
-=head1 SEE ALSO
-
-http://nodeassassin.org
-
-=head1 UPDATED
-
-Nov. 27, 2010
-
-Digimer (digimer(a)alteeve.com)
10 years, 10 months