If using this option, then the value of "mount options"
item in the csv file will be passed to mkfs.lustre, else
the value will be added into the /etc/fstab.
+ -u upgrade Lustre targets from 1.4 to 1.6
-v verbose mode
csv file a spreadsheet that contains configuration parameters
(separated by commas) for each target in a Lustre cluster
that will be part of the Lustre cluster.
It can also optionally:
+ * upgrade Lustre targets from 1.4 to 1.6
* verify the network connectivity and hostnames in the cluster
* configure Linux MD/LVM devices
* modify /etc/modprobe.conf to add Lustre networking info
VERIFY_CONNECT=true
CONFIG_MD_LVM=false
MODIFY_FSTAB=true
+UPGRADE_TARGET=false
VERBOSE_OUTPUT=false
# Get and check the positional parameters
-while getopts "aw:x:t:ndfmhv" OPTION; do
+while getopts "aw:x:t:ndfmuhv" OPTION; do
case $OPTION in
a)
[ -z "${SPECIFIED_NODELIST}" ] && [ -z "${EXCLUDED_NODELIST}" ] \
m)
MODIFY_FSTAB=false
;;
+ u)
+ UPGRADE_TARGET=true
+ ;;
h)
sample
;;
local mgsnids mgsnids_str
local failnids failnids_str
- MKFS_CMD=${MKFS}$" "
- MKFS_CMD=${MKFS_CMD}${REFORMAT_OPTION}
+ if $UPGRADE_TARGET; then
+ MKFS_CMD="$TUNEFS --writeconf"
+ else
+ MKFS_CMD="$MKFS $REFORMAT_OPTION"
+ fi
case "${DEVICE_TYPE[i]}" in
"ost")
- MKFS_CMD=${MKFS_CMD}$"--ost "
+ MKFS_CMD="$MKFS_CMD --ost"
;;
"mdt")
- MKFS_CMD=${MKFS_CMD}$"--mdt "
+ MKFS_CMD="$MKFS_CMD --mdt"
;;
"mgs")
- MKFS_CMD=${MKFS_CMD}$"--mgs "
+ MKFS_CMD="$MKFS_CMD --mgs"
;;
"mdt|mgs" | "mgs|mdt")
- MKFS_CMD=${MKFS_CMD}$"--mdt --mgs "
+ MKFS_CMD="$MKFS_CMD --mgs --mdt"
;;
*)
echo >&2 $"`basename $0`: construct_mkfs_cmdline() error:"\
esac
if [ -n "${FS_NAME[i]}" ]; then
- MKFS_CMD=${MKFS_CMD}$"--fsname="${FS_NAME[i]}$" "
+ MKFS_CMD="$MKFS_CMD --fsname=${FS_NAME[i]}"
fi
if [ -n "${MGS_NIDS[i]}" ]; then
mgsnids_str=${MGS_NIDS[i]}
for mgsnids in ${mgsnids_str//:/ }; do
- MKFS_CMD=${MKFS_CMD}$"--mgsnode="${mgsnids}$" "
+ MKFS_CMD="$MKFS_CMD --mgsnode=$mgsnids"
done
fi
if [ -n "${INDEX[i]}" ]; then
- MKFS_CMD=${MKFS_CMD}$"--index="${INDEX[i]}$" "
+ MKFS_CMD="$MKFS_CMD --index=${INDEX[i]}"
fi
if [ -n "${FORMAT_OPTIONS[i]}" ]; then
- MKFS_CMD=${MKFS_CMD}${FORMAT_OPTIONS[i]}$" "
+ MKFS_CMD="$MKFS_CMD ${FORMAT_OPTIONS[i]}"
fi
- if [ -n "${MKFS_OPTIONS[i]}" ]; then
- MKFS_CMD=${MKFS_CMD}$"--mkfsoptions="$"\""${MKFS_OPTIONS[i]}$"\""$" "
+ if ! $UPGRADE_TARGET && [ -n "${MKFS_OPTIONS[i]}" ]; then
+ MKFS_CMD="$MKFS_CMD --mkfsoptions=\"${MKFS_OPTIONS[i]}\""
fi
- if [ -n "${MOUNT_OPTIONS[i]}" ]; then
- if ! ${MODIFY_FSTAB}; then
- MKFS_CMD=${MKFS_CMD}$"--mountfsoptions="$"\""${MOUNT_OPTIONS[i]}$"\""$" "
- fi
+ if [ -n "${MOUNT_OPTIONS[i]}" ] && ! $MODIFY_FSTAB; then
+ MKFS_CMD="$MKFS_CMD --mountfsoptions=\"${MOUNT_OPTIONS[i]}\""
fi
if [ -n "${FAILOVERS[i]}" ]; then
failnids_str=${FAILOVERS[i]}
for failnids in ${failnids_str//:/ }; do
- MKFS_CMD=${MKFS_CMD}$"--failnode="${failnids}$" "
+ MKFS_CMD="$MKFS_CMD --failnode=$failnids"
done
fi
- MKFS_CMD=${MKFS_CMD}${DEVICE_NAME[i]}
+ MKFS_CMD="$MKFS_CMD ${DEVICE_NAME[i]}"
return 0
}
# Configure HA software
config_ha() {
- if [ -z "${HATYPE_OPT}" ]; then
+ if $UPGRADE_TARGET || [ -z "${HATYPE_OPT}" ]; then
return 0
fi
declare -i line_num=0
declare -i idx=0
- while read -r LINE; do
+ exec 9< ${CSV_FILE}
+ while read -u 9 -r LINE; do
line_num=${line_num}+1
# verbose_output "Parsing line ${line_num}: $LINE"
fi
idx=${idx}+1
- done < ${CSV_FILE}
+ done
return 0
}
declare -i i=0
if [ ${#HOST_NAME[@]} -eq 0 ]; then
- verbose_output "There are no Lustre targets to be formatted."
+ verbose_output "There are no lustre targets specified."
return 0
fi
- # Start lnet network in the MGS node
- if ! start_mgs_lnet; then
- return 1
+ if ! $UPGRADE_TARGET; then
+ # Start lnet network in the MGS node
+ start_mgs_lnet || return 1
fi
for ((i = 0; i < ${#HOST_NAME[@]}; i++)); do
return 1
fi
- if ! is_mgs_node ${HOST_NAME[i]}; then
+ if ! $UPGRADE_TARGET && ! is_mgs_node ${HOST_NAME[i]}; then
# Execute remote command to add lnet options lines to
# modprobe.conf/modules.conf
COMMAND=$"echo \"${MODULE_OPTS[i]}\"|${MODULE_CONFIG}"
fi
fi
- # Execute remote command to format Lustre target
- verbose_output "Formatting Lustre target ${DEVICE_NAME[i]} on ${HOST_NAME[i]}..."
- REMOTE_CMD[${pid_num}]="${REMOTE} ${HOST_NAME[i]} \"(${EXPORT_PATH} ${MKFS_CMD})\""
- verbose_output "Format command line is: ${REMOTE_CMD[${pid_num}]}"
- ${REMOTE} ${HOST_NAME[i]} "(${EXPORT_PATH} ${MKFS_CMD})" >&2 &
- REMOTE_PID[${pid_num}]=$!
- pid_num=${pid_num}+1
+ # Execute remote command to format or upgrade Lustre target
+ local OP
+ $UPGRADE_TARGET && OP="Upgrading" || OP="Formatting"
+ verbose_output "$OP Lustre target ${DEVICE_NAME[i]} on ${HOST_NAME[i]}..."
+
+ COMMAND="$EXPORT_PATH $MKFS_CMD"
+ REMOTE_CMD[$pid_num]="$REMOTE ${HOST_NAME[i]} \"$COMMAND\""
+ verbose_output "$OP command line is: ${REMOTE_CMD[$pid_num]}"
+
+ $REMOTE ${HOST_NAME[i]} "$COMMAND" &
+ REMOTE_PID[$pid_num]=$!
+ let pid_num=$pid_num+1
sleep 1
done
return 1
fi
- verbose_output "All the Lustre targets are formatted successfully!"
+ verbose_output "Success on all Lustre targets!"
return 0
}
echo
fi
-if ${CONFIG_MD_LVM}; then
+if $CONFIG_MD_LVM && ! $UPGRADE_TARGET; then
# Configure Linux MD/LVM devices
echo "`basename $0`: Configuring Linux MD/LVM devices..."
if ! ${SCRIPT_CONFIG_MD} ${NODELIST_OPT} ${VERBOSE_OPT} ${CSV_FILE}; then