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