fence-agents: master - fix fail to build from previous merges
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 9d7745c86de6c22e98ada07b1f3fdcd414eb0935
Parent: 820dbd7bfc38fea27015bcce9a7067b7cddcfe74
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Apr 20 14:55:17 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:55:17 2010 +0200
fix fail to build from previous merges
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
fence/agents/rsb/Makefile.am | 3 +-
fence/agents/rsb/fence_rsb.8 | 76 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rsb/Makefile.am b/fence/agents/rsb/Makefile.am
index 640758f..c52b8d4 100644
--- a/fence/agents/rsb/Makefile.am
+++ b/fence/agents/rsb/Makefile.am
@@ -9,7 +9,6 @@ sbin_SCRIPTS = $(TARGET)
dist_man_MANS = $(TARGET).8
include $(top_srcdir)/make/fencebuild.mk
-include $(top_srcdir)/make/fenceman.mk
-clean-local: clean-man
+clean-local:
rm -f $(TARGET)
diff --git a/fence/agents/rsb/fence_rsb.8 b/fence/agents/rsb/fence_rsb.8
new file mode 100644
index 0000000..d278271
--- /dev/null
+++ b/fence/agents/rsb/fence_rsb.8
@@ -0,0 +1,76 @@
+.TH fence_rsb 8
+
+.SH NAME
+fence_rsb - I/O Fencing agent for Fujitsu-Siemens RSB
+
+.SH SYNOPSIS
+.B
+fence_rsb
+[\fIOPTION\fR]...
+
+.SH DESCRIPTION
+fence_rsb is an I/O Fencing agent which can be used with the Fujitsu-Siemens
+RSB management interface. It logs into an RSB device via telnet and reboots
+the associated machine. Lengthy telnet connections to the RSB device
+should be avoided while a GFS cluster is running because the connection
+will block any necessary fencing actions.
+
+fence_rsb accepts options on the command line as well as from stdin.
+Fenced sends parameters through stdin when it execs the agent. fence_rsb
+can be run by itself with command line options. This is useful for testing.
+
+Vendor URL: http://www.fujitsu.com
+.SH OPTIONS
+.TP
+\fB-a\fP \fIIPaddress\fR
+IP address or hostname of the RSB device.
+.TP
+\fB-h\fP
+Print out a help message describing available options, then exit.
+.TP
+\fB-l\fP \fIlogin\fR
+Login name.
+.TP
+\fB-n\fP \fItelnet_port\fR
+The port number on which the telnet service listens.
+.TP
+\fB-o\fP \fIaction\fR
+The action required. This can be reboot (default), off, on, or status.
+.TP
+\fB-p\fP \fIpassword\fR
+Password for login.
+.TP
+\fB-S\fP \fIpath\fR
+Full path to an executable to generate the password for login.
+.TP
+\fB-v\fP
+Verbose. Print informational messages to standard out.
+.TP
+\fB-V\fP
+Print out a version message, then exit.
+
+.SH STDIN PARAMETERS
+.TP
+\fIagent = < param >\fR
+This option is used by fence_node(8) and is ignored by fence_rsb.
+.TP
+\fIipaddr = < hostname | ip >\fR
+IP address or hostname of the device.
+.TP
+\fItelnet_port = < port number >\fR
+The port number on which the telnet service listens.
+.TP
+\fIlogin = < param >\fR
+Login name.
+.TP
+\fIoption = < param >\fR
+The action required. This can be reboot (default), off, on, or status.
+.TP
+\fIpasswd = < param >\fR
+Password for login.
+.TP
+\fIpasswd_script = < param >\fR
+Full path to an executable to generate the password for login.
+
+.SH SEE ALSO
+fence(8), fence_node(8)
14 years
fence-agents: master - fence_scsi: import man page from STABLE3
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 820dbd7bfc38fea27015bcce9a7067b7cddcfe74
Parent: feae51039d8986669dd1c3c3009caea4216aaf53
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Apr 20 14:52:24 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:52:24 2010 +0200
fence_scsi: import man page from STABLE3
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
fence/agents/scsi/fence_scsi.8 | 148 ++++++++++++++++++++--------------------
1 files changed, 75 insertions(+), 73 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.8 b/fence/agents/scsi/fence_scsi.8
index eaab222..f1a29ea 100644
--- a/fence/agents/scsi/fence_scsi.8
+++ b/fence/agents/scsi/fence_scsi.8
@@ -4,74 +4,74 @@
fence_scsi - I/O fencing agent for SCSI persistent reservations
.SH SYNOPSIS
-.B
+.B
fence_scsi
[\fIOPTION\fR]...
.SH DESCRIPTION
-fence_scsi is an I/O fencing agent which can be used with the SCSI
-devices that support persistent reservations (SPC-2 or greater).
+fence_scsi is an I/O fencing agent that uses SCSI-3 persistent
+reservations to control access to shared storage devices. These
+devices must support SCSI-3 persistent reservations (SPC-3 or greater)
+as well as the "preempt-and-abort" subcommand.
-SCSI persistent reservations work by having each node in the cluster
-register with the SCSI device. Registration is done using a unique key
-(based on the node's IP address). Each node that will perform I/O
-operations to the shared storage must register with the device. This
-is done at system startup with the scsi_reserve init script. This
-script will discover all clustered volumes as well as the underlying
-SCSI device(s). Device discovery is done via the lvs command (see
-lvs(8)) and is subject to any filtering rules defined in the lvm.conf
-file.
+The fence_scsi agent works by having each node in the cluster register
+a unique key with the SCSI devive(s). Once registered, a single node
+will become the reservation holder by creating a "write exclusive,
+registrants only" reservation on the device(s). The result is that
+only registered nodes may write to the device(s). When a node failure
+occurs, the fence_scsi agent will remove the key belonging to the
+failed node from the device(s). The failed node will no longer be able
+to write to the device(s). A manual reboot is required.
-After generating the node's unique key, the script will register the
-node with the SCSI device(s) that were discovered. Once the node is
-registered, the script will attempt to create a reservation. Unlike
-registrations, of which there are multiple registrants (one for each
-node in the cluster), there is only one reservation holder. If a
-reservation does not already exist for a device, the script will
-create a reservation using the node's unique key.
+Keys are either be specified manually (see -k option) or generated
+automatically (see -n option). Automatic key generation requires that
+cman be running. Keys will then be generated using the cluster ID and
+node ID such that each node has a unique key that can be determined by
+any other node in the cluster.
-It is important to distinguish between registrations and
-reservations. As mentioned above, each node that will perform I/O
-operations to the SCSI device must register. As a result, there will
-be multiple registrations for a given SCSI device. In contrast, there
-can only be one reservation per SCSI device. It is not important which
-node holds the reservation. The reservation simply tells the device
-how the registrants are allowed to access the device. For our
-purposes, the reservation type is "write exclusive, registrants only".
-With this reservation type, only registered nodes will be able to
-write to the device.
-
-When the cluster must fence a node, it simply revokes a node's
-registration, or "unregisters" the node. This operation also uses the
-node's unique key. By deriving the unique key based on the errant
-node's IP address, the cluster can "unregister" the key. As a
-result, the errant node will no longer be able to write to the SCSI
-device.
-
-Note that the node that holds the reservation for a device must also
-be registered with that device. When the situation arises where the
-node that is being fenced is also the reservation holder, the
-reservation must be moved. This is handled by using the
-"preempt-and-abort command" which will transfer the reservation from
-the node that is being fenced to the node that is performing the
-fencing. This operation will maintain the reservation while
-"unregistering" the node being fenced.
-
-At system shutdown, the scsi_reserve script will attempt to
-"unregister" the node from all devices. The exception is when the
-node happens to be the reservation holder. In this case, the script
-does nothing, due to the fact that there may be other nodes using the
-device and the reservation must remain intact.
-
-fence_scsi accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent. fence_scsi
-can be run by itself with command line options. This is useful for testing
-and for turning outlets on or off from scripts.
+Devices can either be specified manually (see -d option) or discovered
+automatically. Multiple devices can be specified manually by using a
+comma-separated list. If no devices are specified, the fence_scsi
+agent will attempt to discover devices by looking for cluster volumes
+and extracting the underlying devices. Devices may be device-mapper
+multipath devices or raw devices. If using a device-mapper multipath
+device, the fence_scsi agent will find the underlying devices (paths)
+and created registrations for each path.
.SH OPTIONS
.TP
-\fB-n\fP \fInode\fR
-Name of the node to be fenced.
+\fB-o\fP \fIaction\fR
+Fencing action. This value can be "on", "off", or "status". All
+actions require either a key (see -k option) or node name (see -n
+option). For "on", the agent will attempt to register with the
+device(s) and create a reservation if none exists. The "off" action
+will attempt to remove a node's key from the device(s). The "status"
+action will report whether or not a node's key is currently register
+with one or more of the devices. The default action if "off".
+.TP
+\fB-d\fP \fIdevices\fR
+List of devices to use for current operation. Devices can be
+comma-separated list of raw device (eg. /dev/sdc) or device-mapper
+multipath devices (eg. /dev/dm-3). Each device must support SCSI-3
+persistent reservations.
+.TP
+\fB-f\fP \fIlogfile\fR
+Log output to file.
+.TP
+\fB-n\fP \fInodename\fR
+Name of the node to be fenced. The node name is used to generate the
+key value used for the current operation. This option will be ignored
+when used with the -k option.
+.TP
+\fB-k\fP \fIkey\fR
+Key to use for the current operation. This key should be unique to a
+node. For the "on" action, the key specifies the key use to register
+the local node. For the "off" action, this key specifies the key to be
+removed from the device(s).
+.TP
+\fB-a\fP
+Use the APTPL flag for registrations. This option is only used for the
+"on" action.
.TP
\fB-h\fP
Print out a help message describing available options, then exit.
@@ -84,24 +84,26 @@ Print out a version message, then exit.
.SH STDIN PARAMETERS
.TP
-\fIagent = < param >\fR
+\fIagent = "param"\fR
This option is used by fence_node(8) and is ignored by fence_scsi.
.TP
-\fInodename = < hostname | ip >\fR
-Name of the node to be fenced.
+\fInodename = "param"\fR
+Same as -n option.
.TP
-\fIself = < nodename >\fR
-Name of the node that will perform the fencing operation.
+\fIaction = "param" \fR
+Same as -o option.
.TP
-\fIverbose = < param >\fR
-Verbose output.
-
-.SH LIMITATIONS
-The fence_scsi fencing agent requires a minimum of three nodes in the
-cluster to operate. For SAN devices connected via fiber channel,
-these must be physical nodes. SAN devices connected via iSCSI may use
-virtual or physical nodes. In addition, fence_scsi cannot be used in
-conjunction with qdisk.
+\fIdevices = "param"\fR
+Same as -d option.
+.TP
+\fIlogfile = "param"\fR
+Same as -f option
+.TP
+\fIkey = "param"\fR
+Same as -k option.
+.TP
+\fIaptpl = "1"
+Enable the APTPL flag. Default is 0 (disable).
.SH SEE ALSO
-fence(8), fence_node(8), sg_persist(8), lvs(8), lvm.conf(5)
+fence(8), fence_node(8), sg_persist(8), vgs(8), cman_tool(8), cman(5)
14 years
fence-agents: master - fencing: Creating manual pages fails when default value is a list
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: feae51039d8986669dd1c3c3009caea4216aaf53
Parent: 5f04219f0ca8ff3b6ef5f6a0f500263749e52803
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 12:27:47 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:51:54 2010 +0200
fencing: Creating manual pages fails when default value is a list
Problem was concatenating string + list in python. Lists can't be
entered using command line or stdin.
Resolves: rhbz#583019
---
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 831cdb1..6646eb9 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -430,7 +430,7 @@ def metadata(avail_opt, options, docs):
default = ""
if all_opt[option].has_key("default"):
- default = "default=\""+all_opt[option]["default"]+"\""
+ default = "default=\""+str(all_opt[option]["default"])+"\""
elif options.has_key("-" + all_opt[option]["getopt"][:-1]):
if options["-" + all_opt[option]["getopt"][:-1]]:
try:
@@ -438,7 +438,7 @@ def metadata(avail_opt, options, docs):
except TypeError:
## @todo/@note: Currently there is no clean way how to handle lists
## we can create a string from it but we can't set it on command line
- default = "default=\"list of values\""
+ default = "default=\"" + str(options["-" + all_opt[option]["getopt"][:-1]]) +"\""
elif options.has_key("-" + all_opt[option]["getopt"]):
default = "default=\"true\" "
14 years
fence-agents: master - fence_ilo_mp: Proper error message instead of python traceback
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 5f04219f0ca8ff3b6ef5f6a0f500263749e52803
Parent: 0a05ea521285a0f870f1fa5bfc3730de68dd6635
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 12:15:55 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:51:23 2010 +0200
fence_ilo_mp: Proper error message instead of python traceback
Fencing agent for iLO MP did not have proper exception handling.
Resolves: rhbz#583017
---
fence/agents/ilo_mp/fence_ilo_mp.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index fed9f36..1618216 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -13,7 +13,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
try:
conn.send("show /system1\r\n")
-
+
re_state = re.compile('EnabledState=(.*)', re.IGNORECASE)
conn.log_expect(options, re_state, int(options["-Y"]))
14 years
fence-agents: master - fence_egenera: log file path should be absolute not relative
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 0a05ea521285a0f870f1fa5bfc3730de68dd6635
Parent: bee80d8e340f90e620eec3cc8571c3226c350f04
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 12:14:40 2010 +0200
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:50:02 2010 +0200
fence_egenera: log file path should be absolute not relative
---
fence/agents/egenera/fence_egenera.pl | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index 8df0029..8e6aa1b 100644
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -292,9 +292,9 @@ sub pserver_boot
sub pserver_shutdown
{
my $rtrn=1;
- local *egen_log;
- open(egen_log,">>@LOGDIR(a)/fence_egenera.log");
- print egen_log "Attempting shutdown at ".`date`."\n";
+ local *egen_log;
+ open(egen_log,">>/@LOGDIR(a)/fence_egenera.log");
+ print egen_log "Attempting shutdown at ".`date`."\n";
for (my $trys=0; $trys<20; $trys++)
{
last if (pserver_status != 0);
14 years
fence-agents: master - fencing: Add vendor URL to man pages
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: bee80d8e340f90e620eec3cc8571c3226c350f04
Parent: 40e5f51eec5e12e6bf25beeacdcef82aa567a4b5
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Jan 18 20:01:33 2010 +0100
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:48:21 2010 +0200
fencing: Add vendor URL to man pages
---
fence/agents/alom/fence_alom.py | 1 +
fence/agents/apc/fence_apc.py | 1 +
fence/agents/apc_snmp/fence_apc_snmp.py | 1 +
fence/agents/baytech/fence_baytech.8 | 2 ++
fence/agents/bladecenter/fence_bladecenter.py | 1 +
fence/agents/brocade/fence_brocade.8 | 2 ++
fence/agents/bullpap/fence_bullpap.8 | 2 ++
fence/agents/cisco_mds/fence_cisco_mds.py | 1 +
fence/agents/cpint/fence_cpint.8 | 2 ++
fence/agents/drac/fence_drac.8 | 2 ++
fence/agents/drac5/fence_drac5.py | 1 +
fence/agents/egenera/fence_egenera.8 | 2 ++
fence/agents/eps/fence_eps.py | 1 +
fence/agents/ibmblade/fence_ibmblade.py | 1 +
fence/agents/ifmib/fence_ifmib.py | 1 +
fence/agents/ilo/fence_ilo.py | 1 +
fence/agents/ilo_mp/fence_ilo_mp.py | 1 +
fence/agents/intelmodular/fence_intelmodular.py | 1 +
fence/agents/ldom/fence_ldom.py | 1 +
fence/agents/lib/fencing.py.py | 2 ++
fence/agents/mcdata/fence_mcdata.8 | 2 ++
fence/agents/rackswitch/fence_rackswitch.8 | 2 ++
fence/agents/rsa/fence_rsa.py | 1 +
fence/agents/sanbox2/fence_sanbox2.py | 1 +
fence/agents/vixel/fence_vixel.8 | 2 ++
fence/agents/vmware/fence_vmware.py | 1 +
fence/agents/wti/fence_wti.py | 1 +
fence/agents/xcat/fence_xcat.8 | 2 ++
fence/agents/zvm/fence_zvm.8 | 2 ++
29 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 5dfe9e0..6223608 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -64,6 +64,7 @@ def main():
docs["shortdesc"] = "Fence agent for Sun ALOM"
docs["longdesc"] = "fence_alom is an I/O Fencing \
agent which can be used with ALOM connected machines."
+ docs["vendorurl"] = "http://www.sun.com"
show_docs(options, docs)
# Operate the fencing device
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index b70b220..12ddf2a 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -207,6 +207,7 @@ which can be used with the APC network power switch. It logs into device \
via telnet/ssh 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."
+ docs["vendorurl"] = "http://www.apc.com"
show_docs(options, docs)
## Support for -n [switch]:[plug] notation that was used before
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index ea3a89f..71e978e 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -195,6 +195,7 @@ def main():
which can be used with the APC network power switch. It logs \
into a device via SNMP and reboots a specified outlet. It supports \
SNMP v1 and v3 with all combinations of authenticity/privacy settings."
+ docs["vendorurl"] = "http://www.apc.com"
show_docs(options, docs)
# Operate the fencing device
diff --git a/fence/agents/baytech/fence_baytech.8 b/fence/agents/baytech/fence_baytech.8
index e60175d..aa17955 100644
--- a/fence/agents/baytech/fence_baytech.8
+++ b/fence/agents/baytech/fence_baytech.8
@@ -25,6 +25,8 @@ fence_baytech accepts options on the command line as well as from stdin.
fenced sends parameters through stdin when it execs the agent. fence_baytech
can be run by itself with command line options which is useful for testing.
+Vendor URL: http://www.baytech.net
+
.SH OPTIONS
.TP
\fB-a\fP \fIhost\fP
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 708fc84..8b890e4 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -110,6 +110,7 @@ def main():
which can be used with IBM Bladecenters with recent enough firmware that \
includes telnet support. It logs into a Brocade chasis via telnet or ssh \
and uses the command line interface to power on and off blades."
+ docs["vendorurl"] = "http://www.ibm.com"
show_docs(options, docs)
##
diff --git a/fence/agents/brocade/fence_brocade.8 b/fence/agents/brocade/fence_brocade.8
index 36fde82..812a3f9 100644
--- a/fence/agents/brocade/fence_brocade.8
+++ b/fence/agents/brocade/fence_brocade.8
@@ -26,6 +26,8 @@ into the GFS cluster (after reboot) the port on the Brocade FC switch needs to
be enabled. This can be done by running fence_brocade and specifying the
enable action.
+Vendor URL: http://www.brocade.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
diff --git a/fence/agents/bullpap/fence_bullpap.8 b/fence/agents/bullpap/fence_bullpap.8
index 876b406..1404c75 100644
--- a/fence/agents/bullpap/fence_bullpap.8
+++ b/fence/agents/bullpap/fence_bullpap.8
@@ -18,6 +18,8 @@ fence_bullpap accepts options on the command line as well as from stdin.
fenced sends the options through stdin when it execs the agent. fence_bullpap
can be run by itself with command line options which is useful for testing.
+Vendor URL: http://www.bull.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index c345c2e..d20efe4 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -111,6 +111,7 @@ def main():
docs["shortdesc"] = "Fence agent for Cisco MDS"
docs["longdesc"] = "fence_cisco_mds is an I/O Fencing agent \
which can be used with any Cisco MDS 9000 series with SNMP enabled device."
+ docs["vendorurl"] = "http://www.cisco.com"
show_docs(options, docs)
if (not (options["-o"] in ["list","monitor"])):
diff --git a/fence/agents/cpint/fence_cpint.8 b/fence/agents/cpint/fence_cpint.8
index efbaa7e..e9f1c5d 100644
--- a/fence/agents/cpint/fence_cpint.8
+++ b/fence/agents/cpint/fence_cpint.8
@@ -26,6 +26,8 @@ fence_node sends the options through stdin when it execs the agent.
fence_cpint can be run by itself with command line options which is useful for
testing.
+Vendor URL: http://www.ibm.com
+
.SH OPTIONS
.TP
\fB-h\fP
diff --git a/fence/agents/drac/fence_drac.8 b/fence/agents/drac/fence_drac.8
index 8dda184..3e302d9 100644
--- a/fence/agents/drac/fence_drac.8
+++ b/fence/agents/drac/fence_drac.8
@@ -25,6 +25,8 @@ Fenced sends parameters through stdin when it execs the agent. fence_drac
can be run by itself with command line options. This is useful for testing
and for turning outlets on or off from scripts.
+Vendor URL: http://www.dell.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fR
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 900b547..256158a 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -104,6 +104,7 @@ which can be used with the Dell Remote Access Card v5 or CMC (DRAC). \
This device provides remote access to controlling power to a server. \
It logs into the DRAC through the telnet/ssh interface of the card. \
By default, the telnet interface is not enabled."
+ docs["vendorurl"] = "http://www.dell.com"
show_docs(options, docs)
##
diff --git a/fence/agents/egenera/fence_egenera.8 b/fence/agents/egenera/fence_egenera.8
index cfa839e..7e907cd 100644
--- a/fence/agents/egenera/fence_egenera.8
+++ b/fence/agents/egenera/fence_egenera.8
@@ -21,6 +21,8 @@ fence_egenera accepts options on the command line as well as from stdin.
Fenced sends parameters through stdin when it execs the agent. fence_egenera
can also be run by itself with command line options.
+Vendor URL: http://www.egenera.com
+
.SH OPTIONS
.TP
\fB-c\fP \fIcserver\fR
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index ffcb69b..049c01c 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -117,6 +117,7 @@ this is only one, which has support for hidden page feature. \
Agent basically works by connecting to hidden page and pass \
appropriate arguments to GET request. This means, that hidden \
page feature must be enabled and properly configured."
+ docs["vendorurl"] = "http://www.epowerswitch.com"
show_docs(options, docs)
#Run fence action. Conn is None, beacause we always need open new http connection
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 3ad6acc..323a4ad 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -77,6 +77,7 @@ def main():
which can be used with IBM BladeCenter chassis. It issues SNMP Set \
request to BladeCenter chassis, rebooting, powering up or down \
the specified Blade Server."
+ docs["vendorurl"] = "http://www.ibm.com"
show_docs(options, docs)
# Operate the fencing device
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 9f388d0..2914301 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -137,6 +137,7 @@ It was written with managed ethernet switches in mind, in order to \
fence iSCSI SAN connections. However, there are many devices that \
support the IF-MIB interface. The agent uses IF-MIB::ifAdminStatus \
to control the state of an interface."
+ docs["vendorurl"] = "http://www.ietf.org/wg/concluded/ifmib.html"
show_docs(options, docs)
# Operate the fencing device
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 10d888c..b68f4e4 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -76,6 +76,7 @@ used for HP servers with the Integrated Light Out (iLO) PCI card.\
The agent opens an SSL connection to the iLO card. Once the SSL \
connection is established, the agent is able to communicate with \
the iLO card through an XML stream."
+ docs["vendorurl"] = "http://www.hp.com"
show_docs(options, docs)
##
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index e679192..fed9f36 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -60,6 +60,7 @@ def main():
docs = { }
docs["shortdesc"] = "Fence agent for HP iLO MP"
docs["longdesc"] = ""
+ docs["vendorurl"] = "http://www.hp.com"
show_docs(options, docs)
conn = fence_login(options)
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 1a313ae..11ff9bc 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -87,6 +87,7 @@ Note: Since firmware update version 2.7, SNMP v2 write support is \
removed, and replaced by SNMP v3 support. So agent now has default \
SNMP version 3. If you are using older firmware, please supply -d \
for command line and snmp_version option for your cluster.conf."
+ docs["vendorurl"] = "http://www.intel.com"
show_docs(options, docs)
# Operate the fencing device
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index d520fca..507a97a 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -113,6 +113,7 @@ for root in bash). But (for example) csh use ], so in that case you \
must use parameter -c with argument ]. Very similar situation is, \
if you use bash and login to host machine with other user than \
root. Than prompt is $, so again, you must use parameter -c."
+ docs["vendorurl"] = "http://www.sun.com"
show_docs(options, docs)
##
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 2617492..831cdb1 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -421,6 +421,8 @@ def metadata(avail_opt, options, docs):
print "<?xml version=\"1.0\" ?>"
print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" shortdesc=\"" + docs["shortdesc"] + "\" >"
print "<longdesc>" + docs["longdesc"] + "</longdesc>"
+ if docs.has_key("vendorurl"):
+ print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
print "<parameters>"
for option, value in sorted_list:
if all_opt[option].has_key("shortdesc"):
diff --git a/fence/agents/mcdata/fence_mcdata.8 b/fence/agents/mcdata/fence_mcdata.8
index 2230a66..c52ffd6 100644
--- a/fence/agents/mcdata/fence_mcdata.8
+++ b/fence/agents/mcdata/fence_mcdata.8
@@ -26,6 +26,8 @@ into the GFS cluster (after reboot) the port on the McData FC switch needs to
be enabled. This can be done by running fence_mcdata and specifying the
enable action.
+Vendor URL: http://www.brocade.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
diff --git a/fence/agents/rackswitch/fence_rackswitch.8 b/fence/agents/rackswitch/fence_rackswitch.8
index 4f662c7..fc64a79 100644
--- a/fence/agents/rackswitch/fence_rackswitch.8
+++ b/fence/agents/rackswitch/fence_rackswitch.8
@@ -18,6 +18,8 @@ fence_rackswitch accepts options on the command line as well as from stdin.
fenced sends the options through stdin when it execs the agent. fence_rackswitch
can be run by itself with command line options which is useful for testing.
+Vendor URL: http://www.bladenetwork.net
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 459dfbb..888063b 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -65,6 +65,7 @@ logs into an RSA II device via telnet and reboots the associated \
machine. Lengthy telnet connections to the RSA II device should \
be avoided while a GFS cluster is running because the connection \
will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.ibm.com"
show_docs(options, docs)
##
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 086fe32..47f3bc8 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -130,6 +130,7 @@ QLogic SANBox2 FC switches. It logs into a SANBox2 switch via telnet and disabl
port. Disabling the port which a machine is connected to effectively fences that machine. \
Lengthy telnet connections to the switch should be avoided while a GFS cluster is running \
because the connection will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.qlogic.com"
show_docs(options, docs)
##
diff --git a/fence/agents/vixel/fence_vixel.8 b/fence/agents/vixel/fence_vixel.8
index dc285c5..83db14f 100644
--- a/fence/agents/vixel/fence_vixel.8
+++ b/fence/agents/vixel/fence_vixel.8
@@ -29,6 +29,8 @@ Then apply
Consult the Vixel manual for details
+Vendor URL: http://www.emulex.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index ad51687..99e5ca9 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -322,6 +322,7 @@ command is used.\
After you have successfully installed VI Perl Toolkit or VIX API, you should \
be able to run fence_vmware_helper (part of this agent) or vmrun command. \
This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0)."
+ docs["vendorurl"] = "http://www.vmware.com"
show_docs(options, docs)
# Check vmware type and set path
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 120fa81..bc25f26 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -96,6 +96,7 @@ which can be used with the WTI Network Power Switch (NPS). It logs \
into an NPS via telnet or ssh and boots a specified plug. \
Lengthy telnet connections to the NPS should be avoided while a GFS cluster \
is running because the connection will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.wti.com"
show_docs(options, docs)
##
diff --git a/fence/agents/xcat/fence_xcat.8 b/fence/agents/xcat/fence_xcat.8
index 7da35d5..719f896 100644
--- a/fence/agents/xcat/fence_xcat.8
+++ b/fence/agents/xcat/fence_xcat.8
@@ -23,6 +23,8 @@ NOTE: It is recommended that fence_bladecenter(8) is used instead of fence_xcat
the bladecenter firmware supports telnet. This interface is much cleaner and
easier to setup.
+Vendor URL: http://www.xcat.org
+
.SH OPTIONS
.TP
\fB-h\fP
diff --git a/fence/agents/zvm/fence_zvm.8 b/fence/agents/zvm/fence_zvm.8
index b22f8e1..c58d8ae 100644
--- a/fence/agents/zvm/fence_zvm.8
+++ b/fence/agents/zvm/fence_zvm.8
@@ -18,6 +18,8 @@ fence_node sends the options through stdin when it execs the agent.
fence_zvm can be run by itself with command line options which is useful
for testing.
+Vendor URL: http://www.ibm.com
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fP
14 years
fence-agents: master - New fence_scsi with config options.
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 40e5f51eec5e12e6bf25beeacdcef82aa567a4b5
Parent: 1215fd3ecec974c32df312dacb254ec29088825e
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Mon Dec 7 16:43:40 2009 -0600
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:42:11 2010 +0200
New fence_scsi with config options.
---
fence/agents/scsi/fence_scsi.pl | 379 ++++++++++++++++++++++-----------------
1 files changed, 215 insertions(+), 164 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index e58a5b1..59259cf 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -2,7 +2,7 @@
use File::Basename;
use Getopt::Std;
-use IPC::Open3;
+use POSIX;
#BEGIN_VERSION_GENERATION
$RELEASE_VERSION="";
@@ -16,67 +16,82 @@ my $ME = fileparse ($0, ".pl");
sub log_debug ($)
{
+ my $time = strftime "%b %e %T", localtime;
my ($msg) = @_;
- print STDOUT "[debug]: $msg\n" unless defined ($opt_q);
+ print STDOUT "$time $ME: [debug] $msg\n" unless defined ($opt_q);
+
+ return;
}
sub log_error ($)
{
+ my $time = strftime "%b %e %T", localtime;
my ($msg) = @_;
- print STDERR "[error]: $msg\n" unless defined ($opt_q);
+ print STDERR "$time $ME: [error] $msg\n" unless defined ($opt_q);
+
+ exit (1);
}
sub do_action_on ($@)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($node_key, @devices) = @_;
key_write ($node_key);
foreach $dev (@devices) {
+ log_error ("device $dev does not exist") if (! -e $dev);
+ log_error ("device $dev is not a block device") if (! -b $dev);
+
do_register_ignore ($node_key, $dev);
if (!get_reservation_key ($dev)) {
do_reserve ($node_key, $dev);
}
}
+
+ return;
}
sub do_action_off ($@)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($node_key, @devices) = @_;
my $host_key = key_read ();
if ($host_key eq $node_key) {
log_error ($self);
- exit (1);
}
foreach $dev (@devices) {
+ log_error ("device $dev does not exist") if (! -e $dev);
+ log_error ("device $dev is not a block device") if (! -b $dev);
+
my @keys = grep { /$node_key/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
do_preempt_abort ($host_key, $node_key, $dev);
}
}
+
+ return;
}
sub do_action_status ($@)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($node_key, @devices) = @_;
my $dev_count = 0;
my $key_count = 0;
foreach $dev (@devices) {
+ log_error ("device $dev does not exist") if (! -e $dev);
+ log_error ("device $dev is not a block device") if (! -b $dev);
+
my @keys = grep { /$node_key/ } get_registration_keys ($dev);
if (scalar (@keys) != 0) {
@@ -94,140 +109,125 @@ sub do_action_status ($@)
sub do_register ($$$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($host_key, $node_key, $dev) = @_;
if (substr ($dev, 5) =~ /^dm/) {
my @slaves = get_mpath_slaves ($dev);
-
foreach (@slaves) {
do_register ($node_key, $_);
}
return;
}
- my $cmd = "sg_persist -n -o -G -K $host_key -S $node_key -d $dev";
- $cmd .= " -Z" if (defined $opt_a);
+ log_debug ("$self (host_key=$host_key, node_key=$node_key, dev=$dev)");
+
+ my $cmd;
+ my $out;
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ $cmd = "sg_persist -n -o -G -K $host_key -S $node_key -d $dev";
+ $cmd .= " -Z" if (defined $opt_a);
+ $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub do_register_ignore ($$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($node_key, $dev) = @_;
if (substr ($dev, 5) =~ /^dm/) {
my @slaves = get_mpath_slaves ($dev);
-
foreach (@slaves) {
do_register_ignore ($node_key, $_);
}
return;
}
- my $cmd = "sg_persist -n -o -I -S $node_key -d $dev";
- $cmd .= " -Z" if (defined $opt_a);
+ log_debug ("$self (node_key=$node_key, dev=$dev)");
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ my $cmd;
+ my $out;
- waitpid ($pid, 0);
+ $cmd = "sg_persist -n -o -I -S $node_key -d $dev";
+ $cmd .= " -Z" if (defined $opt_a);
+ $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub do_reserve ($$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($host_key, $dev) = @_;
- my $cmd = "sg_persist -n -o -R -T 5 -K $host_key -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ log_debug ("$self (host_key=$host_key, dev=$dev)");
- waitpid ($pid, 0);
+ my $cmd = "sg_persist -n -o -R -T 5 -K $host_key -d $dev";
+ my $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub do_release ($$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($host_key, $dev) = @_;
- my $cmd = "sg_persist -n -o -L -T 5 -K $host_key -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ log_debug ("$self (host_key=$host_key, dev=$dev)");
- waitpid ($pid, 0);
+ my $cmd = "sg_persist -n -o -L -T 5 -K $host_key -d $dev";
+ my $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub do_preempt ($$$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($host_key, $node_key, $dev) = @_;
- my $cmd = "sg_persist -n -o -P -T 5 -K $host_key -S $node_key -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ log_debug ("$self (host_key=$host_key, node_key=$node_key, dev=$dev)");
- waitpid ($pid, 0);
+ my $cmd = "sg_persist -n -o -P -T 5 -K $host_key -S $node_key -d $dev";
+ my $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub do_preempt_abort ($$$)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($host_key, $node_key, $dev) = @_;
- my $cmd = "sg_persist -n -o -A -T 5 -K $host_key -S $node_key -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ log_debug ("$self (host_key=$host_key, node_key=$node_key, dev=$dev)");
- waitpid ($pid, 0);
+ my $cmd = "sg_persist -n -o -A -T 5 -K $host_key -S $node_key -d $dev";
+ my $out = qx { $cmd };
- die "[error]: $self ($dev)\n" if ($?>>8);
+ die "[error]: $self\n" if ($?>>8);
- close (IN);
- close (OUT);
- close (ERR);
+ return;
}
sub key_read ()
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
+ my $key;
open (\*FILE, "</var/lib/cluster/fence_scsi.key") or die "$!\n";
-
- chomp (my $key = <FILE>);
-
+ chomp ($key = <FILE>);
close (FILE);
return ($key);
@@ -235,18 +235,18 @@ sub key_read ()
sub key_write ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
open (\*FILE, ">/var/lib/cluster/fence_scsi.key") or die "$!\n";
-
print FILE "$_[0]\n";
-
close (FILE);
+
+ return;
}
sub get_key ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
my $key = sprintf ("%.4x%.4x", get_cluster_id (), get_node_id ($_[0]));
@@ -255,98 +255,76 @@ sub get_key ($)
sub get_node_id ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
+ my $node_id;
my $cmd = "cman_tool nodes -n $_[0] -F id";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
-
- waitpid ($pid, 0);
+ my $out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- chomp (my $node_id = <OUT>);
+ chomp ($out);
- close (IN);
- close (OUT);
- close (ERR);
+ $node_id = $out;
return ($node_id);
}
sub get_cluster_id ()
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
+ my $cluster_id;
my $cmd = "cman_tool status";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
-
- waitpid ($pid, 0);
+ my @out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- my $cluster_id;
-
- while (<OUT>) {
+ foreach (@out) {
chomp;
-
my ($param, $value) = split (/\s*:\s*/, $_);
-
if ($param =~ /^cluster\s+id/i) {
$cluster_id = $value;
}
}
- close (IN);
- close (OUT);
- close (ERR);
-
return ($cluster_id);
}
sub get_devices_clvm ()
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
+ my @devices;
my $cmd = "vgs --noheadings " .
- " --separator : " .
- " --sort pv_uuid " .
- " --options vg_attr,pv_name " .
- " --config 'global { locking_type = 0 } " .
- " devices { preferred_names = [ \"^/dev/dm\" ] }'";
-
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
+ " --separator : " .
+ " --sort pv_uuid " .
+ " --options vg_attr,pv_name " .
+ " --config 'global { locking_type = 0 } " .
+ " devices { preferred_names = [ \"^/dev/dm\" ] }'";
- waitpid ($pid, 0);
+ my @out = qx { $cmd 2> /dev/null };
die "[error]: $self\n" if ($?>>8);
- my @devices;
-
- while (<OUT>) {
+ foreach (@out) {
chomp;
-
my ($vg_attr, $pv_name) = split (/:/, $_);
-
if ($vg_attr =~ /c$/) {
push (@devices, $pv_name);
}
}
- close (IN);
- close (OUT);
- close (ERR);
-
return (@devices);
}
sub get_devices_scsi ()
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
+ my $self = (caller(0))[3];
+ my @devices;
opendir (\*DIR, "/sys/block/") or die "$!\n";
-
- my @devices = grep { /^sd/ } readdir (DIR);
-
+ @devices = grep { /^sd/ } readdir (DIR);
closedir (DIR);
return (@devices);
@@ -354,18 +332,16 @@ sub get_devices_scsi ()
sub get_mpath_name ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($dev) = @_;
+ my $name;
if ($dev =~ /^\/dev\//) {
$dev = substr ($dev, 5);
}
open (\*FILE, "/sys/block/$dev/dm/name") or die "$!\n";
-
- chomp (my $name = <FILE>);
-
+ chomp ($name = <FILE>);
close (FILE);
return ($name);
@@ -373,18 +349,16 @@ sub get_mpath_name ($)
sub get_mpath_uuid ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($dev) = @_;
+ my $uuid;
if ($dev =~ /^\/dev\//) {
$dev = substr ($dev, 5);
}
open (\*FILE, "/sys/block/$dev/dm/uuid") or die "$!\n";
-
- chomp (my $uuid = <FILE>);
-
+ chomp ($uuid = <FILE>);
close (FILE);
return ($name);
@@ -392,9 +366,9 @@ sub get_mpath_uuid ($)
sub get_mpath_slaves ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($dev) = @_;
+ my @slaves;
if ($dev =~ /^\/dev\//) {
$dev = substr ($dev, 5);
@@ -402,12 +376,10 @@ sub get_mpath_slaves ($)
opendir (\*DIR, "/sys/block/$dev/slaves/") or die "$!\n";
- my @slaves = grep { !/^\./ } readdir (DIR);
-
+ @slaves = grep { !/^\./ } readdir (DIR);
if ($slaves[0] =~ /^dm/) {
@slaves = get_mpath_slaves ($slaves[0]);
- }
- else {
+ } else {
@slaves = map { "/dev/$_" } @slaves;
}
@@ -418,73 +390,53 @@ sub get_mpath_slaves ($)
sub get_registration_keys ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($dev) = @_;
+ my @keys;
my $cmd = "sg_persist -n -i -k -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
-
- waitpid ($pid, 0);
+ my @out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- my @keys;
-
- while (<OUT>) {
- chomp;
-
+ foreach (@out) {
+ chomp;
if ($_ =~ s/^\s+0x//i) {
push (@keys, $_);
}
}
- close (IN);
- close (OUT);
- close (ERR);
-
return (@keys);
}
sub get_reservation_key ($)
{
- (my $self = (caller(0))[3]) =~ s/^main:://;
-
+ my $self = (caller(0))[3];
my ($dev) = @_;
+ my $key;
my $cmd = "sg_persist -n -i -r -d $dev";
- my $pid = open3 (\*IN, \*OUT, \*ERR, $cmd) or die "$!\n";
-
- waitpid ($pid, 0);
+ my @out = qx { $cmd };
die "[error]: $self\n" if ($?>>8);
- my $key;
-
- while (<OUT>) {
- chomp;
-
+ foreach (@out) {
+ chomp;
if ($_ =~ s/^\s+key=0x//i) {
$key = $_;
last;
}
}
- close (IN);
- close (OUT);
- close (ERR);
-
- return ($key);
+ return ($key)
}
sub get_options_stdin ()
{
my $num = 0;
- while (<STDIN>)
- {
+ while (<STDIN>) {
chomp;
-
s/^\s*//;
s/\s*$//;
@@ -548,29 +500,102 @@ sub print_version ()
exit (0);
}
+sub print_metadata ()
+{
+ print "<?xml version=\"1.0\" ?>\n";
+ print "<resource-agent name=\"fence_scsi\"" .
+ " shortdesc=\"fence agent for SCSI-3 persistent reservations\">\n";
+ print "<longdesc>fence_scsi</longdesc>\n";
+ print "<parameters>\n";
+ print "\t<parameter name=\"aptpl\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-a\"/>\n";
+ print "\t\t<content type=\"boolean\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Use APTPL flag for registrations" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"devices\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-d\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "List of devices to be used for fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"logfile\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-f\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "File to write error/debug messages" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"key\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-k\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Key value to be used for fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"action\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-o\"/>\n";
+ print "\t\t<content type=\"string\" default=\"off\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Fencing action" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"nodename\" unique=\"1\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-n\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Name of node" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
+ print "</parameters>\n";
+ print "<actions>\n";
+ print "\t<action name=\"on\"/>\n";
+ print "\t<action name=\"off\"/>\n";
+ print "\t<action name=\"status\"/>\n";
+ print "\t<action name=\"metadata\"/>\n";
+ print "</actions>\n";
+ print "</resource-agent>\n";
+
+ exit (0);
+}
+
################################################################################
if (@ARGV > 0) {
- getopts ("ad:f:hk:n:o:qV") or die "$!\n";
+ getopts ("ad:f:hk:n:o:qV") or print_usage;
print_usage if (defined $opt_h);
print_version if (defined $opt_V);
+
+ ## handle the metadata action here to avoid other parameter checks
+ ##
+ if ($opt_o =~ /^metadata$/i) {
+ print_metadata;
+ }
}
else {
get_options_stdin ();
}
+## if the logfile (-f) parameter was specified, open the logfile
+## and redirect STDOUT and STDERR to the logfile.
+##
if (defined $opt_f) {
open (LOG, ">$opt_f") or die "$!\n";
open (STDOUT, ">&LOG");
open (STDERR, ">&LOG");
}
+## verify that either key or nodename have been specified
+##
if ((!defined $opt_n) && (!defined $opt_k)) {
- log_error ("No '-n' or '-k' flag specified.");
- exit (1);
+ print_usage ();
}
+## determine key value
+##
if (defined $opt_k) {
$key = $opt_k;
}
@@ -578,6 +603,20 @@ else {
$key = get_key ($opt_n);
}
+## verify that key is not zero
+##
+if ($key == 0) {
+ log_error ("key cannot be zero");
+}
+
+## remove any leading zeros from key
+##
+if ($key =~ /^0/) {
+ $key =~ s/^0+//;
+}
+
+## get devices
+##
if (defined $opt_d) {
@devices = split (/\s*,\s*/, $opt_d);
}
@@ -585,10 +624,20 @@ else {
@devices = get_devices_clvm ();
}
+## verify that device list is not empty
+##
+if (scalar (@devices) == 0) {
+ log_error ("no devices found");
+}
+
+## default action is "off"
+##
if (!defined $opt_o) {
$opt_o = "off";
}
+## determine the action to perform
+##
if ($opt_o =~ /^on$/i) {
do_action_on ($key, @devices);
}
@@ -603,6 +652,8 @@ else {
exit (1);
}
+## close the logfile
+##
if (defined $opt_f) {
close (LOG);
}
14 years
fence-agents: master - config: Fix fencing attribute requirements
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 1215fd3ecec974c32df312dacb254ec29088825e
Parent: 7ea053c04f6fe838069041df50c8a5118f082c39
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Nov 19 12:39:44 2009 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:40:46 2010 +0200
config: Fix fencing attribute requirements
There is no easy way to satisfy a "required" attribute
being present in more than one location. Specifically, with
fencing devices, a required run-time parameter may appear
in one of three possible locations in cluster.conf.
Because this is difficult to detect, all fencing attributes
are now optional from the schema's perspective.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/lib/fence2rng.xsl | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
index e0c82bc..8d23ed9 100644
--- a/fence/agents/lib/fence2rng.xsl
+++ b/fence/agents/lib/fence2rng.xsl
@@ -11,12 +11,9 @@
<optional>
<attribute name="option"/> <!-- deprecated; for compatibility. use "action" -->
</optional><xsl:for-each select="parameters/parameter">
- <xsl:choose><xsl:when test="@required = 1 or @primary = 1">
- <attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" /></xsl:when><xsl:otherwise>
<optional>
<attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" />
- </optional></xsl:otherwise>
- </xsl:choose></xsl:for-each>
+ </optional></xsl:for-each>
</group>
</xsl:template>
14 years
fence-agents: master - fence-agents: Tweak translator output
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 7ea053c04f6fe838069041df50c8a5118f082c39
Parent: 86b5f9df0c82d3271476191c3561a062fb5d4186
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Nov 13 18:21:39 2009 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:39:22 2010 +0200
fence-agents: Tweak translator output
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/lib/fence2rng.xsl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
index 56f5859..e0c82bc 100644
--- a/fence/agents/lib/fence2rng.xsl
+++ b/fence/agents/lib/fence2rng.xsl
@@ -9,7 +9,7 @@
<!-- <xsl:value-of select="@name"/> -->
<group>
<optional>
- <attribute name="option"> <!-- deprecated; for compatibility. use "action" -->
+ <attribute name="option"/> <!-- deprecated; for compatibility. use "action" -->
</optional><xsl:for-each select="parameters/parameter">
<xsl:choose><xsl:when test="@required = 1 or @primary = 1">
<attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" /></xsl:when><xsl:otherwise>
14 years
fence-agents: master - fence: add fence agent -> rng generator
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 86b5f9df0c82d3271476191c3561a062fb5d4186
Parent: 11182a89cf217b3cb9cf6b170e405310bbb365a9
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Nov 13 18:16:12 2009 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Apr 20 14:39:05 2010 +0200
fence: add fence agent -> rng generator
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/lib/fence2rng.xsl | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
new file mode 100644
index 0000000..56f5859
--- /dev/null
+++ b/fence/agents/lib/fence2rng.xsl
@@ -0,0 +1,23 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="yes"/>
+<xsl:template name="capitalize">
+ <xsl:param name="value"/>
+ <xsl:variable name="normalized" select="translate($value, '_abcdefghijklmnopqrstuvwrxyz', '-ABCDEFGHIJKLMNOPQRSTUVWRXYZ')"/>
+ <xsl:value-of select="$normalized"/>
+</xsl:template>
+<xsl:template match="/resource-agent">
+ <!-- <xsl:value-of select="@name"/> -->
+ <group>
+ <optional>
+ <attribute name="option"> <!-- deprecated; for compatibility. use "action" -->
+ </optional><xsl:for-each select="parameters/parameter">
+ <xsl:choose><xsl:when test="@required = 1 or @primary = 1">
+ <attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" /></xsl:when><xsl:otherwise>
+ <optional>
+ <attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" />
+ </optional></xsl:otherwise>
+ </xsl:choose></xsl:for-each>
+ </group>
+
+</xsl:template>
+</xsl:stylesheet>
14 years