commands:
base [ create | boot ] ...
- cluster [ destroy | create | update_hosts | boot | configure ] ...
+ cluster [ build | destroy | create | update_hosts | boot | configure ] ...
create base
create a base image
echo ""
}
+waitfor ()
+{
+ local file="$1"
+ local msg="$2"
+ local timeout="$3"
+
+ local tmpfile=$(mktemp)
+
+ cat <<EOF >"$tmpfile"
+spawn tail -n 10000 -f $file
+expect -timeout $timeout -re "$msg"
+EOF
+
+ export LANG=C
+ expect "$tmpfile"
+ rm -f "$tmpfile"
+
+ if ! grep -E "$msg" "$file" > /dev/null; then
+ echo "Failed to find \"$msg\" in \"$file\""
+ return 1
+ fi
+
+ return 0
+}
+
###############################
# Indirectly call a function named by ${1}_${2}
case "$CLUSTER_TYPE" in
"build")
- # Build node doesn't really need CTDB/Samba to be
- # installed, if the packages are not present in the repo,
- # they're skipped.
- $ssh "$n1" "./scripts/setup_build.sh || true"
+ $ssh "$n1" ./scripts/install_packages.sh clusterfs build
+ $ssh "$n1" ./scripts/setup_cluster.sh build
;;
"ad")
- $ssh "$n1" ./scripts/setup_ad_server.sh
+ $ssh "$n1" ./scripts/install_packages.sh ad_server
+ $ssh "$n1" ./scripts/configure_cluster.sh ad_server
;;
"samba")
sed -n -e 's/Name: *//p')
for i in $nodes ; do
- $ssh "$i" ./scripts/install_gpfs_nas.sh
+ $ssh "$i" ./scripts/install_packages.sh clusterfs nas
done
- $ssh "$n1" ./scripts/setup_gpfs.sh
- if [ "$AUTH_METHOD" = "winbind" ]; then
- args="-UAdministrator%${AD_ADMIN_PASS}"
- else
- args=""
- fi
- $ssh "$n1" ./scripts/setup_cluster.sh "$args"
+ $ssh "$n1" ./scripts/setup_cluster.sh clusterfs nas
;;
esac
}
case "$t" in
destroy|create|update_hosts|boot|configure)
actions_add "cluster_${t}" ;;
+ build)
+ for t in destroy create update_hosts boot configure ; do
+ actions_add "cluster_${t}"
+ done
+ ;;
*) usage ;;
esac
done