diff options
Diffstat (limited to 'usr/src/cmd')
| -rw-r--r-- | usr/src/cmd/initpkg/init.d/sysetup | 9 | ||||
| -rw-r--r-- | usr/src/cmd/pools/Makefile | 17 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poolcfg/poolcfg.y | 7 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/Makefile | 14 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.java | 17 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java | 12 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java | 3 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java | 3 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/poold.c | 196 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/poold.xml | 108 | ||||
| -rw-r--r-- | usr/src/cmd/pools/poold/svc-poold | 54 | ||||
| -rw-r--r-- | usr/src/cmd/pools/pools.xml | 105 | ||||
| -rw-r--r-- | usr/src/cmd/pools/svc-pools | 79 |
13 files changed, 464 insertions, 160 deletions
diff --git a/usr/src/cmd/initpkg/init.d/sysetup b/usr/src/cmd/initpkg/init.d/sysetup index 24b97f24a1..b6fced4e9b 100644 --- a/usr/src/cmd/initpkg/init.d/sysetup +++ b/usr/src/cmd/initpkg/init.d/sysetup @@ -48,12 +48,3 @@ fi if [ -f /etc/rctladm.conf ] && [ -x /usr/sbin/rctladm ]; then /usr/sbin/rctladm -u fi - -# -# Run pooladm to configure system pools. See pooladm(1m) for more information. -# -if [ -f /etc/pooladm.conf ] && [ -x /usr/sbin/pooladm ] && \ - [ "$_INIT_ZONENAME" = "global" ]; then - /usr/sbin/pooladm -e - /usr/sbin/pooladm -c -fi diff --git a/usr/src/cmd/pools/Makefile b/usr/src/cmd/pools/Makefile index a26d82631f..b22205e600 100644 --- a/usr/src/cmd/pools/Makefile +++ b/usr/src/cmd/pools/Makefile @@ -20,18 +20,23 @@ # CDDL HEADER END # # -# Copyright 2003 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" +# ident "%Z%%M% %I% %E% SMI" # # cmd/pools/Makefile # +MANIFEST= pools.xml +SVCMETHOD= svc-pools + include ../Makefile.cmd SUBDIRS= pooladm poolbind poolcfg poolstat poold +ROOTMANIFESTDIR= $(ROOTSVCSYSTEM) + all := TARGET = all install := TARGET = install clean := TARGET = clean @@ -39,9 +44,15 @@ clobber := TARGET = clobber lint := TARGET = lint _msg := TARGET = _msg +$(ROOTMANIFEST):= FILEMODE= 444 + .KEEP_STATE: -all install lint clean clobber _msg: $(SUBDIRS) +all lint clean clobber _msg: $(SUBDIRS) + +install: $(SUBDIRS) $(ROOTMANIFEST) $(ROOTSVCMETHOD) + +check: $(CHKMANIFEST) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) diff --git a/usr/src/cmd/pools/poolcfg/poolcfg.y b/usr/src/cmd/pools/poolcfg/poolcfg.y index 3fdd526805..cdb8acab9f 100644 --- a/usr/src/cmd/pools/poolcfg/poolcfg.y +++ b/usr/src/cmd/pools/poolcfg/poolcfg.y @@ -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. */ @@ -328,6 +328,11 @@ create_command: PCC_CREATE entity name switch ($2) { case PCE_SYSTEM: $$->cmd = &parser_conf_create; + /* + * When creating a new system element, ensure + * pre-existing errors are ignored. + */ + conf_list_error = conf_edit_error = POE_OK; break; case PCE_POOL: $$->cmd = &parser_pool_create; diff --git a/usr/src/cmd/pools/poold/Makefile b/usr/src/cmd/pools/poold/Makefile index 0dbe209449..bc8335c7ae 100644 --- a/usr/src/cmd/pools/poold/Makefile +++ b/usr/src/cmd/pools/poold/Makefile @@ -20,18 +20,20 @@ # 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" # # cmd/pools/poold/Makefile - PROG = poold OBJS = poold.o SRCS = $(OBJS:%.o=%.c) +MANIFEST= poold.xml +SVCMETHOD= svc-poold + include $(SRC)/cmd/Makefile.cmd JAVA_SUBDIRS = com/sun/solaris/service/exception \ @@ -47,6 +49,8 @@ SUBDIRS = libjkstat \ libjpool \ libjsyslog +ROOTMANIFESTDIR= $(ROOTSVCSYSTEM) + all := TARGET = all install := TARGET = install clean := TARGET = clean @@ -54,6 +58,7 @@ clobber := TARGET = clobber lint := TARGET = lint msg := TARGET = msg +$(ROOTMANIFEST):= FILEMODE= 444 JARFILE = JPool.jar # JAVA_SUBDIRS and PACKAGEDOCS must be synchronized to ensure @@ -108,7 +113,10 @@ lint: $(SUBDIRS) msg: $(POFILES) install: $(ROOTCMD) $(JAVA_SUBDIRS) $(JARFILE) \ - .WAIT $(SUBDIRS) $(ROOTJAVA) + .WAIT $(SUBDIRS) $(ROOTJAVA) $(ROOTMANIFEST) \ + $(ROOTSVCMETHOD) + +check: $(CHKMANIFEST) $(JAVA_SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.java b/usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.java index 8ff1bd7fd5..99beaba9bd 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.java @@ -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" @@ -318,11 +318,6 @@ final class Poold private AtomicBoolean firstInitialization = new AtomicBoolean(true); /** - * Ignore configuration updates for the next interval? - */ - private boolean ignoreUpdates = true; - - /** * Flags whether poold should run or exit. */ private AtomicBoolean shouldRun = new AtomicBoolean(true); @@ -807,16 +802,6 @@ final class Poold while (shouldRun.get()) { try { changed = conf.update(); - /* - * poold modifies the configuration - * during startup (updating the PID of - * poold) so we have to ignore our - * first ever configuration update. - */ - if (ignoreUpdates) { - ignoreUpdates = false; - changed = 0; - } assert(!confRequired || confRequired && changed != 0); if (changed != 0) { diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java index ade169e78e..1597af088b 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.java @@ -338,8 +338,7 @@ public class Configuration extends Element if ((pools = PoolInternal.pool_query_pools(getConf(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else @@ -447,8 +446,7 @@ public class Configuration extends Element if ((resources = PoolInternal.pool_query_resources(getConf(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else @@ -525,8 +523,7 @@ public class Configuration extends Element if ((components = PoolInternal.pool_query_components(getConf(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else @@ -586,8 +583,7 @@ public class Configuration extends Element if ((components = PoolInternal.pool_query_components(getConf(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java index f22f4b311f..113bf463e7 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.java @@ -117,8 +117,7 @@ public class Pool extends Element { if ((resources = PoolInternal.pool_query_pool_resources( _conf.getConf(), getPool(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else diff --git a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java index babe05c015..d09327e1bf 100644 --- a/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java +++ b/usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.java @@ -131,8 +131,7 @@ public class Resource extends Element if ((components = PoolInternal.pool_query_resource_components( _conf.getConf(), getResource(), values)) == null) { - if (PoolInternal.pool_error() == 0 || - PoolInternal.pool_error() == + if (PoolInternal.pool_error() == PoolInternal.POE_INVALID_SEARCH) return new ArrayList(); else diff --git a/usr/src/cmd/pools/poold/poold.c b/usr/src/cmd/pools/poold/poold.c index 0e0fce2331..8be6ade7d1 100644 --- a/usr/src/cmd/pools/poold/poold.c +++ b/usr/src/cmd/pools/poold/poold.c @@ -53,6 +53,7 @@ #define POOLD_DEF_CLASSPATH "/usr/lib/pool/JPool.jar" #define POOLD_DEF_LIBPATH "/usr/lib/pool" +#define SMF_SVC_INSTANCE "svc:/system/pools/dynamic:default" #if defined(sparc) #define PLAT "sparc" @@ -64,8 +65,6 @@ #endif #endif -#define PID_PROPERTY_NAME "system.poold.pid" - #define CLASS_FIELD_DESC(class_desc) "L" class_desc ";" #define LEVEL_CLASS_DESC "java/util/logging/Level" @@ -190,58 +189,6 @@ pu_die(const char *fmt, ...) } /* - * Update the "system.poold.pid" to reflect this instance of poold only - * if the property hasn't been set already to reflect an existing - * process, and mode is not set to PGAS_GET_ONLY. Returns the - * property's pre-existing value, or -1 otherwise. - */ -static pid_t -poold_get_and_set_pid(pgas_mode_t mode) -{ - pool_conf_t *conf; - pool_elem_t *pe; - pool_value_t *val; - int64_t ival; - - if (!(conf = pool_conf_alloc())) - return ((pid_t)-1); - - if (pool_conf_open(conf, pool_dynamic_location(), PO_RDWR) != 0) { - (void) pool_conf_free(conf); - return ((pid_t)-1); - } - - pe = pool_conf_to_elem(conf); - if (!(val = pool_value_alloc())) { - (void) pool_conf_close(conf); - return ((pid_t)-1); - } - - if (pool_get_property(conf, pe, PID_PROPERTY_NAME, val) == POC_INT) { - if (pool_value_get_int64(val, &ival) != 0) { - (void) pool_value_free(val); - (void) pool_conf_close(conf); - return ((pid_t)-1); - } - } else { - ival = (pid_t)-1; - } - - if (mode == PGAS_GET_AND_SET) { - ival = getpid(); - pool_value_set_int64(val, ival); - (void) pool_put_property(conf, pe, PID_PROPERTY_NAME, val); - (void) pool_conf_commit(conf, 0); - } - - (void) pool_value_free(val); - (void) pool_conf_close(conf); - pool_conf_free(conf); - - return ((pid_t)ival); -} - -/* * Reconfigure the JVM by simply updating a dummy property on the * system element to force pool_conf_update() to detect a change. */ @@ -328,8 +275,20 @@ handle_sig(void *arg) char buf[SIG2STR_MAX]; int detach_required = 0; - if ((sig = sigwait(&hdl_set)) < 0) +retry: + if ((sig = sigwait(&hdl_set)) < 0) { + /* + * We used forkall() previously to ensure that + * all threads started by the JVM are + * duplicated in the child. Since forkall() + * can cause blocking system calls to be + * interrupted, check to see if the errno is + * EINTR and if it is wait again. + */ + if (errno == EINTR) + goto retry; pu_die("unexpected error: %d\n", errno); + } (void) sig2str(sig, buf); switch (sig) { case SIGHUP: @@ -410,7 +369,6 @@ main(int argc, char *argv[]) { char c; char log_severity[16] = ""; - pid_t pid; JavaVMInitArgs vm_args; JavaVMOption vm_opts[5]; int nopts = 0; @@ -429,6 +387,7 @@ main(int argc, char *argv[]) int explain_ex = 1; JavaVM *jvm_tmp; pthread_t hdl_thread; + FILE *p; pname = pu_getpname(argv[0]); openlog(pname, 0, LOG_DAEMON); @@ -456,22 +415,61 @@ main(int argc, char *argv[]) } /* - * Verify no other poold is running. This condition is checked - * again later, but should be checked now since it is more - * serious (i.e. should be reported before) than a lack of - * privileges. - */ - if (((pid = poold_get_and_set_pid(PGAS_GET_ONLY)) != (pid_t)-1) && - pid != getpid() && kill(pid, 0) == 0) - pu_die(gettext("poold is already active (process %ld)\n"), pid); - - /* * Check permission */ if (!priv_ineffect(PRIV_SYS_RES_CONFIG)) pu_die(gettext(ERR_PRIVILEGE), PRIV_SYS_RES_CONFIG); /* + * In order to avoid problems with arbitrary thread selection + * when handling asynchronous signals, dedicate a thread to + * look after these signals. + */ + if (sigemptyset(&hdl_set) < 0 || + sigaddset(&hdl_set, SIGHUP) < 0 || + sigaddset(&hdl_set, SIGTERM) < 0 || + sigaddset(&hdl_set, SIGINT) < 0 || + pthread_sigmask(SIG_BLOCK, &hdl_set, NULL) || + pthread_create(&hdl_thread, NULL, handle_sig, NULL)) + pu_die(gettext("can't install signal handler")); + + /* + * If the -l flag is supplied, terminate the SMF service and + * run interactively from the command line. + */ + if (lflag) { + char *cmd = "/usr/sbin/svcadm disable -st " SMF_SVC_INSTANCE; + + if (getenv("SMF_FMRI") != NULL) + pu_die("-l option illegal: %s\n", SMF_SVC_INSTANCE); + /* + * Since disabling a service isn't synchronous, use the + * synchronous option from svcadm to achieve synchronous + * behaviour. + * This is not very satisfactory, but since this is only + * for use in debugging scenarios, it will do until there + * is a C API to synchronously shutdown a service in SMF. + */ + if ((p = popen(cmd, "w")) == NULL || pclose(p) != 0) + pu_die("could not temporarily disable service: %s\n", + SMF_SVC_INSTANCE); + } else { + /* + * Check if we are running as a SMF service. If we + * aren't, terminate this process after enabling the + * service. + */ + if (getenv("SMF_FMRI") == NULL) { + char *cmd = "/usr/sbin/svcadm enable -s " \ + SMF_SVC_INSTANCE; + if ((p = popen(cmd, "w")) == NULL || pclose(p) != 0) + pu_die("could not enable " + "service: %s\n", SMF_SVC_INSTANCE); + return (E_PO_SUCCESS); + } + } + + /* * Establish the classpath and LD_LIBRARY_PATH for native * methods, and get the interpreter going. */ @@ -514,43 +512,6 @@ main(int argc, char *argv[]) vm_args.version = 0x00010002; /* - * XXX - Forking after the VM is created is desirable to - * guarantee reporting of errors, but cannot be done (see - * 4919246). - * - * If invoked by libpool(3LIB), it's set the system.poold.pid - * property and forked already. If invoked directly and -l is - * specified, forking is not desired. - */ - if (!lflag && pid != getpid()) - switch (fork()) { - case 0: - (void) setsid(); - (void) fclose(stdin); - (void) fclose(stdout); - (void) fclose(stderr); - break; - case -1: - pu_die(gettext("cannot fork")); - /*NOTREACHED*/ - default: - return (E_PO_SUCCESS); - } - - /* - * In order to avoid problems with arbitrary thread selection - * when handling asynchronous signals, dedicate a thread to - * look after these signals. - */ - if (sigemptyset(&hdl_set) < 0 || - sigaddset(&hdl_set, SIGHUP) < 0 || - sigaddset(&hdl_set, SIGTERM) < 0 || - sigaddset(&hdl_set, SIGINT) < 0 || - pthread_sigmask(SIG_BLOCK, &hdl_set, NULL) || - pthread_create(&hdl_thread, NULL, handle_sig, NULL)) - pu_die(gettext("can't install signal handler")); - - /* * Use jvm_tmp when creating the jvm to prevent race * conditions with signal handlers. As soon as the call * returns, assign the global jvm to jvm_tmp. @@ -648,20 +609,23 @@ main(int argc, char *argv[]) log_dest = LD_JAVA; /* - * Now we're ready to start poold. Store our pid in the pools - * configuration to mark that an instance of poold is active, - * then invoke Poold.run(), which does not normally return. - * - * Note that the ignoreUpdates variable in Poold is used to - * allow Poold to ignore the pools configuration update that - * this change triggers. If this code is ever modified to - * remove or modify this logic, then the Poold class must also - * be modified to keep the actions synchronized. + * If invoked directly and -l is specified, forking is not + * desired. */ - - if (((pid = poold_get_and_set_pid(PGAS_GET_AND_SET)) != (pid_t)-1) && - pid != getpid() && kill(pid, 0) == 0) - pu_die(gettext("poold is already active (process %ld)\n"), pid); + if (!lflag) + switch (forkall()) { + case 0: + (void) setsid(); + (void) fclose(stdin); + (void) fclose(stdout); + (void) fclose(stderr); + break; + case -1: + pu_die(gettext("cannot fork")); + /*NOTREACHED*/ + default: + return (E_PO_SUCCESS); + } (void) pthread_mutex_lock(&instance_running_lock); instance_running = 1; diff --git a/usr/src/cmd/pools/poold/poold.xml b/usr/src/cmd/pools/poold/poold.xml new file mode 100644 index 0000000000..87d7ff1f2d --- /dev/null +++ b/usr/src/cmd/pools/poold/poold.xml @@ -0,0 +1,108 @@ +<?xml version="1.0"?> +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> +<!-- + CDDL HEADER START + + The contents of this file are subject to the terms of the + Common Development and Distribution License (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" + + 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_bundle type='manifest' name='SUNWpoolr:poold'> + +<service + name='system/pools/dynamic' + type='service' + version='1'> + + <create_default_instance enabled='false' /> + + <single_instance /> + + <dependency + name='var' + type='service' + grouping='require_all' + restart_on='none'> + <service_fmri value='svc:/system/filesystem/local' /> + </dependency> + + <!-- Resource Pools service must be active. --> + <!-- poold detects changes to the Resource Pools configuration, + so restart_on is set to 'none'. --> + <dependency + name='pools' + type='service' + grouping='require_all' + restart_on='none'> + <service_fmri value='svc:/system/pools:default' /> + </dependency> + + <exec_method + type='method' + name='start' + exec='/lib/svc/method/svc-poold %m' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <exec_method + type='method' + name='stop' + exec=':kill' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <exec_method + type='method' + name='refresh' + exec=':kill -HUP' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <stability value='Unstable' /> + + <template> + <common_name> + <loctext xml:lang='C'> + dynamic resource pools + </loctext> + </common_name> + <documentation> + <manpage title='poold' section='1M' manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +</service_bundle> diff --git a/usr/src/cmd/pools/poold/svc-poold b/usr/src/cmd/pools/poold/svc-poold new file mode 100644 index 0000000000..77b2e32773 --- /dev/null +++ b/usr/src/cmd/pools/poold/svc-poold @@ -0,0 +1,54 @@ +#!/sbin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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" +# +# Method script for the pools service. +# + +. /lib/svc/share/smf_include.sh + +check_requirements () { + if [ ! -x /sbin/zonename ] || [ ! -x /usr/lib/pool/poold ] || + [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then + exit $SMF_EXIT_ERR_FATAL + fi +} + +check_requirements +case "$1" in +'start') + /usr/lib/pool/poold + if [ $? -ne 0 ]; then + exit $SMF_EXIT_ERR_FATAL + fi + ;; +*) + echo "Usage: $0 { start }" + exit $SMF_EXIT_ERR_FATAL + ;; +esac + +exit $SMF_EXIT_OK diff --git a/usr/src/cmd/pools/pools.xml b/usr/src/cmd/pools/pools.xml new file mode 100644 index 0000000000..a9feaa7b39 --- /dev/null +++ b/usr/src/cmd/pools/pools.xml @@ -0,0 +1,105 @@ +<?xml version="1.0"?> +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> +<!-- + CDDL HEADER START + + The contents of this file are subject to the terms of the + Common Development and Distribution License (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" + + 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_bundle type='manifest' name='SUNWpoolr:pools'> + +<service + name='system/pools' + type='service' + version='1'> + + <create_default_instance enabled='false' /> + + <single_instance /> + + <dependency + name='usr' + type='service' + grouping='require_all' + restart_on='none'> + <service_fmri value='svc:/system/filesystem/minimal' /> + </dependency> + + <exec_method + type='method' + name='start' + exec='/lib/svc/method/svc-pools %m' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <exec_method + type='method' + name='stop' + exec='/lib/svc/method/svc-pools %m' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <exec_method + type='method' + name='refresh' + exec='/lib/svc/method/svc-pools %m' + timeout_seconds='60'> + <method_context> + <method_credential user='root' group='root' /> + </method_context> + </exec_method> + + <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'> + resource pools framework + </loctext> + </common_name> + <documentation> + <manpage title='libpool' section='3LIB' manpath='/usr/share/man' /> + <manpage title='pooladm' section='1M' manpath='/usr/share/man' /> + <manpage title='poolbind' section='1M' manpath='/usr/share/man' /> + <manpage title='poolcfg' section='1M' manpath='/usr/share/man' /> + <manpage title='poolstat' section='1M' manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +</service_bundle> diff --git a/usr/src/cmd/pools/svc-pools b/usr/src/cmd/pools/svc-pools new file mode 100644 index 0000000000..53858cd0fd --- /dev/null +++ b/usr/src/cmd/pools/svc-pools @@ -0,0 +1,79 @@ +#!/sbin/sh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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" +# +# Method script for the pools service. +# + +. /lib/svc/share/smf_include.sh + +check_requirements () { + if [ ! -x /sbin/zonename ] || [ ! -x /usr/sbin/pooladm ] || + [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then + exit $SMF_EXIT_ERR_FATAL + fi +} + +check_requirements +case "$1" in +'start') + /usr/sbin/pooladm -e + if [ $? -ne 0 ]; then + exit $SMF_EXIT_ERR_FATAL + fi + if [ -f /etc/pooladm.conf ]; then + /usr/sbin/pooladm -c + if [ $? -ne 0 ]; then + /usr/sbin/pooladm -d + exit $SMF_EXIT_ERR_CONFIG + fi + fi + ;; +'stop') + /usr/sbin/pooladm -x + if [ $? -ne 0 ]; then + exit $SMF_EXIT_ERR_FATAL + fi + /usr/sbin/pooladm -d + if [ $? -ne 0 ]; then + exit $SMF_EXIT_ERR_FATAL + fi + ;; +'refresh') + if [ -f /etc/pooladm.conf ]; then + /usr/sbin/pooladm -c + if [ $? -ne 0 ]; then + exit $SMF_EXIT_ERR_CONFIG + fi + fi + ;; +*) + echo "Usage: $0 { start | stop | refresh}" + exit $SMF_EXIT_ERR_FATAL + ;; +esac + +exit $SMF_EXIT_OK |
