1*10480SAlexandre.Chartre@Sun.COM#!/bin/sh 2*10480SAlexandre.Chartre@Sun.COM# 3*10480SAlexandre.Chartre@Sun.COM# CDDL HEADER START 4*10480SAlexandre.Chartre@Sun.COM# 5*10480SAlexandre.Chartre@Sun.COM# The contents of this file are subject to the terms of the 6*10480SAlexandre.Chartre@Sun.COM# Common Development and Distribution License (the "License"). 7*10480SAlexandre.Chartre@Sun.COM# You may not use this file except in compliance with the License. 8*10480SAlexandre.Chartre@Sun.COM# 9*10480SAlexandre.Chartre@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*10480SAlexandre.Chartre@Sun.COM# or http://www.opensolaris.org/os/licensing. 11*10480SAlexandre.Chartre@Sun.COM# See the License for the specific language governing permissions 12*10480SAlexandre.Chartre@Sun.COM# and limitations under the License. 13*10480SAlexandre.Chartre@Sun.COM# 14*10480SAlexandre.Chartre@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each 15*10480SAlexandre.Chartre@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*10480SAlexandre.Chartre@Sun.COM# If applicable, add the following below this CDDL HEADER, with the 17*10480SAlexandre.Chartre@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying 18*10480SAlexandre.Chartre@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner] 19*10480SAlexandre.Chartre@Sun.COM# 20*10480SAlexandre.Chartre@Sun.COM# CDDL HEADER END 21*10480SAlexandre.Chartre@Sun.COM# 22*10480SAlexandre.Chartre@Sun.COM 23*10480SAlexandre.Chartre@Sun.COM# 24*10480SAlexandre.Chartre@Sun.COM# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25*10480SAlexandre.Chartre@Sun.COM# Use is subject to license terms. 26*10480SAlexandre.Chartre@Sun.COM# 27*10480SAlexandre.Chartre@Sun.COM 28*10480SAlexandre.Chartre@Sun.COM. /lib/svc/share/smf_include.sh 29*10480SAlexandre.Chartre@Sun.COM 30*10480SAlexandre.Chartre@Sun.COMSVCNAME='Logical Domains agents' 31*10480SAlexandre.Chartre@Sun.COMLDMAD='/usr/lib/ldoms/ldmad' 32*10480SAlexandre.Chartre@Sun.COMVLDS='/devices/virtual-devices@100/channel-devices@200/virtual-domain-service@0:vlds' 33*10480SAlexandre.Chartre@Sun.COMmach=`/sbin/uname -m` 34*10480SAlexandre.Chartre@Sun.COM 35*10480SAlexandre.Chartre@Sun.COMif [ "$mach" != "sun4v" ]; then 36*10480SAlexandre.Chartre@Sun.COM echo "The $SVCNAME service is not supported on this platform." 37*10480SAlexandre.Chartre@Sun.COM exit "$SMF_EXIT_ERR_FATAL" 38*10480SAlexandre.Chartre@Sun.COMfi 39*10480SAlexandre.Chartre@Sun.COM 40*10480SAlexandre.Chartre@Sun.COMif smf_is_nonglobalzone; then 41*10480SAlexandre.Chartre@Sun.COM echo "The $SVCNAME service has been disabled because " \ 42*10480SAlexandre.Chartre@Sun.COM "it is not supported in a local zone." 43*10480SAlexandre.Chartre@Sun.COM /usr/sbin/svcadm disable "$SMF_FMRI" 44*10480SAlexandre.Chartre@Sun.COM sleep 5 & 45*10480SAlexandre.Chartre@Sun.COM exit "$SMF_EXIT_OK" 46*10480SAlexandre.Chartre@Sun.COMfi 47*10480SAlexandre.Chartre@Sun.COM 48*10480SAlexandre.Chartre@Sun.COM# 49*10480SAlexandre.Chartre@Sun.COM# The Logical Domains agents service is enabled by default on sun4v platforms. 50*10480SAlexandre.Chartre@Sun.COM# However it can fail to start if the domain has a machine description in which 51*10480SAlexandre.Chartre@Sun.COM# the vlds node is not defined (because it has an old MD or firmware). So we 52*10480SAlexandre.Chartre@Sun.COM# check if a vlds device is effectively defined. If not then we disable the 53*10480SAlexandre.Chartre@Sun.COM# service for this session. We don't return an error so that the service does 54*10480SAlexandre.Chartre@Sun.COM# not go into the maintenance state and generate spurious error (especially if 55*10480SAlexandre.Chartre@Sun.COM# the system is not configured with LDoms). The service is not permanently 56*10480SAlexandre.Chartre@Sun.COM# disabled so that the service can come up if the domain is restarted with a 57*10480SAlexandre.Chartre@Sun.COM# compatible MD. 58*10480SAlexandre.Chartre@Sun.COM# 59*10480SAlexandre.Chartre@Sun.COMif [ ! -c "$VLDS" ]; then 60*10480SAlexandre.Chartre@Sun.COM echo "The $SVCNAME service has been disabled because the system" \ 61*10480SAlexandre.Chartre@Sun.COM "has no virtual domain service (vlds) device." 62*10480SAlexandre.Chartre@Sun.COM /usr/sbin/svcadm disable -t "$SMF_FMRI" 63*10480SAlexandre.Chartre@Sun.COM sleep 5 & 64*10480SAlexandre.Chartre@Sun.COM exit "$SMF_EXIT_OK" 65*10480SAlexandre.Chartre@Sun.COMfi 66*10480SAlexandre.Chartre@Sun.COM 67*10480SAlexandre.Chartre@Sun.COMif [ ! -x "$LDMAD" ]; then 68*10480SAlexandre.Chartre@Sun.COM echo "The $SVCNAME service requires the $LDMAD executable." 69*10480SAlexandre.Chartre@Sun.COM exit "$SMF_EXIT_ERR_CONFIG" 70*10480SAlexandre.Chartre@Sun.COMfi 71*10480SAlexandre.Chartre@Sun.COM 72*10480SAlexandre.Chartre@Sun.COM$LDMAD 73*10480SAlexandre.Chartre@Sun.COM 74*10480SAlexandre.Chartre@Sun.COMEXIT=$? 75*10480SAlexandre.Chartre@Sun.COM 76*10480SAlexandre.Chartre@Sun.COMif [ "$EXIT" != 0 ]; then 77*10480SAlexandre.Chartre@Sun.COM exit "$EXIT" 78*10480SAlexandre.Chartre@Sun.COMfi 79*10480SAlexandre.Chartre@Sun.COM 80*10480SAlexandre.Chartre@Sun.COMexit "$SMF_EXIT_OK" 81