diff options
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r-- | tests/zfs-tests/include/libtest.shlib | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 4a6a15ec4..d9d23d52d 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -2050,136 +2050,6 @@ function cleanup_devices #vdevs 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 # disks as the parameter. It works by locating disks that are in use |