mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-03-03 19:28:18 +03:00
OpenZFS 7629 - Fix for 7290 neglected to remove some escape sequences
Authored by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Porting Notes:
- Multiple changes in this commit were applied in c1d9abf
.
OpenZFS-issue: https://www.illumos.org/issues/7629
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/f5fb56d
Closes #5980
This commit is contained in:
parent
7469863167
commit
10f251191f
@ -2050,136 +2050,6 @@ function cleanup_devices #vdevs
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Verify the rsh connectivity to each remote host in RHOSTS.
|
|
||||||
#
|
|
||||||
# Return 0 if remote host is accessible; otherwise 1.
|
|
||||||
# $1 remote host name
|
|
||||||
# $2 username
|
|
||||||
#
|
|
||||||
function verify_rsh_connect #rhost, username
|
|
||||||
{
|
|
||||||
typeset rhost=$1
|
|
||||||
typeset username=$2
|
|
||||||
typeset rsh_cmd="rsh -n"
|
|
||||||
typeset cur_user=
|
|
||||||
|
|
||||||
getent hosts $rhost >/dev/null 2>&1
|
|
||||||
if (($? != 0)); then
|
|
||||||
log_note "$rhost cannot be found from" \
|
|
||||||
"administrative database."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ping $rhost 3 >/dev/null 2>&1
|
|
||||||
if (($? != 0)); then
|
|
||||||
log_note "$rhost is not reachable."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ((${#username} != 0)); then
|
|
||||||
rsh_cmd="$rsh_cmd -l $username"
|
|
||||||
cur_user="given user \"$username\""
|
|
||||||
else
|
|
||||||
cur_user="current user \"`logname`\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! $rsh_cmd $rhost true; then
|
|
||||||
log_note "rsh to $rhost is not accessible" \
|
|
||||||
"with $cur_user."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify the remote host connection via rsh after rebooting
|
|
||||||
# $1 remote host
|
|
||||||
#
|
|
||||||
function verify_remote
|
|
||||||
{
|
|
||||||
rhost=$1
|
|
||||||
|
|
||||||
#
|
|
||||||
# The following loop waits for the remote system rebooting.
|
|
||||||
# Each iteration will wait for 150 seconds. there are
|
|
||||||
# total 5 iterations, so the total timeout value will
|
|
||||||
# be 12.5 minutes for the system rebooting. This number
|
|
||||||
# is an approxiate number.
|
|
||||||
#
|
|
||||||
typeset -i count=0
|
|
||||||
while ! verify_rsh_connect $rhost; do
|
|
||||||
sleep 150
|
|
||||||
((count = count + 1))
|
|
||||||
if ((count > 5)); then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Replacement function for /usr/bin/rsh. This function will include
|
|
||||||
# the /usr/bin/rsh and meanwhile return the execution status of the
|
|
||||||
# last command.
|
|
||||||
#
|
|
||||||
# $1 usrname passing down to -l option of /usr/bin/rsh
|
|
||||||
# $2 remote machine hostname
|
|
||||||
# $3... command string
|
|
||||||
#
|
|
||||||
|
|
||||||
function rsh_status
|
|
||||||
{
|
|
||||||
typeset ruser=$1
|
|
||||||
typeset rhost=$2
|
|
||||||
typeset -i ret=0
|
|
||||||
typeset cmd_str=""
|
|
||||||
typeset rsh_str=""
|
|
||||||
|
|
||||||
shift; shift
|
|
||||||
cmd_str="$@"
|
|
||||||
|
|
||||||
err_file=/tmp/${rhost}.$$.err
|
|
||||||
if ((${#ruser} == 0)); then
|
|
||||||
rsh_str="rsh -n"
|
|
||||||
else
|
|
||||||
rsh_str="rsh -n -l $ruser"
|
|
||||||
fi
|
|
||||||
|
|
||||||
$rsh_str $rhost /bin/ksh -c "'$cmd_str; \
|
|
||||||
print -u 2 \"status=\$?\"'" \
|
|
||||||
>/dev/null 2>$err_file
|
|
||||||
ret=$?
|
|
||||||
if (($ret != 0)); then
|
|
||||||
cat $err_file
|
|
||||||
rm -f $std_file $err_file
|
|
||||||
log_fail "rsh itself failed with exit code $ret..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
ret=$(grep -v 'print -u 2' $err_file | grep 'status=' | \
|
|
||||||
cut -d= -f2)
|
|
||||||
(($ret != 0)) && cat $err_file >&2
|
|
||||||
|
|
||||||
rm -f $err_file >/dev/null 2>&1
|
|
||||||
return $ret
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get the SUNWstc-fs-zfs package installation path in a remote host
|
|
||||||
# $1 remote host name
|
|
||||||
#
|
|
||||||
function get_remote_pkgpath
|
|
||||||
{
|
|
||||||
typeset rhost=$1
|
|
||||||
typeset pkgpath=""
|
|
||||||
|
|
||||||
pkgpath=$(rsh -n $rhost "pkginfo -l SUNWstc-fs-zfs | grep BASEDIR: |\
|
|
||||||
cut -d: -f2")
|
|
||||||
|
|
||||||
echo $pkgpath
|
|
||||||
}
|
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# A function to find and locate free disks on a system or from given
|
# A function to find and locate free disks on a system or from given
|
||||||
# disks as the parameter. It works by locating disks that are in use
|
# disks as the parameter. It works by locating disks that are in use
|
||||||
|
@ -125,7 +125,7 @@ function setup_snap_env
|
|||||||
# to disk before taking a snapshot.
|
# to disk before taking a snapshot.
|
||||||
#
|
#
|
||||||
if [[ $dtst == $VOL ]]; then
|
if [[ $dtst == $VOL ]]; then
|
||||||
log_must $LOCKFS -f $TESTDIR1
|
log_must lockfs -f $TESTDIR1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
log_must zfs snapshot $snap
|
log_must zfs snapshot $snap
|
||||||
|
@ -57,11 +57,11 @@ do
|
|||||||
(( i = i + 1 ))
|
(( i = i + 1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
\sleep 1
|
sleep 1
|
||||||
|
|
||||||
for pid in \$PIDS
|
for pid in \$PIDS
|
||||||
do
|
do
|
||||||
\wait \$pid
|
wait \$pid
|
||||||
(( \$? == 127 )) && exit 1
|
(( \$? == 127 )) && exit 1
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user