Re: [PATCH 1.4.11 1/2] OpenIPMI initscript and config file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 27, 2005 at 03:57:41PM -0500, Matt Domsch wrote:
> On Fri, May 20, 2005 at 04:54:57AM -0500, Matt Domsch wrote:
> > On Fri, May 20, 2005 at 12:19:24AM -0400, Bill Nottingham wrote:
> > > Matt Domsch (Matt_Domsch@xxxxxxxx) said: 
> > > > +	if [ "${DEV_IPMI}" = "1" ]; then
> > > > +	    modprobe ipmi_devintf || RETVAL=2
> > > > +	    if [ "${RETVAL}" != "2" ]; then
> > > > +                # Note, this really should be done by udev on 2.6
> > > > +		DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'`
> > > > +		mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=2
> > > > +		ln -sf /dev/ipmi${INTF_NUM} /dev/ipmi || RETVAL=2
> > > > +	    fi
> > > > +	fi
> > > 
> > > Why isn't the driver fixed to populate sysfs properly? 
> > 
> > Just-in-time programming.  Corey submitted class_simple support this
> > evening.
> > http://marc.theaimsgroup.com/?l=linux-kernel&m=111654581209165&;
> 
> With class_simple support, the initscripts now look as follows.
> 
> Confirmed this works on a RHEL4-U1 beta kernel build, sysfs makes
> /dev/ipmi0 for us.  Per Corey, there's no real tool that uses the
> /dev/ipmi symlink, they should be using /dev/ipmi0.  So I removed the
> creation of that symlink in the patch below.
> 
> The initscripts are necessary until there's a mechanism that can
> autodetect the presence of IPMI-capable hardware and load the modules
> automatically.  That's a future task, and not one I want to hold this
> up for.  This will work for now.

Oh, the ipmi_poweroff module option for powercycle changed names in
Corey's last set of patches.  As nothing was using the old name really
yet, here's the initscripts using the new poweroff_control option
name.

Thanks,
Matt


-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

--- /dev/null	Thu Apr 11 09:25:15 2002
+++ OpenIPMI-1.4.11/ipmi.init	Fri May 27 16:59:23 2005
@@ -0,0 +1,192 @@
+#!/bin/sh
+#############################################################################
+#
+# ipmi:		OpenIPMI Driver init script
+#
+# Authors:	Matt Domsch <Matt_Domsch@xxxxxxxx>
+#               Chris Poblete <Chris_Poblete@xxxxxxxx>
+#
+# chkconfig: 2345 04 96
+# description: OpenIPMI Driver init script
+#
+### BEGIN INIT INFO
+# Provides: ipmidrv
+# Required-Start: $localfs $remotefs $syslog
+# Required-Stop: $localfs $remotefs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: OpenIPMI Driver init script
+# Description: OpenIPMI Driver init script
+### END INIT INFO
+#
+#############################################################################
+# for log_success_msg and friends
+[ -r /lib/lsb/init-functions ] && . /lib/lsb/init-functions
+# source config info
+[ -r /etc/sysconfig/ipmi ] && . /etc/sysconfig/ipmi
+
+#############################################################################
+# GLOBALS
+#############################################################################
+MODULE_NAME="ipmi"
+INTF_NUM=0
+
+IPMI_SMB_MODULE_NAME="ipmi_smb"
+IPMI_SI_MODULE_NAME="ipmi_si"
+kernel=`uname -r | cut -d. -f1-2`
+if [ "${kernel}" == "2.4" ]; then
+    IPMI_SMB_MODULE_NAME="ipmi_smb_intf"
+    IPMI_SI_MODULE_NAME="ipmi_si_drv"
+fi
+
+MODULES="ipmi_radisys ipmi_imb ipmi_poweroff ipmi_watchdog \
+	ipmi_devintf ${IPMI_SMB_MODULE_NAME} ${IPMI_SI_MODULE_NAME} \
+        ipmi_msghandler"
+
+
+RETVAL=0
+LOCKFILE=/var/lock/subsys/ipmi
+
+#############################################################################
+start_watchdog()
+{
+    if [ "${IPMI_WATCHDOG}" = "1" ]; then
+	modprobe ipmi_watchdog || RETVAL=2
+    fi
+}
+
+stop_watchdog()
+{
+    modprobe -r ipmi_watchdog
+}
+
+start_powercontrol()
+{
+    local poweroff_opts=""
+    if [ "${IPMI_POWEROFF}" = "1" ]; then
+	[ "${IPMI_POWERCYCLE}" == "1" ] && poweroff_opts="poweroff_control=2"
+	modprobe ipmi_poweroff "${poweroff_opts}" || RETVAL=2
+    fi
+}
+
+stop_powercontrol()
+{
+    modprobe -r ipmi_poweroff
+}
+
+#############################################################################
+unload_ipmi_modules()
+{
+    [ ! -x /sbin/udev ] && rm -f "/dev/ipmi${INTF_NUM}"
+    for m in ${MODULES}; do
+	    modprobe -q -r ${m}
+    done
+}
+
+#############################################################################
+load_ipmi_modules ()
+{
+	modprobe ipmi_msghandler || RETVAL=1
+	if [ "${IPMI_SI}" = "1" ]; then
+	    modprobe ${IPMI_SI_MODULE_NAME} || RETVAL=1
+	fi
+	if [ "${IPMI_SMB}" = "1" ]; then
+	    modprobe ${IPMI_SMB_MODULE_NAME} || RETVAL=1
+	fi
+	[ "${RETVAL}" = "1" ] && unload_ipmi_modules && return
+
+	if [ "${DEV_IPMI}" = "1" ]; then
+	    modprobe ipmi_devintf || RETVAL=2
+	    if [ "${RETVAL}" != "2" ]; then
+		if [ ! -x /sbin/udev ]; then
+		    DEVMAJOR=`cat /proc/devices | awk '/ipmidev/{print $1}'`
+		    mknod -m 0600 /dev/ipmi${INTF_NUM} c ${DEVMAJOR} 0 || RETVAL=2
+		fi
+	    fi
+	fi
+
+	start_watchdog
+	start_powercontrol
+	if [ "${IPMI_IMB}" = "1" ]; then
+	    modprobe ipmi_imb || RETVAL=2
+	    # FIXME create canonical /dev/foo entry
+	fi
+	if [ "${IPMI_RADISYS}" = "1" ]; then
+	    modprobe ipmi_radisys || RETVAL=2
+	    # FIXME create canonical /dev/foo entry
+	fi
+	return
+}
+
+#############################################################################
+start()
+{
+    echo -n $"Starting ${MODULE_NAME} drivers: "
+    load_ipmi_modules
+    [ "${RETVAL}" = "1" ] && log_failure_msg && return
+    [ "${RETVAL}" = "2" ] && touch ${LOCKFILE} && log_warning_msg
+    [ "${RETVAL}" = "0" ] && touch ${LOCKFILE} && log_success_msg
+}
+
+#############################################################################
+stop()
+{
+    echo -n $"Stopping ${MODULE_NAME} drivers: "
+    unload_ipmi_modules
+    rm -f ${LOCKFILE}
+    log_success_msg
+}
+
+#############################################################################
+restart()
+{
+    stop
+    start
+}
+
+#############################################################################
+status ()
+{
+    for m in ${MODULES}; do
+        if /sbin/lsmod | grep $m >/dev/null 2>&1 ; then
+            echo "$m module loaded"
+        else
+            echo "$m module not loaded"
+        fi
+    done
+}
+
+usage ()
+{
+		echo $"Usage: $0 {start|stop|status|restart|condrestart|"
+		echo $"          start-watchdog|stop-watchdog|start-powercontrol|stop-powercontrol}" 1>&2
+		RETVAL=1
+}
+
+condrestart ()
+{
+    [ -e ${LOCKFILE} ] && restart
+}
+
+#############################################################################
+# MAIN
+#############################################################################
+case "$1" in
+	start) start ;;
+	stop)  stop ;;
+	restart) restart ;;
+	status)	status ;;
+	condrestart) condrestart ;;
+	start-watchdog) start_watchdog ;;
+	stop-watchdog) stop_watchdog ;;
+	start-powercontrol) start_powercontrol ;;
+	stop-powercontrol) stop_powercontrol ;;
+	*) usage ;;
+esac
+
+exit ${RETVAL}
+
+#############################################################################
+# end of file
+#############################################################################
+
--- /dev/null	Thu Apr 11 09:25:15 2002
+++ OpenIPMI-1.4.11/ipmi.sysconf	Fri May 27 15:51:37 2005
@@ -0,0 +1,30 @@
+# Enable standard hardware interfaces (KCS, BT, SMIC)
+# You probably want this enabled.
+IPMI_SI=1
+
+# Enable nonstandard interfaces (SMB via i2c)
+# IPMI_SMB=1
+
+# Enable /dev/ipmi0 interface, used by ipmitool, ipmicmd,
+# and other userspace IPMI-using applications.
+# You probably want this enabled.
+DEV_IPMI=1
+
+# Enable IPMI_WATCHDOG if you want the IPMI watchdog
+# to reboot the system if it hangs
+# IPMI_WATCHDOG=1
+
+# Enable IPMI_POWEROFF if you want the IPMI
+# poweroff module to be loaded.
+# IPMI_POWEROFF=1
+
+# Enable IPMI_POWERCYCLE if you want the system to be power-cycled (power
+# down, delay briefly, power on) rather than power off, on systems
+# that support such.  IPMI_POWEROFF=1 is also required.
+# IPMI_POWERCYCLE=1
+
+# Enable "legacy" interfaces for applications
+# Intel IMB driver interface
+# IPMI_IMB=1
+# Radisys driver interface
+# IPMI_RADISYS=1

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux