xref: /titanic_50/usr/src/cmd/rcm_daemon/common/SUNW,ibsdpu.sh (revision 51f34d4b950abb3636d536e2250bdc05baba902e)
1*51f34d4bSRajkumar Sivaprakasam#!/sbin/sh
2*51f34d4bSRajkumar Sivaprakasam#
3*51f34d4bSRajkumar Sivaprakasam# CDDL HEADER START
4*51f34d4bSRajkumar Sivaprakasam#
5*51f34d4bSRajkumar Sivaprakasam# The contents of this file are subject to the terms of the
6*51f34d4bSRajkumar Sivaprakasam# Common Development and Distribution License (the "License").
7*51f34d4bSRajkumar Sivaprakasam# You may not use this file except in compliance with the License.
8*51f34d4bSRajkumar Sivaprakasam#
9*51f34d4bSRajkumar Sivaprakasam# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*51f34d4bSRajkumar Sivaprakasam# or http://www.opensolaris.org/os/licensing.
11*51f34d4bSRajkumar Sivaprakasam# See the License for the specific language governing permissions
12*51f34d4bSRajkumar Sivaprakasam# and limitations under the License.
13*51f34d4bSRajkumar Sivaprakasam#
14*51f34d4bSRajkumar Sivaprakasam# When distributing Covered Code, include this CDDL HEADER in each
15*51f34d4bSRajkumar Sivaprakasam# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*51f34d4bSRajkumar Sivaprakasam# If applicable, add the following below this CDDL HEADER, with the
17*51f34d4bSRajkumar Sivaprakasam# fields enclosed by brackets "[]" replaced with your own identifying
18*51f34d4bSRajkumar Sivaprakasam# information: Portions Copyright [yyyy] [name of copyright owner]
19*51f34d4bSRajkumar Sivaprakasam#
20*51f34d4bSRajkumar Sivaprakasam# CDDL HEADER END
21*51f34d4bSRajkumar Sivaprakasam#
22*51f34d4bSRajkumar Sivaprakasam
23*51f34d4bSRajkumar Sivaprakasam#
24*51f34d4bSRajkumar Sivaprakasam# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25*51f34d4bSRajkumar Sivaprakasam# Use is subject to license terms.
26*51f34d4bSRajkumar Sivaprakasam#
27*51f34d4bSRajkumar Sivaprakasam
28*51f34d4bSRajkumar Sivaprakasam#
29*51f34d4bSRajkumar Sivaprakasam# RCM script to inform the need to run 'sdpadm disable' before removing the
30*51f34d4bSRajkumar Sivaprakasam# last IB HCA, when SDP is enabled in the system.
31*51f34d4bSRajkumar Sivaprakasam#
32*51f34d4bSRajkumar Sivaprakasam
33*51f34d4bSRajkumar Sivaprakasamrcm_script_version=1
34*51f34d4bSRajkumar Sivaprakasamrcm_script_func_info="SDP (un)configuration rcm script"
35*51f34d4bSRajkumar Sivaprakasamrcm_cmd_timeout=10
36*51f34d4bSRajkumar Sivaprakasamrcm_resource_name=/devices/ib/sdpib@0:sdpib
37*51f34d4bSRajkumar Sivaprakasam
38*51f34d4bSRajkumar Sivaprakasamdo_scriptinfo()
39*51f34d4bSRajkumar Sivaprakasam{
40*51f34d4bSRajkumar Sivaprakasam	printf "rcm_script_version=%d\n" $rcm_script_version;
41*51f34d4bSRajkumar Sivaprakasam	printf "rcm_script_func_info=$rcm_script_func_info\n";
42*51f34d4bSRajkumar Sivaprakasam	printf "rcm_cmd_timeout=%d\n" $rcm_cmd_timeout;
43*51f34d4bSRajkumar Sivaprakasam	exit 0;
44*51f34d4bSRajkumar Sivaprakasam}
45*51f34d4bSRajkumar Sivaprakasam
46*51f34d4bSRajkumar Sivaprakasamdo_register()
47*51f34d4bSRajkumar Sivaprakasam{
48*51f34d4bSRajkumar Sivaprakasam	printf "rcm_resource_name=%s\n" $rcm_resource_name;
49*51f34d4bSRajkumar Sivaprakasam	exit 0;
50*51f34d4bSRajkumar Sivaprakasam}
51*51f34d4bSRajkumar Sivaprakasam
52*51f34d4bSRajkumar Sivaprakasamdo_resourceinfo()
53*51f34d4bSRajkumar Sivaprakasam{
54*51f34d4bSRajkumar Sivaprakasam	if [ x"$1" = x"/devices/ib/sdpib@0:sdpib" ]
55*51f34d4bSRajkumar Sivaprakasam	then
56*51f34d4bSRajkumar Sivaprakasam		printf "rcm_resource_usage_info=SDP IB device 0\n";
57*51f34d4bSRajkumar Sivaprakasam		exit 0;
58*51f34d4bSRajkumar Sivaprakasam	else
59*51f34d4bSRajkumar Sivaprakasam		printf "rcm_failure_reason=Unknown SDP device\n";
60*51f34d4bSRajkumar Sivaprakasam		exit 3;
61*51f34d4bSRajkumar Sivaprakasam	fi
62*51f34d4bSRajkumar Sivaprakasam}
63*51f34d4bSRajkumar Sivaprakasam
64*51f34d4bSRajkumar Sivaprakasamdo_queryremove()
65*51f34d4bSRajkumar Sivaprakasam{
66*51f34d4bSRajkumar Sivaprakasam	status=`sdpadm status`
67*51f34d4bSRajkumar Sivaprakasam	ret=$?
68*51f34d4bSRajkumar Sivaprakasam
69*51f34d4bSRajkumar Sivaprakasam	if [ $ret -eq 0 ] && [ "$status" != "SDP is Disabled" ]
70*51f34d4bSRajkumar Sivaprakasam	then
71*51f34d4bSRajkumar Sivaprakasam		printf "rcm_log_warn=SDP is enabled. Please run 'sdpadm disable' command "
72*51f34d4bSRajkumar Sivaprakasam		printf "before un-configuring IB HCA/SDP\n";
73*51f34d4bSRajkumar Sivaprakasam		printf "rcm_failure_reason=SDP is enabled on this system\n";
74*51f34d4bSRajkumar Sivaprakasam		exit 3;
75*51f34d4bSRajkumar Sivaprakasam	elif [ $ret -ne 0 ]
76*51f34d4bSRajkumar Sivaprakasam	then
77*51f34d4bSRajkumar Sivaprakasam		printf "rcm_log_warn='sdpadm status' command failed. Could not find the "
78*51f34d4bSRajkumar Sivaprakasam		printf "status of SDP\n";
79*51f34d4bSRajkumar Sivaprakasam		printf "rcm_failure_reason='sdpadm status' command failed.\n";
80*51f34d4bSRajkumar Sivaprakasam		exit 1;
81*51f34d4bSRajkumar Sivaprakasam	fi
82*51f34d4bSRajkumar Sivaprakasam	exit 0;
83*51f34d4bSRajkumar Sivaprakasam}
84*51f34d4bSRajkumar Sivaprakasam
85*51f34d4bSRajkumar Sivaprakasamdo_preremove()
86*51f34d4bSRajkumar Sivaprakasam{
87*51f34d4bSRajkumar Sivaprakasam	exit 0;
88*51f34d4bSRajkumar Sivaprakasam}
89*51f34d4bSRajkumar Sivaprakasam
90*51f34d4bSRajkumar Sivaprakasamdo_undoremove()
91*51f34d4bSRajkumar Sivaprakasam{
92*51f34d4bSRajkumar Sivaprakasam	exit 0;
93*51f34d4bSRajkumar Sivaprakasam}
94*51f34d4bSRajkumar Sivaprakasam
95*51f34d4bSRajkumar Sivaprakasamdo_postremove()
96*51f34d4bSRajkumar Sivaprakasam{
97*51f34d4bSRajkumar Sivaprakasam	exit 0;
98*51f34d4bSRajkumar Sivaprakasam}
99*51f34d4bSRajkumar Sivaprakasam
100*51f34d4bSRajkumar Sivaprakasamcase "$1" in
101*51f34d4bSRajkumar Sivaprakasam	scriptinfo) do_scriptinfo;;
102*51f34d4bSRajkumar Sivaprakasam	register) do_register;;
103*51f34d4bSRajkumar Sivaprakasam	resourceinfo) do_resourceinfo $2;;
104*51f34d4bSRajkumar Sivaprakasam	queryremove) do_queryremove $2;;
105*51f34d4bSRajkumar Sivaprakasam	preremove) do_preremove $2;;
106*51f34d4bSRajkumar Sivaprakasam	undoremove) do_undoremove $2;;
107*51f34d4bSRajkumar Sivaprakasam	postremove) do_postremove $2;;
108*51f34d4bSRajkumar Sivaprakasam	*) echo Unknown option $1;;
109*51f34d4bSRajkumar Sivaprakasamesac
110