Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
sudo -E /usr/bin/sed -i.bak '/secure_path/a\Defaults exempt_group+=staff' /etc/sudoers
sudo -E /usr/bin/sed -i.bak 's/ requiretty/ !requiretty/' /etc/sudoers

4. Create auxiliary scripts required for cli_user tests:

Create file /usr/share/zfs/zpool.d/upath that contains:

Code Block
languagebash
#!/bin/sh
if [ "$1" = "-h" ] ; then
        echo "Show the underlying path for a device."
        exit
fi
 
# shellcheck disable=SC2154
echo upath="$VDEV_UPATH"

Then create file /usr/share/zfs/zpool.d/iostat with the following content:

Code Block
languagebash
#!/bin/sh
#
# Display most relevant iostat bandwidth/latency numbers.  The output is
# dependent on the name of the script/symlink used to call it.
#
helpstr="
iostat:         Show iostat values since boot (summary page).
iostat-1s:      Do a single 1-second iostat sample and show values.
iostat-10s:     Do a single 10-second iostat sample and show values."
script="${0##*/}"
if [ "$1" = "-h" ] ; then
    echo "$helpstr" | grep "$script:" | tr -s '\t' | cut -f 2-
    exit
fi
if [ "$script" = "iostat-1s" ] ; then
    # Do a single one-second sample
    interval=1
    # Don't show summary stats
    brief="yes"
elif [ "$script" = "iostat-10s" ] ; then
    # Do a single ten-second sample
    interval=10
    # Don't show summary stats
    brief="yes"
fi
if [ -f "$VDEV_UPATH" ] ; then
    # We're a file-based vdev, iostat doesn't work on us.  Do nothing.
    exit
fi
out=$(iostat -x "${VDEV_UPATH##*/}" \
    ${interval:+"$interval"} \
    ${interval:+"1"} | tail -n 2)
     
# Sample output (we want the last two lines):
#  
# Linux 2.6.32-642.13.1.el6.x86_64 (centos68)   03/09/2017      _x86_64_        (6 CPU)
#
# avg-cpu:  %user   %nice %system %iowait  %steal   %idle
#           0.00    0.00    0.00    0.00    0.00  100.00
#
# Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
# sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
#
# Get the column names
cols=$(echo "$out" | head -n 1)
# Get the values and tab separate them to make them cut-able.
vals=$(echo "$out" | tail -n 1 | tr -s '[:space:]' '\t')
i=0
for col in $cols ; do
    i=$((i+1))
    # Skip the first column since it's just the device name
    if [ $i -eq 1 ]; then
        continue
    fi
    # Get i'th value
    val=$(echo "$vals" | cut -f "$i")
    echo "$col=$val"
done

After that do the following steps:

Code Block
languagebash
cd /usr/share/zfs/zpool.d
cp iostat iostat-10s
cp iostat iostat-1s
chmod +x upath iostat iostat-10s iostat-1s

5. Login by user ztest and run tests and run script z.sh:

Info

Note : You can run tests with the special test script. The script can be created with any text editor or by executing the following command:

ztest@zone:~# cat > z.sh <<EOT

#!/bin/bash

LOG="/var/tmp/zfstest.\$(date +%F-%T).txt"

ipa=\$(sudo ifconfig | grep -A 1 vmxnet3s0 | sed '1d; s/^[ \\t]*inet[ \\t]*//; s/[ \\t]*netmask.*\$//')

sudo /sbin/zpool destroy testpool

sudo -E /usr/sbin/svcadm disable -s svc:/system/fmd:default

sudo -E find /var/fm/fmd -type f -exec rm {} \\;

sudo -E /usr/sbin/svcadm enable svc:/system/fmd:default

# we need 3 x 8G drives with 512b sector size

export DISKS="\$1 \$2 \$3"

export KEEP="rpool data"

export ZFS_USE_ONLY_DISKS=yes

#remove partition on disks

for D in \$DISKS

do

sudo -E /usr/bin/dd if=/dev/null of=/dev/dsk/\${D}p0 bs=512 count=512K

done

# cleanup drives before tests:

sudo -E /sbin/zpool create -f test123321 \$DISKS

sudo -E /sbin/zpool destroy test123321

sudo -E rm -rf /tmp/mnt* /tmp/ufs.* /tmp/log.* /tmp/tmp.* /tmp/rst* /tmp/tmpfs*

test -d /var/tmp/test_results && sudo rm -rf /var/tmp/test_results

sudo -E /usr/sbin/devfsadm -C

uname -a > \${LOG}

echo "IP Address : \${ipa}" >> \${LOG}

echo "" >> \${LOG}

echo "Disk IDs : \$DISKS" 2>&1 | /usr/bin/tee -a \${LOG}

# run tests

/bin/ksh /opt/zfs-tests/bin/zfstest \$* 2>&1 | /usr/bin/tee -a /var/tmp/z.tmp

echo "Results Summary" >> \${LOG}

echo "" >> \${LOG}

skip=\$(sed -n '/^SKIP[ \\t]*/p' /var/tmp/z.tmp | sed 's/^SKIP[ \\t]*//; s/[ \\t]*\$//')

fail=\$(sed -n '/^FAIL[ \\t]*/p' /var/tmp/z.tmp | sed 's/^FAIL[ \\t]*//; s/[ \\t]*\$//')

pass=\$(sed -n '/^PASS[ \\t]*/p' /var/tmp/z.tmp | sed 's/^PASS[ \\t]*//; s/[ \\t]*\$//')

total=0

if [ "\${pass}" != "" ]; then

total=\$((\${total} + \${pass}))

fi

if [ "\${fail}" != "" ]; then

total=\$((\${total} + \${fail}))

fi

if [ "\${skip}" != "" ]; then

total=\$((\${total} + \${skip}))

fi

echo "TOTAL TESTS: \$total" >> \${LOG}

sed '1,/Results Summary/d' /var/tmp/z.tmp >> \${LOG}

sudo rm -f /var/tmp/z.tmp

EOT

ztest@zone:~# sed -i '/./!d' z.sh && chmod 777 z.sh

After running of this script you will find the log in the /var/tmp/zfstest.<ISO TIME>.txt file. It will contain information in the format that is used in Test Results.

...

Then you can disconnect in any time by pressing Ctrl-A d and connect back in the new SSH session by the command:

...