Import megactl

This commit is contained in:
Adam Cécile (Le_Vert) 2013-08-14 23:04:31 +02:00
parent 3b886908f1
commit 1f5b6589f8
22 changed files with 616 additions and 0 deletions

View File

@ -0,0 +1,46 @@
megactl (0.4.1+svn20090725.r6-1) unstable; urgency=low
* New upstream release (based on sv trunk snapshot):
- Add RAID6 support,
- Fixes for Dell PERC6 cards.
* Bump Standards-Version to 3.8.2.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Sat, 25 Jul 2009 13:23:45 +0200
megactl (0.4.1-6) unstable; urgency=low
* Merge a Gentoo (thanks) patch that drops obsolete asm/user.h.
* Add missing amd64 required gcc-multilib b-dep.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Mon, 27 Apr 2009 16:35:59 +0200
megactl (0.4.1-5) unstable; urgency=low
* Update create-devices-nodes to handle kernels 2.6.25rc2+.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Mon, 01 Sep 2008 12:03:07 +0200
megactl (0.4.1-4) unstable; urgency=low
* Add preinst script to clean obsolete initscripts used by previous
releases.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Fri, 22 Aug 2008 14:02:08 +0200
megactl (0.4.1-3) unstable; urgency=low
* Fix packaging to allow build and run on amd64.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Thu, 21 Aug 2008 18:03:39 +0200
megactl (0.4.1-2) unstable; urgency=low
* Device node creation: remove initscript, replaced by binaries wrappers.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Thu, 21 Aug 2008 13:57:02 +0200
megactl (0.4.1-1) unstable; urgency=low
* Initial release.
-- Adam Cécile (Le_Vert) <gandalf@le-vert.net> Wed, 26 Sep 2007 09:49:57 +0200

View File

@ -0,0 +1 @@
4

View File

@ -0,0 +1,17 @@
Source: megactl
Section: admin
Priority: optional
Maintainer: Adam Cécile (Le_Vert) <gandalf@le-vert.net>
Build-Depends: debhelper (>= 4), dpatch, libc6-dev-i386 [amd64], gcc-multilib [amd64] | libc6-dev-i386 (<< 2.7) [amd64]
Standards-Version: 3.8.2
Homepage: http://sourceforge.net/projects/megactl
Package: megactl
Architecture: i386 amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, libc6-i386 [amd64]
Description: LSI MegaRAID SCSI/SAS reporting tool
This package contains both megactl and megasasctl tools that can be used
to query LSI's MegaRAID adapters status.
.
It reports status and informations about the adapter itself, it's
logical disks and the physical disks attached.

View File

@ -0,0 +1,45 @@
This package was debianized by Adam Cécile (Le_Vert) <gandalf@le-vert.net> on
Wed, 26 Sep 2007 09:49:57 +0200.
It was downloaded from http://sourceforge.net/projects/megactl
Upstream Author:
Jefferson Ogata <ogata@antibozo.net>
Copyright:
Copyright (C) 2007 Jefferson Ogata
License:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
The Debian packaging is Copyright (C) 2007-2009 Adam Cécile (Le_Vert)
<gandalf@le-vert.net> and is licensed under the GPL, see above.
Other files' copyright or license:
"src/schily/*" are (C) 1984-2003 J. Schilling except
"src/schily/scg/srb_os2.h" which is (C) 1998 D. Dorau, C. Wohlgemuth.
"src/kernel-2.6.9-55.0.2.EL/*" and "src/megaraid/*" are
(C) 2003-2004 LSI Logic Corporation.
All theses files are released under terms of GNU General Public License
version 2 or later.

View File

@ -0,0 +1,2 @@
usr/lib/megactl
usr/sbin

View File

@ -0,0 +1 @@
README

View File

@ -0,0 +1,2 @@
src/megarpt
src/megasasrpt

View File

@ -0,0 +1,7 @@
src/megactl usr/lib/megactl
src/megasasctl usr/lib/megactl
src/megatrace usr/lib/megactl
debian/wrappers/create-devices-nodes usr/lib/megactl
debian/wrappers/megactl usr/sbin
debian/wrappers/megasasctl usr/sbin
debian/wrappers/megatrace usr/sbin

View File

@ -0,0 +1,102 @@
.TH MEGACTL "8" "September 2007" "0.4.1" "User Commands"
.SH NAME
megactl - a reporting tool for LSI MegaRAID adapters and its attached disks.
.SH DESCRIPTION
.B megactl
can report diagnostics on megaraid adapters and attached disks.
.br
It permits dumping of controller log pages for inspection of error, temperature, and self-test conditions, initiates self-test diagnostics, and documents adapter and logical drive configuration.
.br
Target devices may be adapters, (e.g. a0), channels (e.g. a0c0), or individual disks (e.g. a0c0t0).
.br
If no target is specified, reports configuration and drive state on all
adapters.
.br
If a target matches a collection of disks, operations are
applied to all matching devices.
.SH REQUIREMENTS
.B megactl
requires the device file /dev/megadev0 to be present on
the system.
.br
On Debian systems, this device node will be created at boot time by megactl-makedev init script.
.br
If your system does not have this device file, you may create it either by executing Dell's "dellmgr" program once, or by locating the megadev entry in /proc/devices and creating /dev/megadev0 as a character device with suitable permissions with a matching major device number and a minor number of 0.
.SH SYNOPSIS
.B megactl
[\-vest] [\-H] [\-l log-page-nr] [\-T long|short] [target ...]
.SH OPTIONS
.TP
.I -v
Increase program verbosity.
.TP
.I -e
Dump read (0x03), write (0x02), and verify (0x05) error log pages.
.TP
.I -s
Dump self-test (0x10) log page.
.TP
.I -t
Dump temperature (0x0d) log page.
.TP
.I -l <page>
Dump the specified log page.
.br
Log page 0 documents the log pages the device supports.
.TP
.I -p
Do not report physical disks.
.br
Reports only adapters and logical drives.
.br
Useful for concisely documenting adapter configuration.
.TP
.I -T short|long
Initiate the background short or long self-test procedure.
.br
The test may take up to an hour to complete, but does not inhibit access to the device.
.br
The test may be monitored using the \-s option.
.br
The background long self test is a useful tool for diagnosing problems with individual disks.
.br
But be cautious with program usage. "megactl \-T long" with no targets will initiate a background long self test on every drive on every adapter.
.br
This may not be what you want.
.TP
.I -H
Perform an adapter health check.
.br
Inspects state of all logical and physical drives and battery backup unit and reports problem conditions.
.br
If all is well, generates no output. Useful in a cron job.
.br
By default, the health check option inspects log pages 0x02, 0x03, and 0x05 for uncorrected read, write, and verify errors, 0x0d for excess temperature conditions, and 0x10 for failed self tests.
.br
If, however, any of the log page options is specified, only the designated log pages are inspected.
.TP
.I -B
When performing health check, do not treat battery problems as failures.
.TP
.I -V
Show version.
.SH "SEE ALSO"
Homepage: http://sourceforge.net/projects/megactl
.br
Some examples scripts (Debian systems): /usr/share/doc/megactl/examples/
.br
megasasctl(8): Same tool, for SAS adapters.
.SH AUTHOR
This manual page was written by Adam Cécile (Le_Vert) <gandalf@le-vert.net> for the Debian system (but may be used by others).
.br
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation
.br
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

View File

@ -0,0 +1,102 @@
.TH MEGASASCTL "8" "September 2007" "0.4.1" "User Commands"
.SH NAME
megasasctl - a reporting tool for LSI MegaRAID SAS (Serial-Attached-SCSI) adapters and its attached disks.
.SH DESCRIPTION
.B megasasctl
can report diagnostics on megaraid adapters and attached disks.
.br
It permits dumping of controller log pages for inspection of error, temperature, and self-test conditions, initiates self-test diagnostics, and documents adapter and logical drive configuration.
.br
Target devices may be adapters, (e.g. a0), channels (e.g. a0c0), or individual disks (e.g. a0c0t0).
.br
If no target is specified, reports configuration and drive state on all
adapters.
.br
If a target matches a collection of disks, operations are
applied to all matching devices.
.SH REQUIREMENTS
.B megasasctl
requires the device file /dev/megaraid_sas_ioctl_node to be present on the system.
the system.
.br
On Debian systems, this device node will be created at boot time by megactl-makedev init script.
.br
If your system does not have this device file, you may create it either by executing LSI's "MegaCli" program once, or by locating the megadev_sas_ioctl entry in /proc/devices and creating /dev/megaraid_sas_ioctl_node as a character device with suitable permissions with a matching major device number and a minor number of 0.
.SH SYNOPSIS
.B megasasctl
[\-vest] [\-H] [\-l log-page-nr] [\-T long|short] [target ...]
.SH OPTIONS
.TP
.I -v
Increase program verbosity.
.TP
.I -e
Dump read (0x03), write (0x02), and verify (0x05) error log pages.
.TP
.I -s
Dump self-test (0x10) log page.
.TP
.I -t
Dump temperature (0x0d) log page.
.TP
.I -l <page>
Dump the specified log page.
.br
Log page 0 documents the log pages the device supports.
.TP
.I -p
Do not report physical disks.
.br
Reports only adapters and logical drives.
.br
Useful for concisely documenting adapter configuration.
.TP
.I -T short|long
Initiate the background short or long self-test procedure.
.br
The test may take up to an hour to complete, but does not inhibit access to the device.
.br
The test may be monitored using the \-s option.
.br
The background long self test is a useful tool for diagnosing problems with individual disks.
.br
But be cautious with program usage. "megactl \-T long" with no targets will initiate a background long self test on every drive on every adapter.
.br
This may not be what you want.
.TP
.I -H
Perform an adapter health check.
.br
Inspects state of all logical and physical drives and battery backup unit and reports problem conditions.
.br
If all is well, generates no output. Useful in a cron job.
.br
By default, the health check option inspects log pages 0x02, 0x03, and 0x05 for uncorrected read, write, and verify errors, 0x0d for excess temperature conditions, and 0x10 for failed self tests.
.br
If, however, any of the log page options is specified, only the designated log pages are inspected.
.TP
.I -B
When performing health check, do not treat battery problems as failures.
.TP
.I -V
Show version.
.SH "SEE ALSO"
Homepage: http://sourceforge.net/projects/megactl
.br
Some examples scripts (Debian systems): /usr/share/doc/megactl/examples/
.br
megactl(8): Same tool, for SCSI adapters.
.SH AUTHOR
This manual page was written by Adam Cécile (Le_Vert) <gandalf@le-vert.net> for the Debian system (but may be used by others).
.br
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation
.br
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

View File

@ -0,0 +1,39 @@
.TH MEGATRACE "8" "September 2007" "0.4.1" "User Commands"
.SH NAME
megatrace - a debugging program which can be used to trace LSI MegaRAID-related ioctl() system calls.
.SH DESCRIPTION
.B megatrace
is debugging program which can be used to trace LSI MegaRAID-related ioctl() system calls.
.br
You won't need that unless you're trying to add features to megactl, or are exceptionally curious.
.br
This program uses ptrace(2) and can inspect and modify data structures to help you suss out what's going on in dellmgr and MegaCli.
.PP
If you're not developer, please check megactl(8) or megactlsas(8).
.SH SYNOPSIS
.B megatrace
<command_to_trace>
.PP
You may really consider tracing a command that access MegaRAID card, like Dell's dellmgr or LSI's megacli.
.SH OPTIONS
.B megatrace
has no options.
.SH "SEE ALSO"
Homepage: http://sourceforge.net/projects/megactl
.br
Some examples scripts (Debian systems): /usr/share/doc/megactl/examples/
.br
megactl(8): Reporting tool for SCSI adapters.
megasasctl(8): Reporting tool for SAS adapters.
.SH AUTHOR
This manual page was written by Adam Cécile (Le_Vert) <gandalf@le-vert.net> for the Debian system (but may be used by others).
.br
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation
.br
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

View File

@ -0,0 +1 @@
debian/man/*

View File

@ -0,0 +1,74 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 000-No_absolute_pathes_in_examples.dpatch
## by Adam Cécile (Le_Vert) <gandalf@le-vert.net>
##
## DP: Drop all absolute pathes to binaries in megarpt and megasasrpt
## DP: example scripts.
@DPATCH@
diff -u megactl-0.4.1/src/megarpt megactl-0.4.1/src.new/megarpt
--- megactl-0.4.1/src/megarpt 2007-08-21 09:19:53.000000000 +0200
+++ megactl-0.4.1/src.new/megarpt 2007-09-26 11:07:05.584181968 +0200
@@ -9,7 +9,7 @@
# Date: 2007/08/20
VERSION='0.3'
-MEGACTL=/root/megactl
+MEGACTL=/usr/sbin/megactl
DEVICE=/dev/megadev0
DEVICENAME=megadev
DEVICEPERM=644
@@ -32,8 +32,8 @@
if [ -e "$DEVICE" ]; then
WARN=
- HOST=`/bin/uname -n`
- DATE=`/bin/date '+%Y/%m/%d %H:%M:%S %Z'`
+ HOST=`uname -n`
+ DATE=`date '+%Y/%m/%d %H:%M:%S %Z'`
HC=/tmp/megactl.$$
$MEGACTL -vH > $HC 2>/dev/null
@@ -59,7 +59,7 @@
echo "$ME version: $VERSION"
echo "megactl version: $MEGACTLVERSION"
) 2>/dev/null |
- /bin/mail -s "RAID report:$WARN $HOST $DATE" root
+ mail -s "RAID report:$WARN $HOST $DATE" root
rm -f $HC
fi
diff -u megactl-0.4.1/src/megasasrpt megactl-0.4.1/src.new/megasasrpt
--- megactl-0.4.1/src/megasasrpt 2007-08-21 09:19:53.000000000 +0200
+++ megactl-0.4.1/src.new/megasasrpt 2007-09-26 11:07:05.584181968 +0200
@@ -9,7 +9,7 @@
# Date: 2007/08/20
VERSION='0.3'
-MEGACTL=/root/megasasctl
+MEGACTL=/usr/sbin/megasasctl
DEVICE=/dev/megaraid_sas_ioctl_node
DEVICENAME=megaraid_sas_ioctl
DEVICEPERM=400
@@ -32,8 +32,8 @@
if [ -e "$DEVICE" ]; then
WARN=
- HOST=`/bin/uname -n`
- DATE=`/bin/date '+%Y/%m/%d %H:%M:%S %Z'`
+ HOST=`uname -n`
+ DATE=`date '+%Y/%m/%d %H:%M:%S %Z'`
HC=/tmp/megactl.$$
$MEGACTL -vH > $HC 2>/dev/null
@@ -59,7 +59,7 @@
echo "$ME version: $VERSION"
echo "megactl version: $MEGACTLVERSION"
) 2>/dev/null |
- /bin/mail -s "RAID report:$WARN $HOST $DATE" root
+ mail -s "RAID report:$WARN $HOST $DATE" root
rm -f $HC
fi

View File

@ -0,0 +1,29 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 001-Drop_obsolete_asm_user.h.dpatch
## by wschlich (Gentoo)
##
## DP: Stolen on Gentoo VCS, thanks a lot Gentoo guys :)
## DP: http://sources.gentoo.org:80/viewcvs.py/gentoo-x86/sys-block/megactl/files/
@DPATCH@
diff -urN megactl-0.4.1.orig/src/megatrace.c megactl-0.4.1/src/megatrace.c
--- megactl-0.4.1.orig/src/megatrace.c 2007-08-21 09:19:53.000000000 +0200
+++ megactl-0.4.1/src/megatrace.c 2008-02-10 21:27:24.416919438 +0100
@@ -49,7 +49,7 @@
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
-#include <asm/user.h>
+#include <sys/user.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -250,7 +250,7 @@
len = sizeof buf;
if (printregs)
- fprintf (stderr, " ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx eax=%08lx ds=%04x __ds=%04x es=%04x __es=%04x fs=%04x __fs=%04x gs=%04x __gs=%04x orig_eax=%08lx eip=%08lx cs=%04x __cs=%04x eflags=%08lx esp=%08lx ss=%04x __ss=%04x\n", r.ebx, r.ecx, r.edx, r.esi, r.edi, r.ebp, r.eax, r.ds, r.__ds, r.es, r.__es, r.fs, r.__fs, r.gs, r.__gs, r.orig_eax, r.eip, r.cs, r.__cs, r.eflags, r.esp, r.ss, r.__ss);
+ fprintf (stderr, " ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx eax=%08lx xds=%08lx xes=%08lx xfs=%08lx xgs=%08lx orig_eax=%08lx eip=%08lx xcs=%08lx eflags=%08lx esp=%08lx xss=%08lx\n", r.ebx, r.ecx, r.edx, r.esi, r.edi, r.ebp, r.eax, r.xds, r.xes, r.xfs, r.xgs, r.orig_eax, r.eip, r.xcs, r.eflags, r.esp, r.xss);
copyout (buf, len, pid, r.edx);

View File

@ -0,0 +1,2 @@
000-No_absolute_pathes_in_examples.dpatch
001-Drop_obsolete_asm_user.h.dpatch

View File

@ -0,0 +1,13 @@
#!/bin/sh -e
# Skip if there's no previous version
if [ ! -z $2 ]; then
if dpkg --compare-versions $2 lt 0.4.1-4; then
update-rc.d -f megactl-makedev remove || true
rm -f /etc/init.d/megactl-makedev
fi
fi
#DEBHELPER#
exit 0

58
packaging/debian/megactl/rules Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
include /usr/share/dpatch/dpatch.make
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-stamp
build-stamp: patch-stamp
dh_testdir
$(MAKE) CFLAGS="$(CFLAGS) \$$(INC) \$$(ARCH)" -C src/
touch $@
clean: unpatch
dh_testdir
dh_testroot
rm -f build-stamp
$(MAKE) clean -C src/
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_install
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
ifeq ($(ARCH),i386)
dh_shlibdeps
endif
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

View File

@ -0,0 +1,2 @@
version=3
http://sf.net/megactl/megactl-([0-9\.]+)\.tar\.gz

View File

@ -0,0 +1,32 @@
# Author: Adam Cécile (Le_Vert) <gandalf@le-vert.net>
# License: Public domain
create_node() {
# Since 2.6.25rc2 linux kernel, megadev0 is created dynamically by udev
# See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90a95af85f22c82f87e5fb714bac7ee06673b0ff
if [ ! -e /dev/megadev0 ]; then
# Not available, try to create it by hand for kernel pre 2.6.25rc2
grep -q 'megadev$' /proc/devices && MEGARAID="ok"
if [ ! -z ${MEGARAID} ]; then
MAJOR=`grep 'megadev$' /proc/devices | head -n 1 | awk '{ print $1 }'`
mknod /dev/megadev0 c $MAJOR 0
return $?
fi
fi
if [ -e /dev/megadev0 ]; then
return 0
else
return 1
fi
}
create_node_sas() {
grep -q 'megaraid_sas_ioctl$' /proc/devices && MEGARAIDSAS="ok"
if [ ! -z ${MEGARAIDSAS} ]; then
MAJOR=`grep 'megaraid_sas_ioctl$' /proc/devices | head -n 1 | awk '{ print $1 }'`
test -e /dev/megaraid_sas_ioctl_node || mknod /dev/megaraid_sas_ioctl_node c $MAJOR 0
return 0
else
return 1
fi
}

View File

@ -0,0 +1,15 @@
#!/bin/sh
# Author: Adam Cécile (Le_Vert) <gandalf@le-vert.net>
# License: Public domain
. /usr/lib/megactl/create-devices-nodes
create_node
if [ $? -eq 0 ]; then
/usr/lib/megactl/megactl $@
else
echo "No LSI MegaRAID cards found. You may try megasasctl instead."
exit 1
fi

View File

@ -0,0 +1,15 @@
#!/bin/sh
# Author: Adam Cécile (Le_Vert) <gandalf@le-vert.net>
# License: Public domain
. /usr/lib/megactl/create-devices-nodes
create_node_sas
if [ $? -eq 0 ]; then
/usr/lib/megactl/megasasctl $@
else
echo "No LSI MegaRAID SAS cards found. You may try megactl instead."
exit 1
fi

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Author: Adam Cécile (Le_Vert) <gandalf@le-vert.net>
# License: Public domain
. /usr/lib/megactl/create-devices-nodes
create_node
create_node_sas
/usr/lib/megactl/megatrace $@