diff --git a/heartbeat/iSCSILogicalUnit b/heartbeat/iSCSILogicalUnit index dc04c0d6d..ffe03a8b4 100644 --- a/heartbeat/iSCSILogicalUnit +++ b/heartbeat/iSCSILogicalUnit @@ -1,438 +1,443 @@ #!/bin/bash # # # iSCSILogicalUnit OCF RA. Exports and manages iSCSI Logical Units. # # Copyright (c) 2009 LINBIT HA-Solutions GmbH, Florian Haas # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # ####################################################################### # Initialization: . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs LC_ALL="C" LANG="C" # Defaults # Set a default implementation based on software installed if have_binary ietadm; then OCF_RESKEY_implementation_default="iet" elif have_binary tgtadm; then OCF_RESKEY_implementation_default="tgt" fi : ${OCF_RESKEY_implementation=${OCF_RESKEY_implementation_default}} + +# Use a default SCSI ID that is unique across the cluster, and +# persistent in the event of resource migration +OCF_RESKEY_scsi_id_default="${OCF_RESOURCE_INSTANCE}" +: ${OCF_RESKEY_scsi_id=${OCF_RESKEY_scsi_id_default}} ####################################################################### meta_data() { cat < 0.9 Manages iSCSI targets. An iSCSI target is a collection of SCSI Logical Units (LUs) exported via a daemon that speaks the iSCSI protocol. iSCSI target export agent The iSCSI target daemon implementation. Must be one of "iet" or "tgt". If unspecified, an implementation is selected based on the availability of management utilities, with "iet" being tried first, then "tgt". iSCSI target daemon implementation The iSCSI Qualified Name (IQN) that this Logical Unit belongs to. iSCSI target IQN The Logical Unit number (LUN) exposed to initiators. Logical Unit number (LUN) The path to the block device exposed. Some implementations allow this to be a regular file, too. Block device (or file) path The SCSI ID to be configured for this Logical Unit. SCSI ID - + The SCSI serial number to be configured for this Logical Unit. SCSI serial number The SCSI vendor ID to be configured for this Logical Unit. SCSI vendor ID The SCSI product ID to be configured for this Logical Unit. SCSI product ID Additional LU parameters. A space-separated list of "name=value" pairs which will be passed through to the iSCSI daemon's management interface. The supported parameters are implementation dependent. Neither the name nor the value may contain whitespace. List of iSCSI LU parameters END } ####################################################################### do_cmd() { # Wrap local commands to capture their exit code and output. Some # implementations (IET, notably) have management commands with # very terse output. It helps to at least capture exit codes in # the logs. local cmd="$*" ocf_log debug "Calling $cmd" local cmd_out cmd_out=$($cmd 2>&1) ret=$? if [ $ret -ne 0 ]; then ocf_log err "Called \"$cmd\"" ocf_log err "Exit code $ret" ocf_log err "Command output: \"$cmd_out\"" else ocf_log debug "Exit code $ret" ocf_log debug "Command output: \"$cmd_out\"" fi echo $cmd_out return $ret } iSCSILogicalUnit_usage() { cat <