1*c0dd49bdSEiji Ota#!/sbin/sh 2*c0dd49bdSEiji Ota# 3*c0dd49bdSEiji Ota# CDDL HEADER START 4*c0dd49bdSEiji Ota# 5*c0dd49bdSEiji Ota# The contents of this file are subject to the terms of the 6*c0dd49bdSEiji Ota# Common Development and Distribution License (the "License"). 7*c0dd49bdSEiji Ota# You may not use this file except in compliance with the License. 8*c0dd49bdSEiji Ota# 9*c0dd49bdSEiji Ota# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*c0dd49bdSEiji Ota# or http://www.opensolaris.org/os/licensing. 11*c0dd49bdSEiji Ota# See the License for the specific language governing permissions 12*c0dd49bdSEiji Ota# and limitations under the License. 13*c0dd49bdSEiji Ota# 14*c0dd49bdSEiji Ota# When distributing Covered Code, include this CDDL HEADER in each 15*c0dd49bdSEiji Ota# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*c0dd49bdSEiji Ota# If applicable, add the following below this CDDL HEADER, with the 17*c0dd49bdSEiji Ota# fields enclosed by brackets "[]" replaced with your own identifying 18*c0dd49bdSEiji Ota# information: Portions Copyright [yyyy] [name of copyright owner] 19*c0dd49bdSEiji Ota# 20*c0dd49bdSEiji Ota# CDDL HEADER END 21*c0dd49bdSEiji Ota# 22*c0dd49bdSEiji Ota 23*c0dd49bdSEiji Ota# 24*c0dd49bdSEiji Ota# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 25*c0dd49bdSEiji Ota# 26*c0dd49bdSEiji Ota 27*c0dd49bdSEiji Ota# 28*c0dd49bdSEiji Ota# RCM script to inform if RDSv3 is currently used 29*c0dd49bdSEiji Ota# 30*c0dd49bdSEiji Otarcm_script_version=1 31*c0dd49bdSEiji Otarcm_script_func_info="RDSv3 (un)configuration rcm script" 32*c0dd49bdSEiji Otarcm_cmd_timeout=10 33*c0dd49bdSEiji Otarcm_resource_name=/devices/ib/rdsv3@0:rdsv3 34*c0dd49bdSEiji Ota 35*c0dd49bdSEiji Otado_scriptinfo() 36*c0dd49bdSEiji Ota{ 37*c0dd49bdSEiji Ota printf "rcm_script_version=%d\n" $rcm_script_version; 38*c0dd49bdSEiji Ota printf "rcm_script_func_info=$rcm_script_func_info\n"; 39*c0dd49bdSEiji Ota printf "rcm_cmd_timeout=%d\n" $rcm_cmd_timeout; 40*c0dd49bdSEiji Ota exit 0; 41*c0dd49bdSEiji Ota} 42*c0dd49bdSEiji Ota 43*c0dd49bdSEiji Otado_register() 44*c0dd49bdSEiji Ota{ 45*c0dd49bdSEiji Ota printf "rcm_resource_name=%s\n" $rcm_resource_name; 46*c0dd49bdSEiji Ota exit 0; 47*c0dd49bdSEiji Ota} 48*c0dd49bdSEiji Ota 49*c0dd49bdSEiji Otado_resourceinfo() 50*c0dd49bdSEiji Ota{ 51*c0dd49bdSEiji Ota if [ x"$1" = x"/devices/ib/rdsv3@0:rdsv3" ] 52*c0dd49bdSEiji Ota then 53*c0dd49bdSEiji Ota printf "rcm_resource_usage_info=RDSv3 IB device 0\n"; 54*c0dd49bdSEiji Ota exit 0; 55*c0dd49bdSEiji Ota else 56*c0dd49bdSEiji Ota printf "rcm_failure_reason=Unknown RDSv3 device\n"; 57*c0dd49bdSEiji Ota exit 3; 58*c0dd49bdSEiji Ota fi 59*c0dd49bdSEiji Ota} 60*c0dd49bdSEiji Ota 61*c0dd49bdSEiji Otado_queryremove() 62*c0dd49bdSEiji Ota{ 63*c0dd49bdSEiji Ota output=`/usr/sbin/fuser $rcm_resource_name 2>&1` 64*c0dd49bdSEiji Ota ret=$? 65*c0dd49bdSEiji Ota 66*c0dd49bdSEiji Ota sockrds=`echo "$output" | grep 'sockrds'` 67*c0dd49bdSEiji Ota 68*c0dd49bdSEiji Ota if [ $ret -eq 0 ] && [ ! -z "$sockrds" ] 69*c0dd49bdSEiji Ota then 70*c0dd49bdSEiji Ota printf "rcm_log_warn=RDSv3 is being used currently. " 71*c0dd49bdSEiji Ota printf "Please stop processes currently running on it " 72*c0dd49bdSEiji Ota printf "before un-configuring IB HCA/RDSv3.\n"; 73*c0dd49bdSEiji Ota printf "rcm_failure_reason=RDSv3 is being used on this system\n"; 74*c0dd49bdSEiji Ota exit 3; 75*c0dd49bdSEiji Ota elif [ $ret -ne 0 ] 76*c0dd49bdSEiji Ota then 77*c0dd49bdSEiji Ota printf "rcm_log_warn='fuser $rcm_resource_name' command failed." 78*c0dd49bdSEiji Ota printf "rcm_failure_reason='fuser $rcm_resource_name' command " 79*c0dd49bdSEiji Ota printf "failed.\n"; 80*c0dd49bdSEiji Ota exit 1; 81*c0dd49bdSEiji Ota fi 82*c0dd49bdSEiji Ota exit 0; 83*c0dd49bdSEiji Ota} 84*c0dd49bdSEiji Ota 85*c0dd49bdSEiji Otado_preremove() 86*c0dd49bdSEiji Ota{ 87*c0dd49bdSEiji Ota exit 0; 88*c0dd49bdSEiji Ota} 89*c0dd49bdSEiji Ota 90*c0dd49bdSEiji Otado_undoremove() 91*c0dd49bdSEiji Ota{ 92*c0dd49bdSEiji Ota exit 0; 93*c0dd49bdSEiji Ota} 94*c0dd49bdSEiji Ota 95*c0dd49bdSEiji Otado_postremove() 96*c0dd49bdSEiji Ota{ 97*c0dd49bdSEiji Ota exit 0; 98*c0dd49bdSEiji Ota} 99*c0dd49bdSEiji Ota 100*c0dd49bdSEiji Otacase "$1" in 101*c0dd49bdSEiji Ota scriptinfo) do_scriptinfo;; 102*c0dd49bdSEiji Ota register) do_register;; 103*c0dd49bdSEiji Ota resourceinfo) do_resourceinfo $2;; 104*c0dd49bdSEiji Ota queryremove) do_queryremove $2;; 105*c0dd49bdSEiji Ota preremove) do_preremove $2;; 106*c0dd49bdSEiji Ota undoremove) do_undoremove $2;; 107*c0dd49bdSEiji Ota postremove) do_postremove $2;; 108*c0dd49bdSEiji Ota *) echo Unknown option $1;; 109*c0dd49bdSEiji Otaesac 110