xref: /freebsd-src/sys/contrib/openzfs/tests/zfs-tests/callbacks/zfs_mmp.ksh (revision 2a58b312b62f908ec92311d1bd8536dbaeb8e55b)
1eda14cbcSMatt Macy#!/bin/ksh -p
2eda14cbcSMatt Macy
3eda14cbcSMatt Macy#
4eda14cbcSMatt Macy# This file and its contents are supplied under the terms of the
5eda14cbcSMatt Macy# Common Development and Distribution License ("CDDL"), version 1.0.
6eda14cbcSMatt Macy# You may only use this file in accordance with the terms of version
7eda14cbcSMatt Macy# 1.0 of the CDDL.
8eda14cbcSMatt Macy#
9eda14cbcSMatt Macy# A full copy of the text of the CDDL should have accompanied this
10eda14cbcSMatt Macy# source.  A copy of the CDDL is also available via the Internet at
11eda14cbcSMatt Macy# http://www.illumos.org/license/CDDL.
12eda14cbcSMatt Macy#
13eda14cbcSMatt Macy
14eda14cbcSMatt Macy#
15eda14cbcSMatt Macy# Copyright (c) 2017 by Lawrence Livermore National Security.
16eda14cbcSMatt Macy# All rights reserved.
17eda14cbcSMatt Macy#
18eda14cbcSMatt Macy
19eda14cbcSMatt Macy# $1: number of lines to output (default: 40)
20eda14cbcSMatt Macytypeset lines=${1:-40}
21eda14cbcSMatt Macytypeset history=$(</sys/module/zfs/parameters/zfs_multihost_history)
22eda14cbcSMatt Macy
23eda14cbcSMatt Macyif [ $history -eq 0 ]; then
24eda14cbcSMatt Macy	exit
25eda14cbcSMatt Macyfi
26eda14cbcSMatt Macy
27eda14cbcSMatt Macyfor f in /proc/spl/kstat/zfs/*/multihost; do
28eda14cbcSMatt Macy	echo "================================================================="
29eda14cbcSMatt Macy	echo " Last $lines lines of $f"
30eda14cbcSMatt Macy	echo "================================================================="
31eda14cbcSMatt Macy
32eda14cbcSMatt Macy	sudo tail -n $lines $f
33*2a58b312SMartin Matuska	sudo bash -c "echo > $f"
34eda14cbcSMatt Macydone
35eda14cbcSMatt Macy
36eda14cbcSMatt Macyecho "================================================================="
37eda14cbcSMatt Macyecho " End of zfs multihost log"
38eda14cbcSMatt Macyecho "================================================================="
39