# /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
-#
-# Lustre Changes
-# changelog user created for each MDT
# CONFIGURATION VARIABLES
exit 5
fi
-# reuse of changelog user handled below
# 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)
# MDTLIST is derived from resources so it's already in decimal but formatted %04d
for INDEX in $MDTLIST; do
- MDT=$(printf "%04x" $((10#$INDEX)) )
+ MDT=$(printf "%s-MDT%04x" $FS $((10#$INDEX)))
MDSHOST=$(locate_resource mdt$INDEX-$FS)
CL=""
- # reuse existing changelog user
- if [ -f /etc/lamigo/$FS-MDT$MDT.conf ]; then
- CL=$(awk -F = '/^user=/{ print $2 }' /etc/lamigo/$FS-MDT$MDT.conf)
- # ensure changelog user exists
- if [ -z "$(ssh $MDSHOST lctl get_param -n mdd.$FS-MDT$MDT.changelog_users|grep $CL[[:space:]])" ]; then
- echo "Previous changelog user for $FS-MDT$MDT: $CL is missing"
+ # 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)
+ 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
- # create new user if none was previously configured
- if [ -z "$CL" ]; then
- CL=$(ssh $MDSHOST lctl --device $FS-MDT$MDT changelog_register | awk -F \' '{print $2 }')
- echo "Registered new changelog user for $FS-MDT$MDT: $CL"
- fi
- echo Creating lamigo config for $FS-MDT$MDT
- cat << EOF > /etc/lamigo/$FS-MDT$MDT.conf
-mdt=$FS-MDT$MDT
+ echo Creating lamigo config for $MDT
+ (
+ cat << EOF
+mdt=$MDT
mount=$ROOT/$FS/client
-user=$CL
min-age=$LAMIGO_MINAGE
src=$FAST_POOL
tgt=$SLOW_POOL
EOF
- for HOST in $OSSLIST; do
- echo oss=$HOST >> /etc/lamigo/$FS-MDT$MDT.conf
- done
- for HOST in $(cluset -e @all); do
- echo agent=$HOST:$ROOT/$FS/client:4 >> /etc/lamigo/$FS-MDT$MDT.conf
- done
- clush -Sa mkdir -p /etc/systemd/system/lamigo@$FS-MDT$MDT.service.d/
- cat <<EOF > /etc/systemd/system/lamigo@$FS-MDT$MDT.service.d/override.conf
+ 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 <<EOF > /etc/systemd/system/lamigo@$MDT.service.d/override.conf
[Unit]
After=lustre-$FS-client.mount
EOF
- clush -Sca /etc/lamigo/$FS-MDT$MDT.conf /etc/systemd/system/lamigo@$FS-MDT$MDT.service.d/override.conf
+ clush -Sca /etc/lamigo/$MDT.conf /etc/systemd/system/lamigo@$MDT.service.d/override.conf
- echo Creating lamigo resource for $FS-MDT$MDT
+ 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-$FS-MDT$MDT systemd:lamigo@$FS-MDT$MDT.service op monitor interval=30s op start timeout=15m op stop timeout=120s
-colocation lamigo-$FS-MDT$MDT-with-mdt inf: lamigo-$FS-MDT$MDT mdt$INDEX-$FS
-order lamigo-$FS-$MDT-after-mdt mdt$INDEX-$FS lamigo-$FS-MDT$MDT
-rsc_ticket ticket-$FS-hotpool-allocated-lamigo-$FS-MDT$MDT $FS-hotpool-allocated: lamigo-$FS-MDT$MDT loss-policy=stop
+primitive lamigo-$MDT systemd:lamigo@$MDT.service op monitor interval=30s op start timeout=15m op stop timeout=120s
+colocation lamigo-$MDT-with-mdt inf: lamigo-$MDT mdt$INDEX-$FS
+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"
done