Skip to content

Commit

Permalink
Add a TAG Client/Server system for ZTS
Browse files Browse the repository at this point in the history
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
  • Loading branch information
mcmilk committed Oct 11, 2024
1 parent 97ba7c2 commit 6666da5
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 79 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/scripts/qemu-1-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""

# we expect RAM shortage
cat << EOF | sudo tee /etc/ksmtuned.conf > /dev/null
# /etc/ksmtuned.conf - Configuration file for ksmtuned
# https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/chap-ksm
KSM_MONITOR_INTERVAL=60
# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
KSM_SLEEP_MSEC=10
KSM_NPAGES_BOOST=300
KSM_NPAGES_DECAY=-50
KSM_NPAGES_MIN=64
KSM_NPAGES_MAX=2048
KSM_THRES_COEF=25
KSM_THRES_CONST=2048
KSM_SLEEP_MSEC=30
KSM_NPAGES_BOOST=0
KSM_NPAGES_DECAY=0
KSM_NPAGES_MIN=1000
KSM_NPAGES_MAX=25000
KSM_THRES_COEF=80
KSM_THRES_CONST=8192
LOGFILE=/var/log/ksmtuned.log
DEBUG=1
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/scripts/qemu-3-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function archlinux() {
sudo pacman -Sy --noconfirm base-devel bc cpio dhclient dkms fakeroot \
fio gdb inetutils jq less linux linux-headers lsscsi nfs-utils parted \
pax perf python-packaging python-setuptools qemu-guest-agent ksh samba \
sysstat rng-tools rsync wget xxhash
socat sysstat rng-tools rsync wget xxhash
echo "##[endgroup]"
}

Expand All @@ -38,7 +38,8 @@ function debian() {
lsscsi nfs-kernel-server pamtester parted python3 python3-all-dev \
python3-cffi python3-dev python3-distlib python3-packaging \
python3-setuptools python3-sphinx qemu-guest-agent rng-tools rpm2cpio \
rsync samba sysstat uuid-dev watchdog wget xfslibs-dev xxhash zlib1g-dev
rsync samba socat sysstat uuid-dev watchdog wget xfslibs-dev xxhash \
zlib1g-dev
echo "##[endgroup]"
}

Expand All @@ -48,7 +49,8 @@ function freebsd() {
echo "##[group]Install Development Tools"
sudo pkg install -y autoconf automake autotools base64 checkbashisms fio \
gdb gettext gettext-runtime git gmake gsed jq ksh93 lcov libtool lscpu \
pkgconf python python3 pamtester pamtester qemu-guest-agent rsync xxhash
pkgconf python python3 pamtester pamtester qemu-guest-agent rsync socat \
xxhash
sudo pkg install -xy \
'^samba4[[:digit:]]+$' \
'^py3[[:digit:]]+-cffi$' \
Expand All @@ -75,7 +77,8 @@ function rhel() {
lsscsi mdadm nfs-utils openssl-devel pam-devel pamtester parted perf \
python3 python3-cffi python3-devel python3-packaging kernel-devel \
python3-setuptools qemu-guest-agent rng-tools rpcgen rpm-build rsync \
samba sysstat systemd watchdog wget xfsprogs-devel xxhash zlib-devel
samba socat sysstat systemd watchdog wget xfsprogs-devel xxhash \
zlib-devel
echo "##[endgroup]"
}

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/scripts/qemu-5-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ sudo virsh undefine openzfs

# definitions of per operating system
case "$OS" in
# FreeBSD can't be optimized via ksmtuned
freebsd*)
VMs=2
CPU=3
CPU=2
RAM=6
;;
*)
# Linux can be optimized via ksmtuned
VMs=2
CPU=3
RAM=7
CPU=2
RAM=8
;;
esac

Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/scripts/qemu-6-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@

set -eu

function prefix() {
ID="$1"
LINE="$2"
function get_time_diff() {
CURRENT=$(date +%s)
TSSTART=$(cat /tmp/tsstart)
DIFF=$((CURRENT-TSSTART))
H=$((DIFF/3600))
DIFF=$((DIFF-(H*3600)))
M=$((DIFF/60))
S=$((DIFF-(M*60)))
printf "%02d:%02d:%02d" "$H" "$M" "$S"
}

function prefix() {
ID="$1"
LINE="$2"

CTR=$(cat /tmp/ctr)
echo $LINE| grep -q "^Test[: ]" && CTR=$((CTR+1)) && echo $CTR > /tmp/ctr
Expand All @@ -27,12 +30,13 @@ function prefix() {
COLOR="$BASE/scripts/zfs-tests-color.sh"
CLINE=$(echo $LINE| grep "^Test[ :]" | sed -e 's|/usr/local|/usr|g' \
| sed -e 's| /usr/share/zfs/zfs-tests/tests/| |g' | $COLOR)

if [ -z "$CLINE" ]; then
printf "vm${ID}: %s\n" "$LINE"
else
# [vm2: 00:15:54 256] Test: functional/checksum/setup (run as root) [00:00] [PASS]
printf "[vm${ID}: %02d:%02d:%02d %4d] %s\n" \
"$H" "$M" "$S" "$CTR" "$CLINE"
t=$(get_time_diff)
printf "[vm${ID}: %s %4d] %s\n" "$t" "$CTR" "$CLINE"
fi
}

Expand All @@ -42,9 +46,9 @@ if [ -z ${1:-} ]; then
source env.txt
SSH=$(which ssh)
TESTS='$HOME/zfs/.github/workflows/scripts/qemu-6-tests.sh'
echo 0 > /tmp/ctr
date "+%s" > /tmp/tsstart
TSSTART=$(date +%s)

echo 0 > /tmp/ctr
for i in $(seq 1 $VMs); do
IP="192.168.122.1$i"
daemonize -c /var/tmp -p vm${i}.pid -o vm${i}log.txt -- \
Expand All @@ -54,7 +58,7 @@ if [ -z ${1:-} ]; then
| while read -r line; do prefix "$i" "$line"; done &
echo $! > vm${i}log.pid
# don't mix up the initial --- Configuration --- part
sleep 0.13
sleep 0.2
done

# wait for all vm's to finish
Expand Down Expand Up @@ -97,8 +101,20 @@ fi
sudo dmesg -c > dmesg-prerun.txt
mount > mount.txt
df -h > df-prerun.txt
# start tag-server on the first vm:
#if [ "$2" = "1" ]; then
# $TDIR/zfs-tests.sh -vK -s 3GB -T 192.168.122.11:2323/server
#fi

# wait for tag-server on first VM
sleep 1

# run all tags, provided by tag-server
#$TDIR/zfs-tests.sh -vK -s 3GB -T 192.168.122.11:2323/vm$2
$TDIR/zfs-tests.sh -vK -s 3GB -T $TAGS
RV=$?

# get some stats
df -h > df-postrun.txt
echo $RV > tests-exitcode.txt
sync
Expand Down
Loading

0 comments on commit 6666da5

Please sign in to comment.