From 456648321375a107d41134bb47b99a12f3873a4c Mon Sep 17 00:00:00 2001 From: yujian Date: Sun, 14 Oct 2007 04:54:23 +0000 Subject: [PATCH] Branch HEAD b=13207 i=nathan i=brian 1) Adapt the lustre_config script to support upgrading 1.4 server targets to 1.6 in parallel. 2) Fix a path issue in lustre_createcsv. --- lustre/ChangeLog | 6 +++ lustre/scripts/lustre_config.in | 85 ++++++++++++++++++++++---------------- lustre/scripts/lustre_createcsv.in | 3 +- 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index e5aa671..9866492 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -407,6 +407,12 @@ Details : If LAST_ID value on disk is smaller than the objects existing in LBUG(). If the object is 0-length, then we should use the existing object. This will help to avoid a full fsck in most cases. +Severity : enhancement +Bugzilla : 13207 +Description: adapt the lustre_config script to support the upgrade case +Details : Add "-u" option for lustre_config script to support upgrading 1.4 + server targets to 1.6 in parallel. + -------------------------------------------------------------------------------- 2007-08-10 Cluster File Systems, Inc. diff --git a/lustre/scripts/lustre_config.in b/lustre/scripts/lustre_config.in index c89dca4..3fb13e8 100644 --- a/lustre/scripts/lustre_config.in +++ b/lustre/scripts/lustre_config.in @@ -47,6 +47,7 @@ Usage: `basename $0` [options] 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 @@ -64,6 +65,7 @@ execute remote commands to format (mkfs.lustre) every Lustre target 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 @@ -252,9 +254,10 @@ declare -a FAILOVERS_NAMES 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}" ] \ @@ -293,6 +296,9 @@ while getopts "aw:x:t:ndfmhv" OPTION; do m) MODIFY_FSTAB=false ;; + u) + UPGRADE_TARGET=true + ;; h) sample ;; @@ -522,21 +528,24 @@ construct_mkfs_cmdline() { 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:"\ @@ -546,42 +555,40 @@ construct_mkfs_cmdline() { 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 } @@ -682,7 +689,7 @@ gen_ha_config() { # Configure HA software config_ha() { - if [ -z "${HATYPE_OPT}" ]; then + if $UPGRADE_TARGET || [ -z "${HATYPE_OPT}" ]; then return 0 fi @@ -755,7 +762,8 @@ get_items() { 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" @@ -820,7 +828,7 @@ get_items() { fi idx=${idx}+1 - done < ${CSV_FILE} + done return 0 } @@ -980,13 +988,13 @@ mass_config() { 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 @@ -1007,7 +1015,7 @@ mass_config() { 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}" @@ -1027,13 +1035,18 @@ mass_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 @@ -1053,7 +1066,7 @@ mass_config() { return 1 fi - verbose_output "All the Lustre targets are formatted successfully!" + verbose_output "Success on all Lustre targets!" return 0 } @@ -1164,7 +1177,7 @@ if ${VERIFY_CONNECT}; then 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 diff --git a/lustre/scripts/lustre_createcsv.in b/lustre/scripts/lustre_createcsv.in index 986e6e5..752f3cd 100644 --- a/lustre/scripts/lustre_createcsv.in +++ b/lustre/scripts/lustre_createcsv.in @@ -1355,7 +1355,8 @@ get_ldds(){ params=`echo ${params#Parameters:}` break fi - done < <(${REMOTE} ${host_name} "${TUNEFS} --print --verbose ${TARGET_DEVNAMES[i]} 2>/dev/null") + done < <(${REMOTE} ${host_name} "PATH=\$PATH:/sbin:/usr/sbin + ${TUNEFS} --print --verbose ${TARGET_DEVNAMES[i]} 2>/dev/null") if [ -z "${flags}" ]; then echo >&2 "`basename $0`: get_ldds() error: Invalid" \ -- 1.8.3.1