From def5d468c89de8d0c8118198213bf57e7b1f3978 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Mon, 5 Jun 2023 09:49:29 -0400 Subject: [PATCH] EX-4130 lipe: Remove old hotpool scripts Hotpool scripts now live in EMF repo. The scrips in lipe/ are unmaintained and non-functional. Change-Id: I2f288f7f68886015ddb9a85da4e437c9f03c3928 Signed-off-by: Nathaniel Clark Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51215 Tested-by: jenkins Tested-by: Andreas Dilger Reviewed-by: Colin Faber Reviewed-by: Shuichi Ihara Reviewed-by: Artur Novik Reviewed-by: Andreas Dilger --- lipe/Makefile.am | 1 - lipe/lipe.spec.in | 5 - lipe/scripts/stratagem-hp-config.sh | 385 --------------------- lipe/scripts/stratagem-hp-deregister-changelogs.sh | 61 ---- lipe/scripts/stratagem-hp-start.sh | 49 --- lipe/scripts/stratagem-hp-stop.sh | 110 ------ lipe/scripts/stratagem-hp-teardown-client.sh | 96 ----- lipe/scripts/stratagem-hp-teardown.sh | 126 ------- 8 files changed, 833 deletions(-) delete mode 100755 lipe/scripts/stratagem-hp-config.sh delete mode 100755 lipe/scripts/stratagem-hp-deregister-changelogs.sh delete mode 100755 lipe/scripts/stratagem-hp-start.sh delete mode 100755 lipe/scripts/stratagem-hp-stop.sh delete mode 100755 lipe/scripts/stratagem-hp-teardown-client.sh delete mode 100755 lipe/scripts/stratagem-hp-teardown.sh diff --git a/lipe/Makefile.am b/lipe/Makefile.am index 86f8de0..6398579 100644 --- a/lipe/Makefile.am +++ b/lipe/Makefile.am @@ -64,7 +64,6 @@ EXTRA_DIST= \ pylipe/*.py \ pyloris/*.py \ pylustre/*.py \ - scripts/*.sh \ systemd/* \ man/* \ .pylintrc diff --git a/lipe/lipe.spec.in b/lipe/lipe.spec.in index b27b566..ccaf3f6 100644 --- a/lipe/lipe.spec.in +++ b/lipe/lipe.spec.in @@ -11,8 +11,6 @@ %define with_systemd 1 %endif -%define ddntoolsdir /opt/ddn/es/tools - Name: @PACKAGE@ Version: @VERSION@ @@ -244,8 +242,6 @@ cp src/laudit \ cp src/lamigo \ src/lpurge \ $RPM_BUILD_ROOT%{_sbindir} -mkdir -p $RPM_BUILD_ROOT%{ddntoolsdir}/ -install -m 0755 scripts/*.sh $RPM_BUILD_ROOT%{ddntoolsdir}/ %endif # hotpool mkdir -p $RPM_BUILD_ROOT%{python3_sitelib}/pylipe @@ -347,7 +343,6 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/lpurge.conf.example %{_unitdir}/lpurge@.service %{_unitdir}/lamigo@.service -%{ddntoolsdir}/*.sh %endif # hotpool %files client diff --git a/lipe/scripts/stratagem-hp-config.sh b/lipe/scripts/stratagem-hp-config.sh deleted file mode 100755 index ab95f89..0000000 --- a/lipe/scripts/stratagem-hp-config.sh +++ /dev/null @@ -1,385 +0,0 @@ -#!/bin/bash -# -*- indent-tabs-mode: nil -*- -# Copyright DDN 2021 -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### -# -# Pacemaker Ticket: -# $FS-hotpool-allocated (controlled by resource $FS-hotpool) -# -# Pacemaker Resources: -# $FS-hotpool (controlls $FS-hotpool-allocated ticket) -# cl-$FS-client (cloned client mount) -# lamigo-$FS-MDTXXXX (for each MDT) -# lpurge-$FS-OSTXXXX (for each OST in fast pool) -# -# Files Created -# /etc/lamigo/$FS-MDTXXXX.conf (for each MDT) -# /etc/lpurge/$FS/OSTXXXX.conf (for each OST in fast pool) -# /etc/fstab updated with client mount line - -# CONFIGURATION VARIABLES - -DEF_LAMIGO_MINAGE=600 -DEF_LPURGE_FREEHI=80 -DEF_LPURGE_FREELO=50 -DEF_FAST_POOL=ddn_ssd -DEF_SLOW_POOL=ddn_hdd -DEF_FAST_POOL_SPILL_THRESHOLD_PCT=90 - -CURR_RA_VER=$(rpm -q --queryformat '%{version}' ddn-es-resource-agents) -MIN_RA_VER="5.2.7" -# Sorted versions from MIN to MAX -SORTED_VERSIONS=($(echo $CURR_RA_VER $MIN_RA_VER | xargs -n1 | sort -V | xargs)) - -function usage() -{ - local rc=${1:-0} - local values=${2:-1} - echo "Usage: $(basename $0) [-h] [-n] [-m MINAGE -H FREEHI -L FREELO -f FASTPOOL -s SLOWPOOL] [ FILESYSTEM ]" - echo " Automatically configures Stratagem Hotpools in a existing HA environment" - echo " -n - No auto-detect value" - echo " -h - This help message" - echo " -m - lamigo minimum age" - echo " -H - lpurge free-hi percent" - echo " -L - lpurge free-lo percent" - echo " -f - Fast OST pool" - echo " -s - Slow OST pool" - if (( values == 1 )); then - echo "Values:" - echo " Filesystem : $FS" - echo " Fast OST Pool : $FAST_POOL" - echo " Slow OST Pool : $SLOW_POOL" - echo " LAmigo MinAge : $LAMIGO_MINAGE" - echo " LPurge FreeHI : ${LPURGE_FREEHI:-${DEF_LPURGE_FREEHI}}" - echo " LPurge FreeLO : ${LPURGE_FREELO:-${DEF_LPURGE_FREELO}}" - fi - exit $rc -} - -HELP=false -AUTO=true - -while getopts "hm:H:L:f:s:n" opt; do - case "$opt" in - m) LAMIGO_MINAGE=$OPTARG ;; - H) LPURGE_FREEHI=$OPTARG ;; - L) LPURGE_FREELO=$OPTARG ;; - f) FAST_POOL=$OPTARG ;; - s) SLOW_POOL=$OPTARG ;; - n) AUTO=false ;; - h) HELP=true ;; - esac -done -shift $((OPTIND-1)) - -FS=$1 - -# Location of /lustre/$FS/ mounts and /lustre/$FS/client mount -ROOT=/lustre - -function locate_resource() { - local res=$1 - clush -N --group=ha_heads "crm_resource -QW -r $res 2> /dev/null || true" -} - -function is_valid_percent { - local p="${1:-}" - [[ "${p}" =~ ^[[:digit:]]+$ ]] && ((0 <= p && p <= 100)) -} - -function is_minage_ok { - local p="${1:-}" - [[ "${p}" =~ ^[[:digit:]]+$ ]] && ((p >= 5)) -} - -function set_param_p() -{ - local mgs_host=$(locate_resource mgs) - local param="$1" - local value="$2" - local entry - - # lctl --device MGS llog_print params - # - { index: 2, event: set_param, device: *, parameter: obdfilter.*.access_log_size, value: 1048576 } - # - { index: 5, event: set_param, device: lustre-*, parameter: lod.lustre-*.pool.ddn_ssd.spill_target, value: ddn_hdd } - - if entry=$(ssh "${mgs_host}" lctl --device MGS llog_print params | grep --fixed-strings "parameter: ${param}, "); then - echo "param '${param}' is already set on ${msg_host}: ${entry}" >&2 - return 0 - fi - - echo "setting '${param}' = '${value}' in params log on ${mgs_host}" 2>&1 - ssh "${mgs_host}" lctl set_param -P "${param}=${value}" -} - -if [ -z "$FS" ]; then - # Try automatic detection - FS=$(crm_ticket -l|cut -f 1 -d -|grep -v ^lustre$|sort -u) - - if [ $(echo "$FS" |wc -w) -ne 1 ]; then - echo "Error: Unable to determine filesystem automatically" - usage 22 0 - fi -fi - -if $AUTO && [ ! -f /etc/lamigo/$FS-MDT0000.conf ]; then - echo "Disabling auto-detection of settings ($FS-MDT0000 config missing)" - AUTO=false -fi - -MDSHOST=$(locate_resource mdt0000-$FS) -if [ -z "$MDSHOST" ]; then - # if FS is not an resident filesystem, mdt0 will not exist for it - echo Failed to find mdt0 for filesystem: $FS - exit 5 -fi - -# get lpurge options - this gets the first OST from the FAST pool -if $AUTO; then - AUTO_FAST_POOL=$(awk -F = '/^src=/{ print $2 }' /etc/lamigo/$FS-MDT0000.conf) - AUTO_SLOW_POOL=$(awk -F = '/^tgt=/{ print $2 }' /etc/lamigo/$FS-MDT0000.conf) - AUTO_LAMIGO_MINAGE=$(awk -F = '/^min-age=/{ print $2 }' /etc/lamigo/$FS-MDT0000.conf) -fi - -# Set value: if not explicitly set, set auto, if no auto, set default -: ${FAST_POOL:=${AUTO_FAST_POOL:-${DEF_FAST_POOL}}} -: ${FAST_POOL_SPILL_THRESHOLD_PCT:=${DEF_FAST_POOL_SPILL_THRESHOLD_PCT}} -: ${SLOW_POOL:=${AUTO_SLOW_POOL:-${DEF_SLOW_POOL}}} -: ${LAMIGO_MINAGE:=${AUTO_LAMIGO_MINAGE:-${DEF_LAMIGO_MINAGE}}} - -# List of %04x formated OST indexes -FAST_OSTLIST=$(ssh $MDSHOST lctl pool_list $FS.$FAST_POOL|sed -ne 's/.*-OST\(....\)_UUID/\1/p') -if [ -z "$FAST_OSTLIST" ]; then - echo "Failed to find OSTs in Fast pool ($FS.$FAST_POOL)" - usage 2 -fi - -SLOW_OSTLIST=$(ssh $MDSHOST lctl pool_list $FS.$SLOW_POOL|sed -ne 's/.*-OST\(....\)_UUID/\1/p') -if [ -z "$SLOW_OSTLIST" ]; then - echo "Failed to find OSTs in Slow pool ($FS.$SLOW_POOL)" - usage 2 -fi - -if $AUTO; then - for OST in $FAST_OSTLIST; do - F=/etc/lpurge/$FS/OST${OST}.conf - if [ -f $F ]; then - AUTO_LPURGE_FREEHI=$(awk -F = '/^freehi=/{ print $2 }' $F) - AUTO_LPURGE_FREELO=$(awk -F = '/^freelo=/{ print $2 }' $F) - break - fi - done -fi - -: ${LPURGE_FREEHI:=${AUTO_LPURGE_FREEHI:-${DEF_LPURGE_FREEHI}}} -: ${LPURGE_FREELO:=${AUTO_LPURGE_FREELO:-${DEF_LPURGE_FREELO}}} - -if ! is_valid_percent "${LPURGE_FREEHI}"; then - echo "Invalid FREEHI percentage '${LPURGE_FREEHI}'" - usage 34 -fi - -if ! is_valid_percent "${LPURGE_FREELO}"; then - echo "Invalid FREELO percentage '${LPURGE_FREELO}'" - usage 34 -fi - -if ! is_valid_percent "${FAST_POOL_SPILL_THRESHOLD_PCT}"; then - echo "Invalid FAST_POOL_SPILL_THRESHOLD_PCT percentage '${FAST_POOL_SPILL_THRESHOLD_PCT}'" - usage 34 -fi - -if ! ((LPURGE_FREELO < LPURGE_FREEHI)); then - echo "FREELO (${LPURGE_FREELO}) must be less than FREEHI (${LPURGE_FREEHI})" - usage 34 -fi - -if ! is_minage_ok "${LAMIGO_MINAGE}"; then - echo "MINAGE (${LAMIGO_MINAGE}) must be positive integer >= 5" - usage 34 -fi - -if $HELP; then - usage 0 -fi - -echo "Using: $0 -m ${LAMIGO_MINAGE} -H ${LPURGE_FREEHI} -L ${LPURGE_FREELO} -f ${FAST_POOL} -s ${SLOW_POOL} $FS" - -OSSLIST=$(es_config_get --option fs_settings.$FS.oss_list) - -# Die on errors -set -e - -echo "Configuring OFD access logs and pool spilling" -set_param_p "obdfilter.${FS}-*.access_log_size" "1048576" -set_param_p "lod.${FS}-*.pool.${FAST_POOL}.spill_target" "${SLOW_POOL}" -set_param_p "lod.${FS}-*.pool.${FAST_POOL}.spill_threshold_pct" "${FAST_POOL_SPILL_THRESHOLD_PCT}" - -MOUNTSPEC=$(/opt/ddn/es/tools/mount_lustre_client --dry-run --fs $FS |awk '{ print $4 }') - -echo "Creating config directories" -clush -Sa mkdir -p /etc/lpurge/$FS/ /etc/lamigo/ $ROOT/$FS/client - -# Create client mount if it doesn't exist -if ! crm_resource -QW -r cl-$FS-client > /dev/null 2>&1; then - - echo "Creating lustre client resource agent" - clush -Sg ha_heads crm configure < /etc/lpurge/$FS/OST$OST.conf -device=$FS-OST$OST -# % of free space when lpurge starts looking for objects to purge -freelo=${LPURGE_FREELO} -# % of free space when lpurge stops looking for objects to purge -freehi=${LPURGE_FREEHI} -# max SSH sessions to each MDT -max_jobs=8 -scan_threads=1 -pool=$FAST_POOL -mount=$ROOT/$FS/client -scan_rate=10000 -EOF - - for MDT in $MDTLIST; do - MDSHOST=$(locate_resource mdt$MDT-$FS) - echo "mds=$((10#$MDT)):$MDSHOST:$ROOT/$FS/client" >> /etc/lpurge/$FS/OST$OST.conf - done - clush -Sca /etc/lpurge/$FS/OST$OST.conf - - echo Creating lpurge resource for $FS-OST$OST - clush -qS --group=ha_heads "crm_resource -QW -r ost$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -primitive lpurge-$FS-OST$OST systemd:lpurge@$FS-OST$OST.service op monitor interval=30s op start timeout=100s op stop timeout=100s -order lpurge-$FS-$OST-after-ost ost$INDEX-$FS lpurge-$FS-OST$OST -rsc_ticket ticket-$FS-hotpool-allocated-lpurge-$FS-OST$OST $FS-hotpool-allocated: lpurge-$FS-OST$OST loss-policy=stop -EOF" - -if [[ "${SORTED_VERSIONS[0]}" == "$MIN_RA_VER" ]]; then - clush -qS --group=ha_heads "crm_resource -QW -r ost$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -location hot-pools-prefer-recovered-$FS-OST$OST lpurge-$FS-OST$OST \ - rule -inf: not_defined OST$OST-$FS-recovered or OST$OST-$FS-recovered eq false -EOF" -else - clush -qS --group=ha_heads "crm_resource -QW -r ost$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -colocation lpurge-$FS-$OST-with-ost inf: lpurge-$FS-OST$OST ost$INDEX-$FS -EOF" -fi -done - -echo "Setting up lamigo (From $FAST_POOL to $SLOW_POOL aged at least $LAMIGO_MINAGE)" - -# MDTLIST is derived from resources so it's already in decimal but formatted %04d -for INDEX in $MDTLIST; do - MDT=$(printf "%s-MDT%04x" $FS $((10#$INDEX))) - MDTATTR=$(printf "MDT%04x-%s-recovered" $((10#$INDEX)) $FS ) - MDSHOST=$(locate_resource mdt$INDEX-$FS) - CL="" - - # Reuse any existing changelog user. If none was found then lamigo - # will register a new user with the mask it needs. - if [[ -f /etc/lamigo/$MDT.conf ]]; then - CL=$(awk -F = '/^user=/{ print $2 }' /etc/lamigo/$MDT.conf) - fi - - if [[ -z "$CL" ]]; then - CL=$(ssh $MDSHOST cat /var/lib/lamigo-$MDT.chlg || true) - fi - - if [[ -n "$CL" ]]; then - # Ensure that the changelog user we found still exists. - if ssh $MDSHOST lctl get_param -n mdd.$MDT.changelog_users | grep "$CL[[:space:]]"; then - echo "Reusing changelog user '$CL' for $MDT" - else - CL="" - fi - fi - - echo Creating lamigo config for $MDT - ( - cat << EOF -mdt=$MDT -mount=$ROOT/$FS/client -min-age=$LAMIGO_MINAGE -src=$FAST_POOL -tgt=$SLOW_POOL -EOF - - if [[ -n "$CL" ]]; then - echo user=$CL - fi - - for HOST in $OSSLIST; do - echo oss=$HOST - done - - for HOST in $(cluset -e @all); do - echo agent=$HOST:$ROOT/$FS/client:4 - done - ) > /etc/lamigo/$MDT.conf - - clush -Sa mkdir -p /etc/systemd/system/lamigo@$MDT.service.d/ - cat < /etc/systemd/system/lamigo@$MDT.service.d/override.conf -[Unit] -After=lustre-$FS-client.mount -EOF - - clush -Sca /etc/lamigo/$MDT.conf /etc/systemd/system/lamigo@$MDT.service.d/override.conf - - echo Creating lamigo resource for $MDT - clush -qS --group=ha_heads "crm_resource -QW -r mdt$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -primitive lamigo-$MDT systemd:lamigo@$MDT.service op monitor interval=30s op start timeout=15m op stop timeout=120s -order lamigo-$MDT-after-mdt mdt$INDEX-$FS lamigo-$MDT -rsc_ticket ticket-$FS-hotpool-allocated-lamigo-$MDT $FS-hotpool-allocated: lamigo-$MDT loss-policy=stop -EOF" - -if [[ "${SORTED_VERSIONS[0]}" == "$MIN_RA_VER" ]]; then - clush -qS --group=ha_heads "crm_resource -QW -r mdt$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -location hot-pools-prefer-recovered-$MDT lamigo-$MDT \ - rule -inf: not_defined $MDTATTR or $MDTATTR eq false -EOF" -else - clush -qS --group=ha_heads "crm_resource -QW -r mdt$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true -colocation lamigo-$MDT-with-mdt inf: lamigo-$MDT mdt$INDEX-$FS -EOF" -fi -done - -echo "Configuration complete. Run the following command to start services:" -echo " stratagem-hp-start.sh $FS" diff --git a/lipe/scripts/stratagem-hp-deregister-changelogs.sh b/lipe/scripts/stratagem-hp-deregister-changelogs.sh deleted file mode 100755 index 2488d68..0000000 --- a/lipe/scripts/stratagem-hp-deregister-changelogs.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### - -function mdt_hp_deregister_changelogs() { - local mdt_device="$1" - local conf=/etc/lamigo/${mdt_device}.conf - local user_list - local user - - # Removed clX-lamigo named changelog users. - lctl --device "${mdt_device}" changelog_deregister --user=lamigo - - # Remove changelog users from lamigo-${mdt_device}.conf. - user=$(awk -F = '/^user=/ { print $2 }' "${conf}") - if [[ -n "${user}" ]]; then - lctl --device "${mdt_device}" changelog_deregister "${user}" - - sed -i 's/^\(user=.*\)/## \1 ## removed by stratagem-hp-deregister-changelogs.sh/' "${conf}" - clush -ac "${conf}" - fi - - # Remove changelog users from /var/lib/lamigo-${mdt_device}.chlg - user_list=$(clush -aN cat /var/lib/lamigo-${mdt_device}.chlg) - for user in $user_list; do - lctl --device "${mdt_device}" changelog_deregister "${user}" - done - - clush -a rm -f /var/lib/lamigo-${mdt_device}.chlg -} - -function main() { - local fs="$1" - local mdt_pattern - local mdt_device_list - local mdt_device - - if [[ -z "${fs}" ]]; then - echo "Usage: $(basename $0) FILESYSTEM" >&2 - echo "Find hot pools (lamigo) changelogs on the local node and deregister" >&2 - exit 2 - fi - - mdt_pattern="^${fs}-MDT[[:xdigit:]]{4}\$" - - mdt_device_list=$(lctl device_list | - awk -v mdt_pattern="${mdt_pattern}" '$3 == "mdt" && $4 ~ mdt_pattern { print $4; }') - - for mdt_device in ${mdt_device_list}; do - mdt_hp_deregister_changelogs "${mdt_device}" - done -} - -main "$@" diff --git a/lipe/scripts/stratagem-hp-start.sh b/lipe/scripts/stratagem-hp-start.sh deleted file mode 100755 index c6d63df..0000000 --- a/lipe/scripts/stratagem-hp-start.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright DDN 2020 -# -*- indent-tabs-mode: nil -*- -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### - -FS=$1 - -function usage() { - echo "Usage: $(basename $0) [-h] [FILESYSTEM]" - echo " Start Stratagem Hotpools HA environment" -} - -if [ "$FS" = "-h" ] || [ "$FS" = "--help" ]; then - usage - exit 0 -fi - -if [ -z "$FS" ]; then - # Try automatic detection - FS=$(crm_ticket -l|cut -f 1 -d -|grep -v ^lustre$|uniq) - - if [ $(echo "$FS" |wc -w) -ne 1 ]; then - echo "Error: Could not automatically find filesystem, please specify" - usage - exit 1 - fi -fi - -if ! crm_resource -QW -r $FS-hotpool > /dev/null 2>&1; then - if clush -Ng ha_heads crm_resource -l|egrep -q "^(lamigo|lpurge)-$FS-"; then - echo "Hotpools needs conversion" - echo " Please run: stratagem-hp-convert.sh" - else - echo "Hotpools not configured" - echo " Please run: stratagem-hp-config.sh" - fi - exit 1 -fi - -echo Starting Hotpools for $FS -clush -qS --group=ha_heads crm res start cl-$FS-client $FS-hotpool diff --git a/lipe/scripts/stratagem-hp-stop.sh b/lipe/scripts/stratagem-hp-stop.sh deleted file mode 100755 index c4c28f0..0000000 --- a/lipe/scripts/stratagem-hp-stop.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# Copyright DDN 2020 -# -*- indent-tabs-mode: nil -*- -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### - -# Set a default 10+ minute timeout for waitfor() -TIMEOUT=${TIMEOUT:-600} - -NOW=false - -FS=$1 - -function usage { - echo "Usage: $(basename $0) [-h] [--now] [FILESYSTEM]" - echo " Stop stratagem hotpools in HA environment" - echo " --now - Stop mirroring processes and client mounts" -} - -function waitfor { - local ids=$* - - [ -z "$ids" ] && return - - echo -n "Waiting for $ids" - - local deadline=$((SECONDS + TIMEOUT)) - - local done=false - until $done || ((deadline < SECONDS)); do - - done=true - for i in $ids; do - # This finds the host the resource is active on (empty it is stopped) - res=$(clush -qg ha_heads crm_resource -QW -r $i 2> /dev/null) - if [ -n "$res" ]; then - done=false - echo -n "." - sleep 1 - break - fi - done - done - - echo "" - - if ! $done; then - echo "Waiting for $ids TIMED OUT!" - exit 1 - fi -} - -if [ "$FS" = "-h" ] || [ "$FS" = "--help" ]; then - usage - exit 0 - -elif [ "$FS" = "--now" ]; then - shift - NOW=true - FS=$1 -fi - -if [ -z "$FS" ]; then - # Try automatic detection - FS=$(crm_ticket -l|cut -f 1 -d -|grep -v ^lustre$|uniq) - - if [ $(echo "$FS" |wc -w) -ne 1 ]; then - echo "Error: Could not automatically find filesystem, please specify" - usage - exit 1 - fi -fi - -if crm_resource -QW -r $FS-hotpool > /dev/null 2>&1; then - echo Stopping Hotpools for $FS - clush -qS --group=ha_heads crm res stop $FS-hotpool - - if $NOW; then - waitfor $FS-hotpool - - echo Killing all lfs mirror commands for $FS - clush -q -g oss,mds,mgs pkill -f ^lfs.mirror - - echo Stopping Client mounts for $FS - clush -qS -g ha_heads crm res stop cl-$FS-client - - waitfor cl-$FS-client - fi - -elif clush -Ng ha_heads crm_resource -l|egrep -q "^(lamigo|lpurge)-$FS-"; then - echo "Stopping old style Hotpools (see stratagem-hp-convert.sh)" - clush -qS -g ha_heads crm res stop cl-$FS-client - - if $NOW; then - echo Killing all lfs mirror commands for $FS - clush -q -g oss,mds,mgs pkill -f ^lfs.mirror - fi - -else - echo "Hotpools not configured" - echo " Please run: stratagem-hp-config.sh" - exit 1 -fi diff --git a/lipe/scripts/stratagem-hp-teardown-client.sh b/lipe/scripts/stratagem-hp-teardown-client.sh deleted file mode 100755 index 6d0650a..0000000 --- a/lipe/scripts/stratagem-hp-teardown-client.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# -*- indent-tabs-mode: nil -*- -# Copyright DDN 2021 -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### -# -# Stops and remove cloned client mount -# Removes: -# resources $FS-mount (the cloned mount) -# client mount from /etc/fstab - -FS=$1 - -# Set a 10+ minute timeout for waitfor() -TIMEOUT=${TIMEOUT:-600} - -function usage() { - echo "Usage: $(basename $0) [-h] [-t SECS] [FILESYSTEM]" - echo " Tear down server client mount HA environment" - echo " -t SECS - Max timeout to wait for services to stop (default: $TIMEOUT)" -} - -while getopts "ht:" opt; do - case $opt in - h) usage; exit 0;; - t) TIMEOUT=$OPTARG;; - esac -done - -if [ "$FS" = "--help" ]; then - usage - exit 0 -fi - -if [ -z "$FS" ]; then - # Try automatic detection - FS=$(crm_ticket -l|cut -f 1 -d -|grep -v ^lustre$|uniq) - - if [ $(echo "$FS" |wc -w) -ne 1 ]; then - echo "Usage: $0 FSNAME" - exit 1 - fi -fi - -waitfor () { - local ids=$* - - [ -z "$ids" ] && return - - echo -n "Waiting for $ids" - - local deadline=$((SECONDS+TIMEOUT)) - - local done=false - until $done || ((deadline < SECONDS)); do - - done=true - for i in $ids; do - # This finds the host the resource is active on (empty it is stopped) - res=$(clush -qg ha_heads crm_resource -QW -r $i 2> /dev/null) - if [ -n "$res" ]; then - done=false - echo -n "." - sleep 1 - break - fi - done - done - - echo "" - - if ! $done; then - echo "Waiting for $ids TIMED OUT!" - exit 1 - fi -} - -res=$(clush -qNg ha_heads crm_resource -l 2> /dev/null|grep lamigo-$FS-MDT0000) -if [ -n "$res" ]; then - echo "ERROR: Please tear down Hotpools first" - exit 1 -fi - -echo Stopping Client -clush -qS --group=ha_heads crm res stop cl-$FS-client - -waitfor cl-$FS-client - -clush -qS --group=ha_heads crm config del $FS-client diff --git a/lipe/scripts/stratagem-hp-teardown.sh b/lipe/scripts/stratagem-hp-teardown.sh deleted file mode 100755 index 0eb672a..0000000 --- a/lipe/scripts/stratagem-hp-teardown.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# -*- indent-tabs-mode: nil -*- -# Copyright DDN 2020 -# -######################## For Developers only ######################## -# Hotpool configuration scripts are now moved to EMF repo -# and will be maintained there. The scripts are kept in lustre -# repo so that hotfixes if installed should not delete the scripts. -# These scripts will likely be removed from lustre repo after -# EXA 6.2 release. Any changes to be done in the scripts should be -# done in the EMF repo and the changes would be ported here. -##################################################################### -# -# After stopping hotpools (via ticket) -# Removes: -# resources lamigo-$FS-* -# resources lpurge-$FS-* -# resource $FS-hotpool -# ticket $FS-hotpool-allocated -# -# Leaves: -# all lamigo & lpurge config files -# client mount - -FS=$1 - -# Set a default 10+ minute timeout for waitfor() -TIMEOUT=${TIMEOUT:-600} - -function usage() { - echo "Usage: $(basename $0) [-h] [-t SECS] [FILESYSTEM]" - echo " Tear down Stratagem Hotpools HA environment" - echo " -t SECS - Max timeout to wait for services to stop (default: $TIMEOUT)" -} - -while getopts "ht:" opt; do - case $opt in - h) usage; exit 0;; - t) TIMEOUT=$OPTARG;; - esac -done - -if [ "$FS" = "--help" ]; then - usage - exit 0 -fi - -if [ -z "$FS" ]; then - # Try automatic detection - FS=$(crm_ticket -l|cut -f 1 -d -|grep -v ^lustre$|uniq) - - if [ $(echo "$FS" |wc -w) -ne 1 ]; then - echo "Usage: $0 FSNAME" - exit 1 - fi -fi - -waitfor () { - local ids=$* - - [ -z "$ids" ] && return - - echo -n "Waiting for $ids" - - local deadline=$((SECONDS+TIMEOUT)) - - local done=false - until $done || ((deadline < SECONDS)); do - - done=true - for i in $ids; do - # This finds the host the resource is active on (empty it is stopped) - res=$(clush -qg ha_heads crm_resource -QW -r $i 2> /dev/null) - if [ -n "$res" ]; then - done=false - echo -n "." - sleep 1 - break - fi - done - done - - echo "" - - if ! $done; then - echo "Waiting for $ids TIMED OUT!" - exit 1 - fi -} - -if ! crm_resource -QW -r $FS-hotpool > /dev/null 2>&1; then - if clush -Ng ha_heads crm_resource -l|egrep -q "^(lamigo|lpurge)-$FS-"; then - echo "Hotpools needs conversion" - echo " Please run: stratagem-hp-convert.sh" - exit 1 - else - echo "Hotpools not configured" - exit 0 - fi -fi - -echo "Stopping Hotpools for $FS" -clush -qS --group=ha_heads crm res stop $FS-hotpool - -for host in $(cluset -e @ha_heads); do - IDS=$(ssh $host crm_resource --list-raw|egrep "^(lamigo|lpurge)-$FS-") - if [ -n "$IDS" ]; then - echo Stopping lamigo and lpurge on $host - ssh $host crm res stop $IDS - - waitfor $IDS - - ssh $host crm config del $IDS - fi -done - -echo "Removing Hotpool ticket for $FS" -clush -qS --group=ha_heads crm config del $FS-hotpool - -clush -qS --group=ha_heads crm_ticket --ticket $FS-hotpool-allocated --cleanup - -echo "Removing Hotpools changelogs for $FS" -clush -aqS stratagem-hp-deregister-changelogs.sh "$FS" - -echo "Local client is still configured" -echo " to remove run: stratagem-hp-teardown-client.sh" -- 1.8.3.1