1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#!/bin/sh
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# CDDL HEADER START
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# The contents of this file are subject to the terms of the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# Common Development and Distribution License (the "License").
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# You may not use this file except in compliance with the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# or http://www.opensolaris.org/os/licensing.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# See the License for the specific language governing permissions
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# and limitations under the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# When distributing Covered Code, include this CDDL HEADER in each
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# If applicable, add the following below this CDDL HEADER, with the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# fields enclosed by brackets "[]" replaced with your own identifying
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# information: Portions Copyright [yyyy] [name of copyright owner]
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# CDDL HEADER END
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
195ce4e5cab5a850f4079df860f51c5659a1298bSriharsha Basavapatna#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# Use is subject to license terms.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo. /lib/svc/share/smf_include.sh
7b1f684a14f99a2b9b1b2561f484ff648eff6d9bSriharsha Basavapatna
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoSVCNAME='Logical Domains agents'
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoLDMAD='/usr/lib/ldoms/ldmad'
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuramVLDS='/devices/virtual-devices@100/channel-devices@200/virtual-domain-service@0:vlds'
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppomach=`/sbin/uname -m`
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoif [ "$mach" != "sun4v" ]; then
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo echo "The $SVCNAME service is not supported on this platform."
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo exit "$SMF_EXIT_ERR_FATAL"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppofi
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoif smf_is_nonglobalzone; then
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo echo "The $SVCNAME service has been disabled because " \
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo "it is not supported in a local zone."
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /usr/sbin/svcadm disable "$SMF_FMRI"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo sleep 5 &
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng exit "$SMF_EXIT_OK"
ba2e4443695ee6a6f420a35cd4fc3d3346d22932sebfi
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# The Logical Domains agents service is enabled by default on sun4v platforms.
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuram# However it can fail to start if the domain has a machine description in which
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuram# the vlds node is not defined (because it has an old MD or firmware). So we
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# check if a vlds device is effectively defined. If not then we disable the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# service for this session. We don't return an error so that the service does
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# not go into the maintenance state and generate spurious error (especially if
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo# the system is not configured with LDoms). The service is not permanently
d10e4ef2fabf16c3237c6d6592496df3eac6a1efnarayan# disabled so that the service can come up if the domain is restarted with a
d10e4ef2fabf16c3237c6d6592496df3eac6a1efnarayan# compatible MD.
f0ca1d9a12d54d304791bc74525e2010ca924726sb#
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuramif [ ! -c "$VLDS" ]; then
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuram echo "The $SVCNAME service has been disabled because the system" \
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuram "has no virtual domain service (vlds) device."
844e62a3ec8c8ff5175bb35d1c38446e060730f6raghuram /usr/sbin/svcadm disable -t "$SMF_FMRI"
c1c61f44e88f4c8c155272ee56d868043146096asb sleep 5 &
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo exit "$SMF_EXIT_OK"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppofi
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppoif [ ! -x "$LDMAD" ]; then
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo echo "The $SVCNAME service requires the $LDMAD executable."
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo exit "$SMF_EXIT_ERR_CONFIG"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppofi
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo$LDMAD
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo
678453a8ed49104d8adad58f3ba591bdc39883e8speerEXIT=$?
678453a8ed49104d8adad58f3ba591bdc39883e8speer
d10e4ef2fabf16c3237c6d6592496df3eac6a1efnarayanif [ "$EXIT" != 0 ]; then
678453a8ed49104d8adad58f3ba591bdc39883e8speer exit "$EXIT"
6f09f0fef8e4582cfa771d87fe2a1f777bfb5cf0WENTAO YANGfi
6f09f0fef8e4582cfa771d87fe2a1f777bfb5cf0WENTAO YANG
6f09f0fef8e4582cfa771d87fe2a1f777bfb5cf0WENTAO YANGexit "$SMF_EXIT_OK"
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo