#!/bin/ksh93
#  ALTRAN_PROLOG_BEGIN_TAG                                                    
#  This is an automatically generated prolog.                                  
#                                                                              
#  Copyright (C) Altran ACT S.A.S. 2018,2019,2021.  All rights reserved.  
#                                                                              
#  ALTRAN_PROLOG_END_TAG                                                      
#
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# 61haes_r714 src/43haes/lib/ksh93/hacmp/KLIB_HACMP_add_storage_system.sh 1.10
#
# Licensed Materials - Property of IBM
#
# COPYRIGHT International Business Machines Corp. 2011
# All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# IBM_PROLOG_END_TAG

# @(#)  1eb3b7f 43haes/lib/ksh93/hacmp/KLIB_HACMP_add_storage_system.sh, 726, 2147A_aha726, Jun 03 2021 10:33 AM
#================================================
# The following, commented line enforces coding
# standards when this file is edited via vim.
#================================================
# vim:tabstop=4:shiftwidth=4:expandtab:smarttab
#================================================

# Start of POD-formatted documentation. Viewing suggestions:
#      perldoc <FILENAME>
#      pod2text -c <FILENAME>
#      pod2text -c --code <FILENAME>
#      pod2html <FILENAME>
function devDoc {
    : <<'=cut' >/dev/null 2>&1

=head1 NAME

 KLIB_HACMP_add_storage_system

=head1 SYNOPSIS

 clmgr add storage_system <storage_system_name> \
             TYPE={ds8k_gm|xiv_rm} \
             SITE=<site> \
             AGENTS=<agent>[,<agent#2>,...] \
             VENDOR_ID=<identifier> \
             [ WWNN=<world_wide_node_name> ] \
             [ ATTRIBUTES=<NAME>@<VALUE>[,<NAME#2>@<VALUE#2>,...] ]
 clmgr add storage_system <storage_system_name> \
             TYPE=ds8k_inband_mm \
             SITE=<site> \
             VENDOR_ID=<identifier> \
             [ WWNN=<world_wide_node_name> ] \
             [ ATTRIBUTES=<NAME>@<VALUE>[,<NAME#2>@<VALUE#2>,...] ]
 clmgr add storage_system <storage_system_name> \
             TYPE=svc \
             SITE=<site> \
             ROLE={primary|auxiliary} \
             ADDRESSES=<IP>[<IP#2>,...] \
             PARTNER=<Remote Partner> \
             USER=<username> \
             [ ATTRIBUTES=<NAME>@<VALUE>[,<NAME#2>@<VALUE#2>,...] ]

 This is added for cloud backup management usage.
 clmgr add storage_system <storage_system_name> \
             TYPE=svc \
             ADDRESSES=<IP>[<IP#2>,...] \
             USER=<username> 
             BACKUP_PROFILE=true 

 NOTE: the alias for "storage_system" is "sts".

=head1 DESCRIPTION

Attempts to create a new storage system.

=head1 ARGUMENTS

 1. properties [REQUIRED] [hash ref]
    An associative array within which data about the
    created object can be returned to the caller.

 2. system_name [REQUIRED] [string]
    The label that is to be applied to this storage system.

 3. type [REQUIRED] [set]
    The type of storage technology that this storage system will be working
    with, from the set ds8k_gm, ds8k_inband_mm, emc, hitachi, svc, xiv_rm.

 4. agents [OPTIONAL] [string]
    One or more storage agents to be associated with this storage system.

 5. site [OPTIONAL] [string]
    The site that this storage system will belong to.

 6. vendor_id [OPTIONAL] [string]
    The vendor ID of this storage system.

 7. wwnn [OPTIONAL] [string]
    The World Wide Node Name for this storage system.

 8. role [OPTIONAL] [string]
    SVC-only input. This indicates whether it will act
    as the Primary or Auxiliary Cluster in a cluster
    partnership.

    Valid values: primary, auxiliary

 9. addresses [OPTIONAL] [string]
    SVC-only input. The IP address of the SVC cluster.
    For those versions of the SVC that support it (SVC
    5.1 and later), a second, alternative IP address
    for the SVC cluster can be entered. Should it not
    be possible to contact the SVC cluster on the first
    IP address, the second will be tried.

 10. partner [OPTIONAL] [string]
    SVC-only input. The name of the candidate remote SVC
    cluster this cluster will establish partnership with.

 11. attributes [OPTIONAL] [string]
   Storage-specific configuration parameters.

 12. user [OPTIONAL] [string]
     Input for svc remote backup.
 
 13. backup_profile [OPTIONAL] [boolean]
     A Boolean-like indicator.
     Enabling creates svc cluster definition for remote backup

=head1 RETURN

 0: no errors were detected; the operation appears to have been successful
 1: a general error has occurred
 2: a specified resource does not exist, or could not be found
 3: some required input was missing
 4: some detected input was incorrect in some way
 5: a required dependency does not exist
 6: a specified search failed to match any data

=head1 COPYRIGHT

COPYRIGHT International Business Machines Corp. 2005,2010
All Rights Reserved

=cut
} # End of POD-formatted documentation.


function KLIB_HACMP_add_storage_system {
    LINENO=2 . $HALIBROOT/log_entry "$0()" "$CL"
    : version= @(#)  1eb3b7f 43haes/lib/ksh93/hacmp/KLIB_HACMP_add_storage_system.sh, 726, 2147A_aha726, Jun 03 2021 10:33 AM
    : INPUTS: $*

    typeset -n properties=$1
    typeset storage_system=${2//\"/}
    typeset -l type=${3//\"/}
    typeset agents=${4//\"/}
    typeset site=${5//\"/}
    typeset vendor_id=${6//\"/}
    typeset wwnn=${7//\"/}
    typeset -l role=${8//\"/}
    typeset addresses=${9//\"/}
    typeset partner=${10//\"/}
    typeset attributes=${11//\"/}
    typeset username=${12//\"/}
    typeset backup=${13//\"/}

    [[ $CLMGR_LOGGING == 'med' ]] && set +x  # Only trace param values

    #================================================================
    : Check for a defined cluster. No need to continue without one.
    #================================================================
    CL=$LINENO isClusterDefined
    if (( $? != RC_SUCCESS )); then
        log_return_msg "$RC_MISSING_DEPENDENCY" "$0()" "$LINENO"
        return $?
    fi

    typeset -i backup_profile=0
    if [[ -n $backup ]]; then
        CL=$LINENO verify_in_set BACKUP_PROFILE "$backup" "enable, true, yes, 1" backup 
        if (( $? == RC_SUCCESS )); then 
            [[ $backup == @(t|y|1|e)* ]] && backup_profile=1
        else
            log_return_msg "$RC_INCORRECT_INPUT" "$0()" "$LINENO"
            return $?  
        fi 
    fi

    if (( $backup_profile == 0 ));then
        CL=$LINENO isEnterprise
        if (( $? != 1 )); then
            CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 184 "\nERROR: this operation requires IBM PowerHA SystemMirror for AIX Enterprise Edition.\n\n" 1>&2
            log_return_msg "$RC_MISSING_DEPENDENCY" "$0()" "$LINENO"
            return $?
        fi
    fi

    #===================================
    : Declare and initialize variables
    #===================================
    typeset -i rc=$RC_UNKNOWN

    typeset existing
    if (( $backup_profile == 0 ));then
        CL=$LINENO KLIB_HACMP_list_storage_systems existing 2>>$CLMGR_TMPLOG
    else
        CL=$LINENO KLIB_HACMP_list_storage_systems existing BACKUP=1 2>>$CLMGR_TMPLOG
    fi

    #=================
    : Validate input
    #=================
    if [[ -z $storage_system ]]; then
        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 100 "\nERROR: a name/label must be provided.\n\n" 1>&2
        rc=$RC_MISSING_INPUT

    elif [[ " ${existing[*]} " == *\ $storage_system\ * ]]; then
        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 229 "\nERROR: the specified object already exists: \"%1\$s\"\n\n" "$storage_system" 1>&2
        rc=$RC_INCORRECT_INPUT

    elif [[ -n "${storage_system//[a-zA-Z0-9_-]/}" ]] || [[ "${storage_system/#[0-9-]/}" != $storage_system ]]; then
        dspmsg -s $CLMGR_SET $CLMGR_MSGS 1451 "\nERROR: one or more invalid characters were detected in \"%1\$s\".\nValid characters include letters, numbers, hyphen and underscores only.\n.A name cannot begin with a number or hyphen.\n\n" "$storage_system" 1>&2
        rc=$RC_INCORRECT_INPUT
    fi 

    if [[ -z $type ]]; then
        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 101 "\nERROR: this operation requires the \"%1\$s\" attribute.\n\n" TYPE 1>&2
        rc=$RC_MISSING_INPUT
    elif (( $backup_profile == 0 ));then
        case $type in
            *8*g*) type=ds8k_gm        ;;
            *8*m*) type=ds8k_inband_mm ;;
            e*)    type=emc            ;;
            h*)    type=hitachi        ;;
            s*)    type=svc            ;;
            x*)    type=xiv_rm         ;;
            *) /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 110 "\nERROR: invalid value specified for \"%1\$s\":  \"%2\$s\".\n" TYPE "$type" 1>&2
               /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 3 "Valid values: %1\$s\n\n" "ds8k_gm, ds8k_inband_mm, emc, hitachi, svc, xiv_rm" 1>&2
               rc=$RC_INCORRECT_INPUT
            ;;
        esac
    else
        case $type in
           s*)    type=svc            ;;
           *) cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 110 "\nERROR: invalid value specified for \"%1\$s\":  \"%2\$s\".\n" TYPE "$type" 1>&2
              cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 3 "Valid values: %1\$s\n\n" "svc" 1>&2
              log_return_msg "$RC_INCORRECT_INPUT" "$0()" "$LINENO"
              return $?
           ;;
        esac
    fi

    if [[ $type == @(ds8k_gm|ds8k_inband_mm|xiv_rm) ]]; then
        if [[ -z $vendor_id ]]; then
            /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 101 "\nERROR: this operation requires the \"%1\$s\" attribute.\n\n" VENDOR_ID 1>&2
            rc=$RC_MISSING_INPUT
        fi
    fi

    if [[ $backup_profile == 0 ]] && [[ -z $site ]]; then
        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 101 "\nERROR: this operation requires the \"%1\$s\" attribute.\n\n" SITE 1>&2
        rc=$RC_MISSING_INPUT      
    fi
   
    if [[ -n $site ]];then
        CL=$LINENO KLIB_HACMP_is_known_site "$site" >/dev/null 2>&1
        (( $? != RC_SUCCESS )) && rc=$RC_NOT_FOUND

        if (( $rc == RC_NOT_FOUND )); then
            /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 102 "\nERROR: \"%1\$s\" does not appear to exist!\n\n" "$site" 1>&2
            /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 157 "Available Sites:\n\n" 1>&2

            typeset available
            CL=$LINENO KLIB_HACMP_list_sites available
            for (( i=0; i<${#available[*]}; i++ )); do
                 if [[ ${available[$i]} != *([[:space:]]) ]]; then
                     print -u2 "\t${available[$i]}"
                 fi
            done
            print -u2 ""
        fi
    fi
      

    if [[ -n $agents ]]; then
        for agent in ${agents//,/ }; do
            CL=$LINENO KLIB_HACMP_is_known_storage_agent "$agent"
            if (( $? != RC_SUCCESS )); then
                /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 102 "\nERROR: \"%1\$s\" does not appear to exist!\n\n" "$agent" 1>&2
                /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 163 "Available Storage Agents:\n\n" 1>&2

                typeset available
                CL=$LINENO KLIB_HACMP_list_storage_agents available
                for (( i=0; i<${#available[*]}; i++ )); do
                    if [[ ${available[$i]} != *([[:space:]]) ]]; then
                        print -u2 "\t${available[$i]}"
                    fi
                done
                rc=$RC_NOT_FOUND
            fi
        done

    elif [[ $type == @(ds8k_gm|xiv_rm) ]]; then
        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 101 "\nERROR: this operation requires the \"%1\$s\" attribute.\n\n" AGENTS 1>&2
        rc=$RC_MISSING_INPUT
    fi

    if [[ -n $type ]] && [[ -n $wwnn || -n $vendor_id ]]; then
        print -- "$0()[$LINENO]($SECONDS): /usr/es/sbin/cluster/xd_generic/xd_cli/clxd_discover_ss $type -d \"|\"" >>$CLMGR_TMPLOG  # Always log commands
        typeset SS_DATA=$(/usr/es/sbin/cluster/xd_generic/xd_cli/clxd_discover_ss $type -d "|")
        typeset -i cmd_rc=$?
        print -- "$0()[$LINENO]($SECONDS): clxd_discover_ss RC: $cmd_rc" >>$CLMGR_TMPLOG  # Always log commands

        if (( $cmd_rc == RC_SUCCESS )); then
            typeset -i VALID=0
            typeset LINE="" JUNK=""
            print -- "${SS_DATA#*$NL}" |\
            while read LINE; do
                if [[ -n $vendor_id && -n $wwnn ]]; then
                    if [[ $LINE == $vendor_id\|*\|$wwnn\|* ]]; then
                        VALID=1
                        break
                    fi
                elif [[ -n $vendor_id ]]; then
                    if [[ $LINE == $vendor_id\|* ]]; then
                        VALID=1
                        print -- "$LINE" | IFS=\| read JUNK JUNK wwnn JUNK
                        if [[ -n $wwnn ]]; then
                            cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '*** Notice: using the discovered World Wide Node Name of "%1$s" associated with vendor ID "%2$s".\n\n' "$wwnn" "$vendor_id"
                        fi
                        break
                    fi
                elif [[ -n $wwnn ]]; then
                    if [[ $LINE == *\|$wwnn\|* ]]; then
                        VALID=1
                        print -- "$LINE" | IFS=\| read vendor_id JUNK JUNK JUNK
                        if [[ -n $vendor_id ]]; then
                            cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '*** Notice: using the discovered vendor ID of "%1$s" associated with World Wide Node Name "%2$s".\n\n' "$vendor_id" "$wwnn"
                        fi
                        break
                    fi
                fi
            done

            if (( ! VALID )); then
                rc=$RC_INCORRECT_INPUT

                if [[ -n $vendor_id && -n $wwnn ]]; then
                    cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '\nERROR: failed to find a defined storage system that has a vendor ID of "%1$s" and a World Wide Node Name of "%2$s".\n\n' "$vendor_id" "$wwnn" 1>&2
                elif [[ -n $vendor_id ]]; then
                    cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '\nERROR: failed to find a defined storage system that has a vendor ID of "%1$s".\n\n' "$vendor_id" 1>&2
                elif [[ -n $wwnn ]]; then
                    cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '\nERROR: failed to find a defined storage system that has a World Wide Node Name of "%1$s".\n\n' "$wwnn" 1>&2
                fi
                print -u2 "\n${SS_DATA//\|/$TAB}\n"
            fi
        fi
    fi

    #==================================
    : Check for external dependencies
    #==================================
    case $type in
        ds8k_gm)
            if [[ ! -f "/opt/ibm/dscli/dscli" ]]; then
                CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '\nERROR: the DSCLI utility was not found in its expected location, "/opt/ibm/dscli/dscli". DSCLI is required, and must be installed in that location on all cluster nodes.\n\n' 1>&2
                rc=$RC_MISSING_DEPENDENCY
            fi
        ;;
        xiv_rm)
            if [[ ! -f "/opt/xiv/XIVGUI/xcli" ]]; then
                CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 9999 '\nERROR: the XIV CLI utility was not found in its expected location, "/opt/xiv/XIVGUI/xcli". The XIV CLI is required, and must be installed in that location on all cluster nodes.\n\n' 1>&2
                rc=$RC_MISSING_DEPENDENCY
            fi
        ;;
    esac
    
    if (( $backup_profile == 0 )); then
        if [[ $type == "svc" ]]; then
            if [[ -n $role ]]; then
                case $role in
                    m*) role="primary"    ;;
                    a*) role="auxiliary" ;;
                    *)  /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 110 "\nERROR: invalid value specified for \"%1\$s\":  \"%2\$s\".\n" ROLE "$role" 1>&2
                        /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 3 "Valid values: %1\$s\n\n" "primary, auxiliary" 1>&2
                        rc=$RC_INCORRECT_INPUT
                    ;;
                esac
            else
                CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 37 '\nERROR: option "%1$s" is required when any of the following option(s) are used: %2$s\n\n' ROLE TYPE=svc 1>&2
                rc=$RC_MISSING_INPUT
            fi

            if [[ -z $addresses ]]; then
                CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 37 '\nERROR: option "%1$s" is required when any of the following option(s) are used: %2$s\n\n' ADDRESSES TYPE=svc 1>&2
                rc=$RC_MISSING_INPUT
            fi

            if [[ -z $partner ]]; then
                CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 37 '\nERROR: option "%1$s" is required when any of the following option(s) are used: %2$s\n\n' PARTNER TYPE=svc 1>&2
                rc=$RC_MISSING_INPUT
            fi

        else
            if [[ -n $role ]]; then
                /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 180 '\nERROR: "%1$s" requires the following option(s): %2$s.\n\n' ROLE TYPE=svc 1>&2
                rc=$RC_INCORRECT_INPUT
            fi

            if [[ -n $addresses ]]; then
                /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 180 '\nERROR: "%1$s" requires the following option(s): %2$s.\n\n' ADDRESSES TYPE=svc 1>&2
                rc=$RC_INCORRECT_INPUT
            fi

            if [[ -n $partner ]]; then
                /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 180 '\nERROR: "%1$s" requires the following option(s): %2$s.\n\n' PARTNER TYPE=svc 1>&2
                rc=$RC_INCORRECT_INPUT
            fi
        fi
    fi
  
    if [[ $type == "svc" ]] ; then
        if [[ $backup_profile == 1 ]] ;then
            if [[ -z $addresses ]]; then
                cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 37 '\nERROR: option "%1$s" is required when any of the following option(s) are used: %2$s\n\n' ADDRESSES TYPE=svc 1>&2
                rc=$RC_INCORRECT_INPUT
            fi
        fi
        if [[ -z $username ]]; then
            cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 37 '\nERROR: option "%1$s" is required when any of the following option(s) are used: %2$s\n\n' USER TYPE=svc 1>&2 
            rc=$RC_INCORRECT_INPUT
        fi   
    fi
    #=================================================================
    : Create the storage system if no input errors have been detected
    #=================================================================
    if (( $rc == RC_UNKNOWN )); then
        typeset value="" aOpts="" iOpt="" IOpt="" oOpts="" vOpt="" wOpt=""
        typeset pOpt="" rOpt="" uOpt=""

        [[ $vendor_id != *([[:space:]]) ]] && vOpt=" -v $vendor_id"
        [[ $role      != *([[:space:]]) ]] && rOpt=" -r $role"
        [[ $partner   != *([[:space:]]) ]] && pOpt=" -p $partner"
        [[ $wwnn      != *([[:space:]]) ]] && wOpt=" -w $wwnn"

        if [[ -n $agents ]]; then
            for value in ${agents//,/ }; do
                aOpts="$aOpts -a $value"
            done
        fi

        if [[ -n $attributes ]]; then
            for value in ${attributes//,/ }; do
                oOpts="$oOpts -o${value//@/ }"
            done
        fi

        if [[ -n $addresses ]]; then
            typeset ip1="" ip2="" rest=""
            print -- "$addresses" | IFS=, read ip1 ip2 rest
            [[ -n $ip1 ]] && iOpt=" -i $ip1"
            [[ -n $ip2 ]] && IOpt=" -I $ip2"
        fi

        if [[ -n $username ]];then
            uOpt=" -u $username"
        fi

        if (( $backup_profile == 0 ));then
            print -- "$0()[$LINENO]($SECONDS): $HAXDWIZ/clxd_create_ss_director -n $storage_system -s $type -t $site$vOpt$wOpt$aOpts$iOpt$IOpt$rOpt$pOpt$oOpts$uOpt" >>$CLMGR_TMPLOG  # Always log commands
            $HAXDWIZ/clxd_create_ss_director -n $storage_system -s $type -t $site$vOpt$wOpt$aOpts$iOpt$IOpt$rOpt$pOpt$oOpts$uOpt
            rc=$?
            print "$0()[$LINENO]($SECONDS): clxd_create_ss_director RC: $rc" >>$CLMGR_TMPLOG  # Always log command result
        else
            print -- "$0()[$LINENO]($SECONDS): cl_cbm_add_storage_profile \"Storage_name=$storage_system\" \"Storage_type=$type\" \"Username=$username\" \"IP_address=$addresses\"" >>$CLMGR_TMPLOG  # Always log commands
            LANG=C cl_cbm_add_storage_profile "Storage_name=$storage_system" "Storage_type=$type" "Username=$username" "IP_address=$addresses"
            rc=$?
            print "$0()[$LINENO]($SECONDS): cl_cbm_add_storage_profile RC: $rc" >>$CLMGR_TMPLOG  # Always log command result 
        fi

        if (( $rc != RC_SUCCESS )); then
            /usr/bin/dspmsg -s $CLMGR_SET $CLMGR_MSGS 201 "\nERROR: failed to create \"%1\$s\".\n\n" "$storage_system" 1>&2
            rc=$RC_ERROR
        fi

        #===========================================================
        : If output from this operation was requested, retrieve it
        #===========================================================
        if (( $rc == RC_SUCCESS )); then
            if (( CLMGR_VERBOSE )) || [[ -n $CLMGR_ATTRS ]]; then
                if (( $backup_profile == 0 ));then
                    CL=$LINENO KLIB_HACMP_get_storage_system_attributes "$storage_system" properties
                else
                    CL=$LINENO KLIB_HACMP_get_storage_system_attributes "$storage_system" properties BACKUP=1
                fi
            fi
        fi
    fi

    #=======================================================================
    : If a user input error was detected, provide some helpful suggestions
    #=======================================================================
    if (( $rc == RC_MISSING_INPUT || $rc == RC_INCORRECT_INPUT )) && \
       [[ $CLMGR_GUI == *([[:space:]]) ]]
    then
        CL=$LINENO cl_dspmsg -s $CLMGR_SET $CLMGR_MSGS 104 "For more information about available options and syntax, try\n\"$HAUTILS/clmgr %1\$s\". As an\nalternative, if the PowerHA SystemMirror man pages have been installed, invoke\n\"$HAUTILS/clmgr -hv\" (or \"/usr/bin/man clmgr\"),\nsearching for \"%2\$s\" in the displayed text.\n\n" \
        "add storage_system -h" "STORAGE SYSTEM:" "$CLMGR_PROGNAME" 1>&2
    fi

    log_return_msg "$rc" "$0()" "$LINENO"
    return $?
} # End of "KLIB_HACMP_add_storage_system()"
