Files

93 lines
3.2 KiB
Bash
Raw Permalink Normal View History

2026-05-05 21:40:46 +00:00
#!/usr/bin/env bash
2026-05-08 21:18:22 +00:00
set -euo pipefail
2026-05-05 21:40:46 +00:00
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=00_env.sh
. "$SCRIPT_DIR/00_env.sh"
DEVICES=""
SERVERS=""
EXECUTE=false
usage() {
printf 'Usage: %s --fs <filesystem> --devices "/dev/sdb /dev/sdc" --servers "node1,node2" --failure-group <number> --pool <storage_pool> --usage <dataOnly|metadataOnly|dataAndMetadata> [--execute]\n' "$(basename "$0")"
}
while [[ "$#" -gt 0 ]]; do
case "$1" in
--fs) FILESYSTEM="${2:-}"; shift 2 ;;
--devices) DEVICES="${2:-}"; shift 2 ;;
--servers) SERVERS="${2:-}"; shift 2 ;;
--failure-group) FAILURE_GROUP="${2:-}"; shift 2 ;;
--pool) STORAGE_POOL="${2:-}"; shift 2 ;;
--usage) USAGE="${2:-}"; shift 2 ;;
--execute) EXECUTE=true; DRY_RUN=false; shift ;;
-h|--help) usage; exit 0 ;;
*) critical "Unknown argument: $1"; usage; exit 2 ;;
esac
done
section "Recommended GPFS Expansion Flow"
cat <<FLOW
Step 1: Cluster overview
$SCRIPT_DIR/01_cluster_overview.sh
Step 2: GPFS precheck
$SCRIPT_DIR/02_precheck_gpfs.sh --fs <filesystem>
Step 3: Detect candidate disks
$SCRIPT_DIR/03_detect_new_disks.sh --exclude-mounted --exclude-existing-nsd
Step 4: Generate NSD stanza
$SCRIPT_DIR/04_create_nsd_stanza.sh --fs <filesystem> --devices "/dev/sdb /dev/sdc" --servers "node1,node2" --failure-group <number> --pool <storage_pool> --usage <usage>
Step 5: Create NSDs and add disks to filesystem
$SCRIPT_DIR/05_add_nsd_to_filesystem.sh --fs <filesystem> --stanza <stanza_file> [--execute]
Step 6: Optional restripe/rebalance
$SCRIPT_DIR/06_rebalance_filesystem.sh --fs <filesystem> [--execute] [--background]
Step 7: Post-check
$SCRIPT_DIR/07_postcheck_gpfs.sh --fs <filesystem>
Step 8: Generate report
$SCRIPT_DIR/08_generate_report.sh --fs <filesystem>
FLOW
if [[ -z "$FILESYSTEM" ]]; then
warning "No --fs supplied. Printed runbook only."
exit 0
fi
if [[ "$EXECUTE" == "true" ]]; then
warning "--execute was supplied. Destructive steps still require the individual script confirmation prompt."
else
DRY_RUN=true
fi
section "Running Safe Read-Only Steps"
"$SCRIPT_DIR/01_cluster_overview.sh" || warning "Cluster overview reported warnings or failures"
"$SCRIPT_DIR/02_precheck_gpfs.sh" --fs "$FILESYSTEM" || warning "Precheck reported warnings or failures"
"$SCRIPT_DIR/03_detect_new_disks.sh" --exclude-mounted --exclude-existing-nsd || warning "Disk detection reported warnings or failures"
if [[ -n "$DEVICES" || -n "$SERVERS" || -n "$FAILURE_GROUP" ]]; then
if [[ -z "$DEVICES" || -z "$SERVERS" || -z "$FAILURE_GROUP" ]]; then
warning "NSD stanza generation requires --devices, --servers, --failure-group, --pool, and --usage"
else
"$SCRIPT_DIR/04_create_nsd_stanza.sh" \
--fs "$FILESYSTEM" \
--devices "$DEVICES" \
--servers "$SERVERS" \
--failure-group "$FAILURE_GROUP" \
--pool "$STORAGE_POOL" \
--usage "$USAGE"
fi
fi
section "Next Manual Step"
if [[ "$EXECUTE" == "true" ]]; then
warning "Run 05_add_nsd_to_filesystem.sh manually with --execute after reviewing the generated stanza."
else
ok "Review outputs and generated stanza. Add disks only through 05_add_nsd_to_filesystem.sh with --execute."
fi