Package contains functions for interacting with hana database and related actions.
hdb_stop(instance_id=>'00', [switch_user=>'sidadm', command=>'kill']);
Stop hana database using HDB stop
command. Function expects to be executed as sidadm, however you can use switch_user to execute command using sudo su -
as a different user. The user needs to have correct permissions for performing requested action. Function waits till all DB processes are stopped.
instance_id: Database instance ID. Mandatory.
switch_user: Execute command as specified user with help of sudo su -
. Default: undef
command: HDB command to trigger. Default: stop
wait_for_failed_resources();
Wait until 'crm_mon' starts showing failed resources. This can be used as first indicator of a started failover.
wait_for_takeover(target_node=>'expeliarmus');
Waits until target_node performs takeover and reaches 'PRIM' state.
target_node: Node hostname which is expected to take over.
register_replica(target_hostname=>'Dumbledore', instance_id=>'00' [, switch_user=>'hdbadm']);
Executes replica node registration after failover using 'hdbnsutil' command. Node must be stopped, otherwise command fails.
target_hostname: Hostname of the node that should be registered as replica
instance_id: Instance ID
switch_user: Execute command as specified user with help of sudo su -
. Default: undef
get_node_roles();
Returns HASHREF containing current status of Hana cluster node roles by parsing 'SAPHanaSR-showAttr' output. Example: {primary_node=>'Harry', failover_node='Potter'}
check_node_roles(expected_primary=>'Albus', expected_failover=>'Dumbledore');
Checks if expected node roles match current node order. Returns if roles match, otherwise test dies.
expected_primary hostname of expected primary node
expected_failover hostname of expected failover node
find_hana_resource_name();
Finds SAP Hana primitive resource name by listing primitives with type 'ocf:suse:SAPHana'.