ports/126040: update sysutils/linux-megacli
Bjoern A. Zeeb
bzeeb+freebsdports at zabbadoz.net
Mon Jul 28 15:10:01 UTC 2008
>Number: 126040
>Category: ports
>Synopsis: update sysutils/linux-megacli
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Mon Jul 28 15:10:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Bjoern A. Zeeb
>Release: FreeBSD 7.0-CURRENT amd64
>Organization:
Zabbadoz.NeT
>Environment:
System: FreeBSD foo 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Sun Oct 30 18:31:51 UTC 2005 bz at foo:/path/to/HEAD/sys/KERNEL amd64
>Description:
When trying to diagnose problems, vendors like Dell
ask for the "TTY Log" so save that upon reboot.
It should only be there after a "warm boot". After power cycling
old contents should be gone unless special knobs turned,
which you do not want unless you really need and they tell you to.
In case you like debugging in daily mails you can even get
daily diffs of the TTY log by turning on the switch in
periodic.conf. Most people will not want to.
You should make sure to have a well known good latest
version of mfi(4) and the latest firmware.
The rc.d script is enabled by default but you can turn it off
in rc.conf if it gives trouble.
I am not good on rc scripts so you may want to review;-)
I'll hopefully add more information on mfi debugging to the
wiki soon.
>How-To-Repeat:
>Fix:
You can also (temporary) fetch the patch from
http://people.freebsd.org/~bz/sysutils-linux-megacli-20080727-01.diff
Index: sysutils/linux-megacli/Makefile
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- sysutils/linux-megacli/Makefile 18 Jun 2008 13:02:45 -0000 1.7
+++ sysutils/linux-megacli/Makefile 28 Jul 2008 14:38:14 -0000
@@ -7,7 +7,7 @@
PORTNAME= megacli
PORTVERSION= 1.01.40
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils linux
MASTER_SITES= http://www.lsi.com/support/downloads/megaraid/miscellaneous/linux/
PKGNAMEPREFIX= linux-
@@ -23,6 +23,7 @@ ONLY_FOR_ARCHS= i386 amd64
USE_LINUX= yes
SUB_FILES= megacli.sh
SUB_FILES+= 407.status-mfi-raid
+SUB_FILES+= mfi_tty_log
# From bsd.linux.rpm.mk
RPM2CPIO?= ${LOCALBASE}/bin/rpm2cpio
@@ -39,6 +40,7 @@ do-install:
${INSTALL_SCRIPT} ${WRKSRC}/megacli.sh ${PREFIX}/sbin/megacli
${MKDIR} ${PREFIX}/etc/periodic/daily
${INSTALL_SCRIPT} ${WRKSRC}/407.status-mfi-raid ${PREFIX}/etc/periodic/daily
+ ${INSTALL_SCRIPT} ${WRKSRC}/mfi_tty_log ${PREFIX}/etc/rc.d
${INSTALL_PROGRAM} ${WRKSRC}/opt/MegaRAID/MegaCli/MegaCli ${PREFIX}/libexec
post-install:
Index: sysutils/linux-megacli/pkg-plist
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/pkg-plist,v
retrieving revision 1.2
diff -u -p -r1.2 pkg-plist
--- sysutils/linux-megacli/pkg-plist 9 Mar 2007 13:15:02 -0000 1.2
+++ sysutils/linux-megacli/pkg-plist 28 Jul 2008 14:38:14 -0000
@@ -1,6 +1,7 @@
sbin/megacli
libexec/MegaCli
etc/periodic/daily/407.status-mfi-raid
+etc/rc.d/mfi_tty_log
%%PORTDOCS%%%%DOCSDIR%%/readme.txt
%%PORTDOCS%%%%DOCSDIR%%/README-status-mfi-raid.txt
%%PORTDOCS%%@dirrm %%DOCSDIR%%
Index: sysutils/linux-megacli/files/407.status-mfi-raid.in
===================================================================
RCS file: /local/mirror/FreeBSD/r/pcvs/ports/sysutils/linux-megacli/files/407.status-mfi-raid.in,v
retrieving revision 1.4
diff -u -p -r1.4 407.status-mfi-raid.in
--- sysutils/linux-megacli/files/407.status-mfi-raid.in 18 Jun 2008 13:02:46 -0000 1.4
+++ sysutils/linux-megacli/files/407.status-mfi-raid.in 28 Jul 2008 14:38:14 -0000
@@ -16,6 +16,7 @@ fi
: ${daily_status_mfi_raid_enable:=NO}
: ${daily_status_mfi_raid_verbose:=NO}
: ${daily_status_mfi_raid_persist_logs:=YES}
+: ${daily_status_mfi_raid_tty_log:=NO}
megacli=${megacli:-%%PREFIX%%/sbin/megacli}
logdir=${logdir:-/var/log}
@@ -222,7 +223,31 @@ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX
if test $raid_rc -eq 0; then
echo " No new log messages."
fi
- [ $rc -eq 0 ] && [ $raid_rc -ne 0 ] && rc=3
+
+ # TTY Log
+ echo "TTY Log:"
+ tty_log=${logdir}/mfi_raid_${ctrl}_tty
+ tty_rc=0
+ case "$daily_status_mfi_raid_tty_log" in
+ [Yy][Ee][Ss])
+ if test ! -f ${tty_log}.today; then
+ touch ${tty_log}.today
+ fi
+ mv -f ${tty_log}.today ${tty_log}.yesterday
+ ${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}.today
+ cmp -s ${tty_log}.yesterday ${tty_log}.today
+ tty_rc=$?
+ if test $tty_rc -ne 0; then
+ diff -u ${tty_log}.yesterday ${tty_log}.today | \
+ grep -v '^-\|^$'
+ else
+ echo " No new TTY log messages."
+ fi
+ ;;
+ *)
+ ;;
+ esac
+ [ $rc -eq 0 ] && [ $raid_rc -ne 0 -o $tty_rc -ne 0 ] && rc=3
done
exit ${rc}
Index: sysutils/linux-megacli/files/mfi_tty_log.in
===================================================================
RCS file: sysutils/linux-megacli/files/mfi_tty_log.in
diff -N sysutils/linux-megacli/files/mfi_tty_log.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysutils/linux-megacli/files/mfi_tty_log.in 28 Jul 2008 14:38:14 -0000
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/abi,v 1.4.2.4 2007/03/10 14:04:01 yar Exp $
+#
+
+# PROVIDE: mfi_tty_log
+# REQUIRE: abi
+# KEYWORD: nojail
+
+: ${rc_mfi_raid_tty_log:=YES}
+
+. /etc/rc.subr
+
+name="mfi_tty_log"
+start_cmd="${name}_start"
+stop_cmd=":"
+
+mfi_tty_log_start()
+{
+ megacli=${megacli:-%%PREFIX%%/sbin/megacli}
+ logdir=${logdir:-/var/log}
+
+ case "$rc_mfi_raid_tty_log" in
+ [Yy][Ee][Ss])
+ echo
+ echo 'Checking for TTY logs of MFI(4) RAID controllers:'
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+
+ if test `id -u` -ne 0; then
+ echo "You must be root to run `basename $0`." >&2
+ return 1
+ fi
+
+ ADPCOUNT=$(${megacli} -adpCount | \
+ awk '/Controller Count:/ { gsub("\\.", ""); print $3 }')
+
+ case ${ADPCOUNT} in
+ 0) echo "Error: Cannot find an adapter." >&2
+ return 1
+ ;;
+ [1-9]|[1-9][0-9]|[1-2][0-9][0-9])
+ ;;
+ *)
+ echo "Error: Cannot get the number of adapters: ${ADPCOUNT}" >&2
+ return 1
+ ;;
+ esac
+
+ ADPMINIDX=0
+ ADPMAXIDX=`expr ${ADPCOUNT} - 1`
+
+ for ctrl in `jot ${ADPCOUNT} ${ADPMINIDX} ${ADPMAXIDX}`; do
+ tty_log=${logdir}/mfi_raid_${ctrl}_tty.boot
+ echo " Adapter: ${ctrl} - TTY log saved to ${tty_log}"
+ ${megacli} -FwTermLog Dsply -a${ctrl} > ${tty_log}
+ done
+}
+
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list