echo "Creating config directories"
clush -Sa mkdir -p /etc/lpurge/$FS/ /etc/lamigo/ $ROOT/$FS/client
- echo "Creating lustre client mounts for $FS"
- clush -Sa "grep -q $FS/client /etc/fstab || (echo $MOUNTSPEC $ROOT/$FS/client lustre x-systemd.mount-timeout=20m,noauto,_netdev >> /etc/fstab)"
- clush -Sa mkdir -p /etc/systemd/system/lustre-$FS-client.mount.d/
- cat << EOF > /etc/systemd/system/lustre-$FS-client.mount.d/timeout.conf
-[Mount]
-TimeoutSec=20m
-EOF
- clush -Sca /etc/systemd/system/lustre-$FS-client.mount.d/timeout.conf
- clush -Sa systemctl daemon-reload
echo "Creating lustre client resource agent"
clush -Sg ha_heads crm configure <<EOF
-primitive $FS-client systemd:lustre-$FS-client.mount meta target-role=Stopped op start timeout=900s op monitor interval=60s op stop timeout=900s
+primitive $FS-client ocf:ddn:lustre-client meta target-role=Stopped params filesystem=$FS op start timeout=900s op monitor interval=60s op stop timeout=900s
clone cl-$FS-client $FS-client
rsc_ticket ticket-$FS-allocated-client $FS-allocated: cl-$FS-client loss-policy=stop
EOF
+++ /dev/null
-#!/bin/bash
-# -*- indent-tabs-mode: nil -*-
-# Copyright DDN 2021
-
-FS=$1
-
-function usage() {
- echo "Usage: $(basename $0) [-h] [FILESYSTEM]"
- echo " Convert Stratagem Hotpools HA environment to be ticket based"
-}
-
-if [ "$FS" = "-h" ] || [ "$FS" = "--help" ]; then
- usage
- exit 0
-fi
-
-function locate_resource() {
- local res=$1
- clush -N --group=ha_heads "crm_resource -QW -r $res 2> /dev/null || true"
-}
-
-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: Unable to determine filesystem automatically, please specify"
- usage
- exit 1
- fi
-fi
-
-if crm_resource -QW -r $FS-hotpool > /dev/null 2>&1; then
- echo "Hotpools for $FS already using ticket"
- exit 0
-fi
-
-MDSHOST=$(locate_resource mdt0000-$FS)
-MDTLIST=$(clush -qN -g ha_heads crm_resource --list-raw|sed -ne "s/mdt\(.*\)-$FS$/\1/p")
-FAST_POOL=$(awk -F = '/^src=/{ print $2 }' /etc/lamigo/$FS-MDT0000.conf)
-FAST_OSTLIST=$(ssh $MDSHOST lctl pool_list $FS.$FAST_POOL|sed -ne 's/.*-OST\(....\)_UUID/\1/p')
-
-ROLE=Started
-if crm_resource -r $FS-client -W |& grep -q NOT; then
- ROLE=Stopped
-fi
-
-echo "Creating hotpool ticket for $FS"
-clush -qSg ha_heads crm configure <<EOF
-primitive $FS-hotpool ocf:ddn:Ticketer params name=$FS-hotpool-allocated meta allow-migrate=true priority=199 target-role=$ROLE op start interval=0 timeout=30 op monitor interval=30 timeout=30 op stop interval=0 timeout=30
-order $FS-hotpool-after-cl-$FS-client 0: cl-$FS-client $FS-hotpool
-EOF
-
-for OST in $FAST_OSTLIST; do
- INDEX=$(printf "%04d" 0x$OST)
- echo Updating lpurge config for $FS-OST$OST
-
- echo "Updating lpurge HA for $FS-OST$OST"
-
- clush -qS --group=ha_heads "crm_resource -QW -r ost$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true
-delete lpurge-$FS-$OST-after-client
-rsc_ticket ticket-$FS-hotpool-allocated-lpurge-$FS-OST$OST $FS-hotpool-allocated: lpurge-$FS-OST$OST loss-policy=stop
-EOF"
-done
-
-# MDTLIST is derived from resources so it's already in decimal but formatted %04d
-for INDEX in $MDTLIST; do
- MDT=$(printf "%04x" $((10#$INDEX)) )
-
- echo "Updating lamigo HA for $FS-MDT$MDT"
-
- clush -qS --group=ha_heads "crm_resource -QW -r mdt$INDEX-$FS >/dev/null 2>&1 && crm configure << EOF || true
-delete lamigo-$FS-$MDT-after-client
-rsc_ticket ticket-$FS-hotpool-allocated-lamigo-$FS-MDT$MDT $FS-hotpool-allocated: lamigo-$FS-MDT$MDT loss-policy=stop
-EOF"
-done