Bug 126040 - update sysutils/linux-megacli
Summary: update sysutils/linux-megacli
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Stefan Walter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-28 16:10 UTC by Bjoern A. Zeeb
Modified: 2008-10-13 18:30 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (4.83 KB, patch)
2008-07-28 16:10 UTC, Bjoern A. Zeeb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb 2008-07-28 16:10:00 UTC
	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.

Fix: You can also (temporary) fetch the patch from
http://people.freebsd.org/~bz/sysutils-linux-megacli-20080727-01.diff
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-07-28 16:10:09 UTC
Maintainer of sysutils/linux-megacli,

Please note that PR ports/126040 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/126040

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2008-07-28 16:10:10 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 ruben 2008-08-02 11:36:31 UTC
It is ok, but I yet need to merge in some stuff as mentioned in

http://www.mail-archive.com/freebsd-stable@freebsd.org/msg96860.html

Expect this sometime next week.

Thanks,
	Ruben
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2008-08-02 17:53:17 UTC
State Changed
From-To: feedback->suspended

Maintainer is working on a patch that will incorporate this one.
Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2008-09-05 16:28:17 UTC
Ruben, what's the status on this? Has been a month.

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

In the computer industry, there are three kinds of lies:
lies, damn lies, and benchmarks.
Comment 6 ruben 2008-09-06 09:15:02 UTC
Hi Pav,

On 5 Sep 2008, at 17:28, Pav Lucistnik wrote:

> Ruben, what's the status on this? Has been a month.

Well, holiday period, other things that kept me preoccupied and the  
strange thing that my patch didn't apply cleanly on a freshly  
portsnapped tree on a RELENG_6 machine.

I'll get that patch up to shape on this Sunday, apologies for the  
delay...

Regards,
	Ruben

>
>
> -- 
> Pav Lucistnik <pav@oook.cz>
>              <pav@FreeBSD.org>
>
> In the computer industry, there are three kinds of lies:
> lies, damn lies, and benchmarks.
Comment 7 ruben 2008-09-07 22:02:14 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- - Submitters changes except default enabling of rc.d script (As I feel FreeBSD
  is not about that, especially with regards to ports)

- - Don't complain about higher compat.linux.osrelease versions
  (Mentioned in
http://www.mail-archive.com/freebsd-stable@freebsd.org/msg96860.html)

cd /usr/ports && patch -p0 /path/to/patch

diff -urN sysutils/linux-megacli.orig/Makefile sysutils/linux-megacli/Makefile
- --- sysutils/linux-megacli.orig/Makefile	2008-09-07 22:33:51.000000000 +0200
+++ sysutils/linux-megacli/Makefile	2008-09-07 22:36:13.000000000 +0200
@@ -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 @@
 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 @@
 	${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:
diff -urN sysutils/linux-megacli.orig/files/407.status-mfi-raid.in sysutils/linux-megacli/files/407.status-mfi-raid.in
- --- sysutils/linux-megacli.orig/files/407.status-mfi-raid.in	2008-09-07 22:33:51.000000000 +0200
+++ sysutils/linux-megacli/files/407.status-mfi-raid.in	2008-09-07 22:36:13.000000000 +0200
@@ -16,6 +16,7 @@
 : ${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}
@@ -67,7 +68,8 @@
 			E=-1; S=-1; D=-1; s=-1; mec=-1; oec=-1; pfc=-1; lpfeqn=-1;
 			state="";
 		}
- -		/^Enclosure (Number|Device ID):/ { E=$3; }
+		/^Enclosure (Number:/ { E=$3; }
+		/^Enclosure Device ID:/ { E=$4; }
 		/^Slot Number:/ { S=$3; }
 		/^Device Id:/ { D=$3; }
 		/^Sequence Number:/ { s=$3; }
@@ -222,7 +224,31 @@
 	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}
diff -urN sysutils/linux-megacli.orig/files/megacli.sh.in sysutils/linux-megacli/files/megacli.sh.in
- --- sysutils/linux-megacli.orig/files/megacli.sh.in	2008-09-07 22:33:51.000000000 +0200
+++ sysutils/linux-megacli/files/megacli.sh.in	2008-09-07 22:36:13.000000000 +0200
@@ -8,11 +8,32 @@
 	exit 1
 fi
 
- -if ! [ `sysctl -n compat.linux.osrelease` = "2.6.12" ]; then
- -	echo "You need to set compat.linux.osrelease to 2.6.12 to run `basename $0`." >&2
- -	exit 1
+osrelease=`sysctl -n compat.linux.osrelease`
+
+case $osrelease in
+	2.6.*)
+		if [ `echo $osrelease | cut -d . -f 3` -lt 12 ]; then
+		osrelease=TOOLOW
+		fi
+	;;
+	2.*)
+		if [ `echo $osrelease | cut -d . -f 2` -lt 6 ]; then
+		osrelease=TOOLOW
+		fi
+	;;
+	*)
+		if [ `echo $osrelease | cut -d . -f 1` -lt 2 ]; then
+		osrelease=TOOLOW
+		fi
+	;;
+esac
+
+if [ $osrelease = "TOOLOW" ]; then
+        echo "You need to set compat.linux.osrelease to atleast 2.6.12 to run `basename $0`." >&2
+        exit 1
 fi
 
+
 lpfs=`mount -t linprocfs | awk 'END{ print NR }'`
 if [ ${lpfs} -le 0 ]; then
 	echo "You need to mount linprocfs to run `basename $0`." >&2
diff -urN sysutils/linux-megacli.orig/files/mfi_tty_log.in sysutils/linux-megacli/files/mfi_tty_log.in
- --- sysutils/linux-megacli.orig/files/mfi_tty_log.in	1970-01-01 01:00:00.000000000 +0100
+++ sysutils/linux-megacli/files/mfi_tty_log.in	2008-09-07 22:36:13.000000000 +0200
@@ -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:=NO}
+
+. /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"
diff -urN sysutils/linux-megacli.orig/pkg-message sysutils/linux-megacli/pkg-message
- --- sysutils/linux-megacli.orig/pkg-message	2008-09-07 22:33:51.000000000 +0200
+++ sysutils/linux-megacli/pkg-message	2008-09-07 22:52:55.000000000 +0200
@@ -30,7 +30,15 @@
 	# For daily summary mails and log diffs:
 	daily_status_mfi_raid_enable="YES"
 	# In case you want really lots of details enable this:
- -	daily_status_mfi_raid_verbose="NO"
+	daily_status_mfi_raid_verbose="YES"
+	# In case you want the tty logs from the controller
+	daily_status_mfi_raid_tty_log="YES"
+
+Add the following to /etc/rc.conf
+
+# Save tty log on reboot (you want this)
+rc_mfi_raid_tty_log="YES"
+
 
 If you find mfi(4) too verbose, see mfi_evt_class_t in
 /usr/src/sys/dev/mfi/mfireg.h for values you can use in the
diff -urN sysutils/linux-megacli.orig/pkg-plist sysutils/linux-megacli/pkg-plist
- --- sysutils/linux-megacli.orig/pkg-plist	2008-09-07 22:33:51.000000000 +0200
+++ sysutils/linux-megacli/pkg-plist	2008-09-07 22:36:13.000000000 +0200
@@ -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%%

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFIxEFHZ88+mcQxRw0RAgzMAKCEAU0f4TqHi6W02gZmuRnXqBaZAgCfZDqJ
R3SgTUpIuXlzJEBPmLp+j6s=
=fJPp
-----END PGP SIGNATURE-----
Comment 8 Pav Lucistnik freebsd_committer freebsd_triage 2008-09-07 22:29:03 UTC
State Changed
From-To: suspended->open

Patch on it's way
Comment 9 Stefan Walter freebsd_committer freebsd_triage 2008-10-13 18:16:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Take.
Comment 10 dfilter service freebsd_committer freebsd_triage 2008-10-13 18:22:29 UTC
stefan      2008-10-13 17:22:20 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/linux-megacli Makefile pkg-message pkg-plist 
    sysutils/linux-megacli/files 407.status-mfi-raid.in 
                                 megacli.sh.in 
  Added files:
    sysutils/linux-megacli/files mfi_tty_log.in 
  Log:
  - Add rc.d script for taking TTY logs. [1]
  - Don't complain about higher compat.linux.osrelease versions. [2]
  
  PR:             126040
  Submitted by:   bz [1], maintainer [2]
  Approved by:    maintainer [1]
  
  Revision  Changes    Path
  1.8       +3 -1      ports/sysutils/linux-megacli/Makefile
  1.5       +29 -3     ports/sysutils/linux-megacli/files/407.status-mfi-raid.in
  1.4       +24 -3     ports/sysutils/linux-megacli/files/megacli.sh.in
  1.1       +63 -0     ports/sysutils/linux-megacli/files/mfi_tty_log.in (new)
  1.3       +9 -1      ports/sysutils/linux-megacli/pkg-message
  1.3       +1 -0      ports/sysutils/linux-megacli/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 11 Stefan Walter freebsd_committer freebsd_triage 2008-10-13 18:22:42 UTC
State Changed
From-To: open->closed

Committed, thanks!