2. • This is the second in a series of presenta0ons dedicated to SAP
Landscape Virtualiza0on Management (LVM)
• This document provides a quick overview of how you can
customize LVM with custom opera0ons and hooks and is aimed
at system administrators responsible for configuring and
opera0ng SAP LVM
• This document describes how this can be achieved in a UNIX
environment but can be easily adapted for the Windows
plaKorm
• In this presenta0on, we will show you how to create custom
opera0ons and hooks for managing a Red Hat® cluster
containing the SAP Central Services (SCS)
Introduc3on
3. Overview
• SAP LVM manages SAP instances and databases as standard
using the SAP Host Agent
• Out-‐of-‐the box opera0ons include “stop”, “start”, “mass stop”,
“mass start”
• SAP LVM can be extended to include custom opera0ons that
can be associated with instances and hosts
• Custom opera0ons are defined in LVM via a Provider
Implementa0on and Custom Opera0on and Hooks defini0on
• Custom opera0ons are registered with the SAP Host Agent
using a configura0on file
4. Provider
Implementa3on
• The Provider Implementa0on defines the link between LVM and
the host agent and describes how the custom opera0ons are
implemented
• In this example, the provider implementa0on
“LVM_CustomOpera0on_ClusterAdm” will be defined
• The Provider Implementa0on must include the custom
parameter OPERATION which LVM will supply to the host agent
when triggered
• The host agent configura0on file defini0on for the provider
implementa0on will call the Korn script with the $[PARAM-‐
OPERATION] parameter
6. Custom
Opera3on
Defini3ons
• The custom opera0on “Freeze” is used to freeze the Red Hat cluster
so other opera0ons can take place without a cluster failover
7. Custom
Opera3on
Defini3ons
• The important fields to note here are the “Name” and “Bu^on
Group” – Freeze and Cluster Opera0on respec0vely
• The custom parameter “Opera0on” has been set to FREEZE
which will be passed to the host agent and Korn script via the
configura0on file
• The “Name” and “Bu^on Group” appear on the host opera0on
screen in LVM
• Clicking the Cluster Opera0on bu^on triggers the custom
opera0on and the associated Korn script
• Similar custom opera0ons are created for “Unfreeze” and
“Relocate”
8. Custom
Hook
Defini3ons
• The custom hook is needed to intercept SAP system stop and start requests
to prepare the cluster (freeze/unfreeze) so that cluster monitoring does not
incorrectly start or stop the instance whilst valid stop/start opera0ons are
being performed
9. Host
Agent
Registered
Script
• For each Provider Implementa0on a standard host agent configura0on file
with extension “.conf” must be created in the “opera0ons.d” sub-‐directory
of /usr/sap/hostctrl/exe
• For the cluster management custom opera0ons the sample configura0on
file “ClusterAdm.conf” would look as below
• The “Name” must match the name of the Registered Script on the Provider
Implementa0on in LVM
• The $[PARAM-‐OPERATION] can be seen being passed as the first parameter
to the Korn script, indica0ng the custom opera0on being requested by LVM
File
Content
ClusterAdm.conf Name: LVM_CustomOperation_ClusterAdm
Command: /sap/Scripts/ClusterAdm.ksh $[PARAM-OPERATION] $[SAPSYSTEMNAME]
Workdir: $[DIR_HOME:#sapparam]
Username: root
ResultConverter: flat
10. Example
Script
–
ClusterAdm.ksh
Sample
Coding
(perform
any
site
specific
checks
beforehand)
#
# Variables from LVM via Hostagent Configuration File
#
OPERATION=$1
SAPSYSTEMNAME=$2
SERVICE=<your cluster service>
#
# Determine requested operation
#
case $OPERATION in
STOP) echo "[RESULT]: ${OPERATION} requested for a clustered service”
if [[ ${STATUS} != "FROZEN" ]]; then
echo "[RESULT]: Service group is not currently frozen; FREEZE operation will be enforced”
fi
OPERAND="-Z";;
START) echo "[RESULT]: ${OPERATION} requested for a clustered service”
if [[ ${STATUS} != "FROZEN" ]]; then
echo "[RESULT]: Service group is not frozen; nothing to do”
exit 0
fi
OPERAND="-U";;
11. Example
Script
–
ClusterAdm.ksh
Sample
Coding
(con;nued)
FREEZE) echo "[RESULT]: Cluster operation ${OPERATION} requested”
if [[ ${STATUS} == "FROZEN" ]]; then
echo "[RESULT]: Service group is already frozen; nothing to do”
exit 0
fi
OPERAND="-Z";;
UNFREEZE) echo "[RESULT]: Cluster operation ${OPERATION} requested”
if [[ ${STATUS} != "FROZEN" ]]; then
echo "[RESULT]: Service group ${SERVICE} is not frozen; nothing to do”
exit 0
fi
OPERAND="-U";;
RELOCATE) echo "[RESULT]: Cluster operation ${OPERATION} requested”
if [[ ${STATUS} == "FROZEN" ]]; then
echo "[ERROR]: Service group ${SERVICE} is frozen; ${OPERATION} operation not possible”
exit 8
fi
OPERAND="-r";;
*) echo "[ERROR]: Invalid cluster operation - ${OPERATION}”
exit 8;;
esac
13. Reference
Material
• The following pages on SAP Help are useful:
– Configuring Custom Opera0ons
– Configuring Custom Hooks
• The following SAP notes provide some informa0on:
– 1465491 -‐ Provider Implementa0on Defini0on
• Further details are available on request
– mailto:info@aliterconsul0ng.co.uk