Files
Mateusz Suski ca5a876d03
lint / shell-yaml-ansible (push) Failing after 21s
Improve infra-run portfolio credibility
2026-05-08 21:18:22 +00:00

93 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=00_env.sh
source "$SCRIPT_DIR/00_env.sh"
RUN_STEPS=false
usage() {
cat <<'USAGE'
Usage:
./veritas_extend_runbook.sh --sg <service_group> --dg <diskgroup> --vol <volume> --mount <mountpoint> --size <+SIZE> --disks "disk1 disk2" [--execute] [--run]
Options:
--run Run each step in the recommended order. Without --run, only print the runbook.
--execute Pass --execute to change steps. Dry-run remains the default.
USAGE
usage_common
}
args=()
while (( "$#" > 0 )); do
case "$1" in
--run)
RUN_STEPS=true
shift
;;
--help|-h)
usage
exit 0
;;
*)
args+=("$1")
shift
;;
esac
done
parse_common_args "${args[@]}"
cat <<FLOW
Veritas VxVM/VCS storage expansion runbook
Mode: $(if [[ "$DRY_RUN" == "true" ]]; then printf 'DRY-RUN'; else printf 'EXECUTE'; fi)
Log file: $LOG_FILE
Step 1: Detect new LUNs
$SCRIPT_DIR/01_detect_new_luns.sh
Step 2: Run VCS/VxVM precheck
$SCRIPT_DIR/02_precheck_vcs_vxvm.sh --sg "$SERVICE_GROUP" --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT"
Step 3: Freeze VCS service group
$SCRIPT_DIR/03_freeze_vcs_group.sh --sg "$SERVICE_GROUP"
Step 4: Initialize new VxVM disks
$SCRIPT_DIR/04_init_vxvm_disks.sh --disks "$DISKS"
Step 5: Add disks to diskgroup
$SCRIPT_DIR/05_extend_diskgroup.sh --dg "$DISKGROUP" --disks "$DISKS"
Step 6: Grow volume and filesystem
$SCRIPT_DIR/06_extend_volume_fs.sh --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT" --size "$SIZE"
Step 7: Run post-check
$SCRIPT_DIR/07_postcheck_vcs_vxvm.sh --sg "$SERVICE_GROUP" --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT"
Step 8: Unfreeze VCS service group
$SCRIPT_DIR/08_unfreeze_vcs_group.sh --sg "$SERVICE_GROUP"
FLOW
if [[ "$RUN_STEPS" != "true" ]]; then
warning "runbook printed only; add --run to invoke steps"
exit 0
fi
require_inputs sg dg vol mount size disks
execute_arg=()
if [[ "$DRY_RUN" == "false" ]]; then
warning "--execute supplied to wrapper; destructive steps will request confirmation individually"
execute_arg=(--execute)
fi
"$SCRIPT_DIR/01_detect_new_luns.sh"
"$SCRIPT_DIR/02_precheck_vcs_vxvm.sh" --sg "$SERVICE_GROUP" --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT"
"$SCRIPT_DIR/03_freeze_vcs_group.sh" --sg "$SERVICE_GROUP" "${execute_arg[@]}"
"$SCRIPT_DIR/04_init_vxvm_disks.sh" --disks "$DISKS" "${execute_arg[@]}"
"$SCRIPT_DIR/05_extend_diskgroup.sh" --dg "$DISKGROUP" --disks "$DISKS" "${execute_arg[@]}"
"$SCRIPT_DIR/06_extend_volume_fs.sh" --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT" --size "$SIZE" "${execute_arg[@]}"
"$SCRIPT_DIR/07_postcheck_vcs_vxvm.sh" --sg "$SERVICE_GROUP" --dg "$DISKGROUP" --vol "$VOLUME" --mount "$MOUNTPOINT"
"$SCRIPT_DIR/08_unfreeze_vcs_group.sh" --sg "$SERVICE_GROUP" "${execute_arg[@]}"