summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrm88369 <none@none>2005-11-21 01:08:40 -0800
committerrm88369 <none@none>2005-11-21 01:08:40 -0800
commitd98ed3d7be38777343c0767e5c3bdc78a0eb1950 (patch)
treeb1de5581c35b9de316ee4c8cd75a7f0209e697ba
parent088e9d477eee66081e407fbc5a33c4da25f66f6a (diff)
downloadillumos-joyent-d98ed3d7be38777343c0767e5c3bdc78a0eb1950.tar.gz
PSARC 2005/449 system/scheduler
6245467 default scheduling class (disadmin -d), manifest dependency may be dishonouring default class
-rw-r--r--usr/src/cmd/Makefile1
-rw-r--r--usr/src/cmd/dispadmin/Makefile12
-rwxr-xr-xusr/src/cmd/dispadmin/scheduler.xml107
-rwxr-xr-xusr/src/cmd/dispadmin/svc-scheduler74
-rw-r--r--usr/src/cmd/initpkg/init.d/sysetup39
-rw-r--r--usr/src/cmd/svc/profile/generic_limited_net.xml3
-rw-r--r--usr/src/cmd/svc/profile/generic_open.xml3
-rw-r--r--usr/src/pkgdefs/SUNWckr/postinstall6
-rw-r--r--usr/src/pkgdefs/SUNWckr/preinstall6
-rw-r--r--usr/src/pkgdefs/SUNWckr/prototype_com2
-rw-r--r--usr/src/tools/scripts/bfu.sh7
11 files changed, 220 insertions, 40 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 2c246deaa9..fdfdf99d31 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -736,6 +736,7 @@ MANIFEST_TOPDIRS= \
coreadm \
cron \
cvcd \
+ dispadmin \
dumpadm \
eeprom \
fm \
diff --git a/usr/src/cmd/dispadmin/Makefile b/usr/src/cmd/dispadmin/Makefile
index 14c2d88cff..1d387242ab 100644
--- a/usr/src/cmd/dispadmin/Makefile
+++ b/usr/src/cmd/dispadmin/Makefile
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,6 +29,8 @@
#
PROG= dispadmin
+MANIFEST= scheduler.xml
+SVCMETHOD= svc-scheduler
RT= RT$(PROG)
TS= TS$(PROG)
IA= IA$(PROG)
@@ -53,6 +55,9 @@ ROOTTS= $(TS:%=$(ROOTDIR)/TS/%)
ROOTIA= $(IA:%=$(ROOTDIR)/IA/%)
ROOTFSS= $(FSS:%=$(ROOTDIR)/FSS/%)
ROOTFX= $(FX:%=$(ROOTDIR)/FX/%)
+ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
+
+$(ROOTMANIFEST) := FILEMODE = 0444
GROUP = bin
@@ -90,12 +95,15 @@ llib-lsubr.ln: subr.c
lint := LDLIBS += -L. -lsubr
-install: all $(ROOTPROG) $(ROOTRT) $(ROOTTS) $(ROOTIA) $(ROOTFSS) $(ROOTFX)
+install: all $(ROOTPROG) $(ROOTRT) $(ROOTTS) $(ROOTIA) $(ROOTFSS) $(ROOTFX) \
+ $(ROOTMANIFEST) $(ROOTSVCMETHOD)
# Don't re-install directories already installed by Targetdirs
#$(ROOTDIRS):
# $(INS.dir)
+check: $(CHKMANIFEST)
+
clean:
$(RM) $(OBJECTS) $(PROGS) llib-lsubr.ln
diff --git a/usr/src/cmd/dispadmin/scheduler.xml b/usr/src/cmd/dispadmin/scheduler.xml
new file mode 100755
index 0000000000..51c63de4a8
--- /dev/null
+++ b/usr/src/cmd/dispadmin/scheduler.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ Use is subject to license terms.
+
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License, Version 1.0 only
+ (the "License"). You may not use this file except in compliance
+ with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+
+ Service manifest for system/scheduler.
+-->
+
+<service_bundle type='manifest' name='SUNWckr:scheduler'>
+
+<service
+ name='system/scheduler'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance />
+
+ <!--
+ The scheduler service changes the default scheduling class from
+ /etc/dispadmin.conf. It therefore must have / (root) and /usr
+ mounted readable. svc:/system/filesystem/usr (which remounts /
+ and /usr read-writable) is dependent on svc:/system/scheduler to
+ ensure that subsequent services can use their own scheduling
+ class.
+ -->
+
+ <dependency
+ name='root'
+ type='service'
+ grouping='require_all'
+ restart_on='none'>
+ <service_fmri value='svc:/system/filesystem/root' />
+ </dependency>
+
+ <dependent
+ name='scheduler_usr'
+ grouping='optional_all'
+ restart_on='none'>
+ <service_fmri value='svc:/system/filesystem/usr' />
+ </dependent>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-scheduler'
+ timeout_seconds='30' />
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':true'
+ timeout_seconds='30' />
+
+ <property_group name='startd' type='framework'>
+ <propval name='duration' type='astring' value='transient' />
+ </property_group>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ default scheduling class configuration
+ </loctext>
+ </common_name>
+
+ <documentation>
+ <manpage
+ title='dispadmin'
+ section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/dispadmin/svc-scheduler b/usr/src/cmd/dispadmin/svc-scheduler
new file mode 100755
index 0000000000..b217d51623
--- /dev/null
+++ b/usr/src/cmd/dispadmin/svc-scheduler
@@ -0,0 +1,74 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Set default scheduling class
+#
+
+. /lib/svc/share/smf_include.sh
+
+[ -f /etc/dispadmin.conf ] || exit $SMF_EXIT_OK
+if [ -x /usr/sbin/dispadmin ] && [ -x /usr/bin/priocntl ]; then
+ ERROR="$0: cannot set default scheduling class to "
+ DISPADMIN_D=`/usr/sbin/dispadmin -d`
+
+ if [ $? -eq 0 ]; then
+ #
+ # Inform the kernel about the default scheduling class.
+ #
+ /usr/sbin/dispadmin -u
+
+ DEFAULT_SCHEDULER=`echo $DISPADMIN_D | /usr/bin/cut -f1 -d' '`
+
+ /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER -i all
+ if [ $? -ne 0 ]; then
+ echo $ERROR $DEFAULT_SCHEDULER
+ exit $SMF_EXIT_ERR_FATAL
+ else
+ #
+ # Also need to move init process explicitly
+ # because it was ignored by "-i all".
+ #
+ /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER -i pid 1
+ if [ $? -ne 0 ]; then
+ echo $ERROR $DEFAULT_SCHEDULER
+ exit $SMF_EXIT_ERR_FATAL
+ fi
+ fi
+ else
+ #
+ # Default scheduling class from dispadmin.conf is
+ # invalid or not available.
+ #
+ exit $SMF_EXIT_ERR_CONFIG
+ fi
+else
+ # dispadmin or priocntl commands can't be executed
+ echo "$0: cannot execute command"
+ exit $SMF_EXIT_ERR_FATAL
+fi
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/initpkg/init.d/sysetup b/usr/src/cmd/initpkg/init.d/sysetup
index e06d23d141..24b97f24a1 100644
--- a/usr/src/cmd/initpkg/init.d/sysetup
+++ b/usr/src/cmd/initpkg/init.d/sysetup
@@ -21,7 +21,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -41,43 +41,6 @@ fi
[ -d /etc/tm ] && /usr/bin/cat /etc/tm/* 2>/dev/null
#
-# Set default scheduling class
-#
-if [ -f /etc/dispadmin.conf ] && [ -x /usr/sbin/dispadmin ] && \
- [ -x /usr/bin/priocntl ] && \
- [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
- ERROR="$0: cannot set default scheduling class to "
- DISPADMIN_D=`/usr/sbin/dispadmin -d`
-
- if [ $? -eq 0 ]; then
- #
- # Inform the kernel about the default scheduling class.
- #
- dispadmin -u
-
- DEFAULT_SCHEDULER=`echo $DISPADMIN_D | \
- /usr/bin/awk '{ print $1 }'`
-
- /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER \
- -i all >/dev/null 2>&1
-
- if [ $? -ne 0 ]; then
- echo $ERROR $DEFAULT_SCHEDULER
- else
- #
- # Also need to move init process explicitly
- # because it was ignored by "-i all".
- #
- /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER \
- -i pid 1 >/dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo $ERROR $DEFAULT_SCHEDULER
- fi
- fi
- fi
-fi
-
-#
# Run rctladm to configure system resource controls based on the settings
# previously saved by rctladm. See rctladm(1m) for instructions on how to
# modify resource control settings.
diff --git a/usr/src/cmd/svc/profile/generic_limited_net.xml b/usr/src/cmd/svc/profile/generic_limited_net.xml
index 487c395d70..faa6b56d05 100644
--- a/usr/src/cmd/svc/profile/generic_limited_net.xml
+++ b/usr/src/cmd/svc/profile/generic_limited_net.xml
@@ -74,6 +74,9 @@
<service name='system/sac' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>
+ <service name='system/scheduler' version='1' type='service'>
+ <instance name='default' enabled='true'/>
+ </service>
<service name='system/system-log' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>
diff --git a/usr/src/cmd/svc/profile/generic_open.xml b/usr/src/cmd/svc/profile/generic_open.xml
index df20652328..e56099f1e6 100644
--- a/usr/src/cmd/svc/profile/generic_open.xml
+++ b/usr/src/cmd/svc/profile/generic_open.xml
@@ -70,6 +70,9 @@
<service name='system/sac' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>
+ <service name='system/scheduler' version='1' type='service'>
+ <instance name='default' enabled='true'/>
+ </service>
<service name='system/system-log' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>
diff --git a/usr/src/pkgdefs/SUNWckr/postinstall b/usr/src/pkgdefs/SUNWckr/postinstall
index 3e68871fc5..c15d228c85 100644
--- a/usr/src/pkgdefs/SUNWckr/postinstall
+++ b/usr/src/pkgdefs/SUNWckr/postinstall
@@ -32,3 +32,9 @@ if [ -f $BASEDIR/var/tmp/intrd.tmp ] ; then
$BASEDIR/var/svc/profile/upgrade
rm -f $BASEDIR/var/tmp/intrd.tmp
fi
+
+if [ -f $BASEDIR/tmp/scheduler.tmp ] ; then
+ echo "/usr/sbin/svcadm enable system/scheduler" >> \
+ $BASEDIR/var/svc/profile/upgrade
+ rm -f $BASEDIR/tmp/scheduler.tmp
+fi
diff --git a/usr/src/pkgdefs/SUNWckr/preinstall b/usr/src/pkgdefs/SUNWckr/preinstall
index 6f17ab812b..1db9e5c6d9 100644
--- a/usr/src/pkgdefs/SUNWckr/preinstall
+++ b/usr/src/pkgdefs/SUNWckr/preinstall
@@ -37,3 +37,9 @@ rm -f $BASEDIR/var/tmp/intrd.tmp
if [ ! -f $BASEDIR/var/svc/manifest/system/intrd.xml ] ; then
touch $BASEDIR/var/tmp/intrd.tmp
fi
+
+# Same as above, but for system/scheduler service
+rm -f $BASEDIR/tmp/scheduler.tmp
+if [ ! -f $BASEDIR/var/svc/manifest/system/scheduler.xml ] ; then
+ touch $BASEDIR/tmp/scheduler.tmp
+fi
diff --git a/usr/src/pkgdefs/SUNWckr/prototype_com b/usr/src/pkgdefs/SUNWckr/prototype_com
index aaedbe8a20..c5f54bd646 100644
--- a/usr/src/pkgdefs/SUNWckr/prototype_com
+++ b/usr/src/pkgdefs/SUNWckr/prototype_com
@@ -128,6 +128,7 @@ d none lib/svc 0755 root bin
d none lib/svc/method 0755 root bin
f none lib/svc/method/svc-dumpadm 0555 root bin
f none lib/svc/method/svc-intrd 0555 root bin
+f none lib/svc/method/svc-scheduler 0555 root bin
d none var 755 root sys
d none var/fm 755 root sys
d none var/fm/fmd 755 root sys
@@ -139,3 +140,4 @@ d none var/svc/manifest/system 755 root sys
f manifest var/svc/manifest/system/dumpadm.xml 0444 root sys
f manifest var/svc/manifest/system/fmd.xml 0444 root sys
f manifest var/svc/manifest/system/intrd.xml 0444 root sys
+f manifest var/svc/manifest/system/scheduler.xml 0444 root sys
diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh
index 152b7b9e1d..b56bcc74cd 100644
--- a/usr/src/tools/scripts/bfu.sh
+++ b/usr/src/tools/scripts/bfu.sh
@@ -315,6 +315,7 @@ superfluous_local_zone_files="
etc/zones
kernel
lib/svc/method/svc-intrd
+ lib/svc/method/svc-scheduler
var/adm/pool
var/fm
var/log/pool
@@ -332,6 +333,7 @@ superfluous_local_zone_files="
var/svc/manifest/system/metainit.xml
var/svc/manifest/system/picl.xml
var/svc/manifest/system/power.xml
+ var/svc/manifest/system/scheduler.xml
var/svc/manifest/system/sysevent.xml
var/svc/manifest/system/zones.xml
"
@@ -1057,6 +1059,11 @@ smf_handle_new_services () {
echo /usr/sbin/svcadm enable system/filesystem/volfs >> \
$rootprefix/var/svc/profile/upgrade
fi
+ if [[ $zone = global &&
+ ! -f $rootprefix/var/svc/manifest/system/scheduler.xml ]]; then
+ echo /usr/sbin/svcadm enable system/scheduler >> \
+ $rootprefix/var/svc/profile/upgrade
+ fi
}
smf_copy_manifest() {