diff options
| author | garypen <none@none> | 2005-12-06 05:07:58 -0800 |
|---|---|---|
| committer | garypen <none@none> | 2005-12-06 05:07:58 -0800 |
| commit | 26d8ba2242584067b65160d24193c37cdc83cd55 (patch) | |
| tree | 9c4dd124695bf61da8ec62bbb953a1e5878fcbc9 | |
| parent | f40ecdeb280b3d50f8821834c3268ded5874d428 (diff) | |
| download | illumos-joyent-26d8ba2242584067b65160d24193c37cdc83cd55.tar.gz | |
PSARC/2005/090 Resource pools service FMRIs
4988841 Storing the poold pid in the pools configuration is wrong
5010753 pool_start_poold() has suspicious execl invocation
5063672 Need to be able to install zones without bringing in java
6215817 poold could be an SMF service
6218168 libpool query APIs require error code clarification
6219460 poolcfg script file syntax problem with create command: cannot load configuration
6357203 poold should check for EINTR when handling signals
31 files changed, 893 insertions, 319 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 diff --git a/usr/src/lib/libpool/Makefile.com b/usr/src/lib/libpool/Makefile.com index 666d632327..76a1b880d3 100644 --- a/usr/src/lib/libpool/Makefile.com +++ b/usr/src/lib/libpool/Makefile.com @@ -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" @@ -47,7 +47,7 @@ include ../../Makefile.lib DYNFLAGS += -lxml2 LIBS = $(DYNLIB) $(LINTLIB) -LDLIBS += -lc -lnvpair -lexacct -lc +LDLIBS += -lnvpair -lexacct -lc $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) SRCDIR = ../common diff --git a/usr/src/lib/libpool/common/pool.c b/usr/src/lib/libpool/common/pool.c index a27de7fdf8..098deb9c04 100644 --- a/usr/src/lib/libpool/common/pool.c +++ b/usr/src/lib/libpool/common/pool.c @@ -97,6 +97,7 @@ #define XFER_SUCCESS PO_SUCCESS #define XFER_CONTINUE 1 +#define SMF_SVC_INSTANCE "svc:/system/pools:default" #define E_ERROR 1 /* Exit status for error */ #ifndef TEXT_DOMAIN @@ -145,7 +146,6 @@ static int pool_conf_check(const pool_conf_t *); static void free_value_list(int, pool_value_t **); static int setup_transfer(pool_conf_t *, pool_resource_t *, pool_resource_t *, uint64_t, uint64_t *, uint64_t *); -static int pool_start_poold(void); /* * Return the "static" location string for libpool. @@ -709,70 +709,9 @@ pool_get_status(int *state) } int -pool_start_poold() -{ - pool_value_t val = POOL_VALUE_INITIALIZER; - pool_conf_t *conf; - pool_elem_t *pe; - pid_t pid; - - switch (pid = fork()) { - case 0: - /* - * Become a child of init. - */ - switch (fork()) { - case 0: - break; - case -1: - dprintf("poold fork failed %d\n", errno); - pool_seterror(POE_SYSTEM); - return (PO_FAIL); - default: - exit(0); - break; - } - - /* - * Store the pid as a property - */ - conf = pool_conf_alloc(); - (void) pool_conf_open(conf, - pool_dynamic_location(), PO_RDWR); - pe = pool_conf_to_elem(conf); - pool_value_set_int64(&val, getpid()); - (void) pool_put_property(conf, pe, - "system.poold.pid", &val); - (void) pool_conf_commit(conf, 0); - (void) pool_conf_close(conf); - pool_conf_free(conf); - (void) setsid(); - (void) fclose(stdin); - (void) fclose(stdout); - (void) fclose(stderr); - if (execl("/usr/lib/pool/poold", "usr/lib/pool/poold", NULL) < - 0) { - dprintf("poold exec() failed (errno %d)\n", errno); - pool_seterror(POE_SYSTEM); - exit(E_ERROR); - } - break; - case -1: - dprintf("poold fork failed %d\n", errno); - pool_seterror(POE_SYSTEM); - return (PO_FAIL); - default: - (void) waitpid(pid, NULL, 0); - break; - } - return (PO_SUCCESS); -} - -int pool_set_status(int state) { int old_state; - int64_t pid; if (pool_get_status(&old_state) != PO_SUCCESS) { pool_seterror(POE_SYSTEM); @@ -783,24 +722,32 @@ pool_set_status(int state) int fd; pool_status_t status; - if (state == 0) { - pool_value_t val = POOL_VALUE_INITIALIZER; - pool_conf_t *conf; - pool_elem_t *pe; - - conf = pool_conf_alloc(); - (void) pool_conf_open(conf, pool_dynamic_location(), - PO_RDWR); - pe = pool_conf_to_elem(conf); - if (pool_get_property(conf, pe, "system.poold.pid", - &val) != POC_INVAL && pool_value_get_int64(&val, - &pid) == PO_SUCCESS) { - (void) kill((pid_t)pid, SIGTERM); - (void) pool_rm_property(conf, pe, - "system.poold.pid"); + /* + * Changing the status of pools is performed by enabling + * or disabling the pools service instance. If this + * function has not been invoked by startd then we simply + * enable/disable the service and return success. + * + * There is no way to specify that state changes must be + * synchronous using the library API as yet, so we use + * the -s option provided by svcadm. + */ + if (getenv("SMF_FMRI") == NULL) { + FILE *p; + if (state) { + char *cmd = "/usr/sbin/svcadm enable -st " \ + SMF_SVC_INSTANCE; + if ((p = popen(cmd, "w")) == NULL || + pclose(p) != 0) + return (PO_FAIL); + } else { + char *cmd = "/usr/sbin/svcadm disable -st " \ + SMF_SVC_INSTANCE; + if ((p = popen(cmd, "w")) == NULL || + pclose(p) != 0) + return (PO_FAIL); } - (void) pool_conf_close(conf); - pool_conf_free(conf); + return (PO_SUCCESS); } if ((fd = open(pool_dynamic_location(), O_RDWR | O_EXCL)) < 0) { @@ -818,38 +765,6 @@ pool_set_status(int state) (void) close(fd); - /* - * Start/Stop poold. - */ - if (state) { - return (pool_start_poold()); - } - } else { - if (state) { - pool_value_t val = POOL_VALUE_INITIALIZER; - pool_conf_t *conf; - pool_elem_t *pe; - int ret = PO_SUCCESS; - - conf = pool_conf_alloc(); - (void) pool_conf_open(conf, pool_dynamic_location(), - PO_RDWR); - pe = pool_conf_to_elem(conf); - if (pool_get_property(conf, pe, "system.poold.pid", - &val) != POC_INVAL && pool_value_get_int64(&val, - &pid) == PO_SUCCESS) - if (kill((pid_t)pid, SIGHUP) < 0) { - (void) pool_rm_property(conf, pe, - "system.poold.pid"); - (void) pool_conf_close(conf); - pool_conf_free(conf); - ret = pool_start_poold(); - } else { - (void) pool_conf_close(conf); - pool_conf_free(conf); - } - return (ret); - } } return (PO_SUCCESS); } @@ -1801,7 +1716,6 @@ pool_get_pool(const pool_conf_t *conf, const char *name) } rs = pool_query_pools(conf, &size, props); if (rs == NULL) { /* Can't find a pool to match the name */ - pool_seterror(POE_BADPARAM); return (NULL); } if (size != 1) { @@ -1834,12 +1748,10 @@ pool_query_pools(const pool_conf_t *conf, uint_t *size, pool_value_t **props) } rs = pool_exec_query(conf, NULL, NULL, PEC_QRY_POOL, props); if (rs == NULL) { - pool_seterror(POE_BADPARAM); return (NULL); } if ((*size = pool_rs_count(rs)) == 0) { (void) pool_rs_close(rs); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } if ((result = malloc(sizeof (pool_t *) * (*size + 1))) == NULL) { @@ -1912,7 +1824,6 @@ pool_get_resource(const pool_conf_t *conf, const char *sz_type, free_char_buf(cb); rs = pool_query_resources(conf, &size, props); if (rs == NULL) { - pool_seterror(POE_BADPARAM); return (NULL); } if (size != 1) { @@ -1949,12 +1860,10 @@ pool_query_resources(const pool_conf_t *conf, uint_t *size, rs = pool_exec_query(conf, NULL, NULL, PEC_QRY_RES, props); if (rs == NULL) { - pool_seterror(POE_BADPARAM); return (NULL); } if ((*size = pool_rs_count(rs)) == 0) { (void) pool_rs_close(rs); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } if ((result = malloc(sizeof (pool_resource_t *) * (*size + 1))) @@ -2617,12 +2526,10 @@ pool_query_pool_resources(const pool_conf_t *conf, const pool_t *pp, rs = pool_exec_query(conf, pe, "res", PEC_QRY_RES, props); if (rs == NULL) { - pool_seterror(POE_BADPARAM); return (NULL); } if ((*size = pool_rs_count(rs)) == 0) { (void) pool_rs_close(rs); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } if ((result = malloc(sizeof (pool_resource_t *) * (*size + 1))) @@ -2694,12 +2601,10 @@ pool_query_resource_components(const pool_conf_t *conf, rs = pool_exec_query(conf, pe, NULL, PEC_QRY_COMP, props); if (rs == NULL) { - pool_seterror(POE_BADPARAM); return (NULL); } if ((*size = pool_rs_count(rs)) == 0) { (void) pool_rs_close(rs); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } if ((result = malloc(sizeof (pool_component_t *) * (*size + 1))) diff --git a/usr/src/lib/libpool/common/pool_kernel.c b/usr/src/lib/libpool/common/pool_kernel.c index 7acfe95fd4..f84d6f2ba5 100644 --- a/usr/src/lib/libpool/common/pool_kernel.c +++ b/usr/src/lib/libpool/common/pool_kernel.c @@ -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. */ @@ -1357,6 +1357,8 @@ pool_knl_exec_query(const pool_conf_t *conf, const pool_elem_t *src, } else dict_map(prov->pkc_elements, build_result_set, &qo); + if (rs->pkr_count == 0) + pool_seterror(POE_INVALID_SEARCH); return ((pool_result_set_t *)rs); } diff --git a/usr/src/lib/libpool/common/pool_xml.c b/usr/src/lib/libpool/common/pool_xml.c index f5309d5174..31cbe2add0 100644 --- a/usr/src/lib/libpool/common/pool_xml.c +++ b/usr/src/lib/libpool/common/pool_xml.c @@ -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. */ @@ -2141,7 +2141,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_SYSTEM, props, cb, PO_TRUE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2149,7 +2148,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_POOL, props, cb, PO_TRUE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2158,7 +2156,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, PEC_RES_COMP, props, cb, PO_TRUE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } else if ((classes & PEC_QRY_RES_AGG) != 0) { @@ -2166,7 +2163,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, PEC_RES_AGG, props, cb, PO_TRUE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2186,7 +2182,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_SYSTEM, props, cb, PO_FALSE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2194,7 +2189,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_POOL, props, cb, PO_FALSE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2202,7 +2196,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_RES_COMP, props, cb, PO_FALSE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2210,7 +2203,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_RES_AGG, props, cb, PO_FALSE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2218,7 +2210,6 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, if (pool_build_xpath_buf(prov, src, PEC_COMP, props, cb, PO_FALSE) == PO_FAIL) { free_char_buf(cb); - pool_seterror(POE_INVALID_SEARCH); return (NULL); } } @@ -2255,6 +2246,8 @@ pool_xml_exec_query(const pool_conf_t *conf, const pool_elem_t *src, /* * Generate the result set and wrap the results as pool_elem_t */ + if (rs->pxr_path->nodesetval->nodeNr == 0) + pool_seterror(POE_INVALID_SEARCH); return ((pool_result_set_t *)rs); } @@ -2392,6 +2385,7 @@ pool_build_xpath_buf(pool_xml_connection_t *prov, const pool_elem_t *src, break; default: free(type_prefix); + pool_seterror(POE_INVALID_SEARCH); return (PO_FAIL); } if (last_prop_name != NULL) { diff --git a/usr/src/pkgdefs/Makefile b/usr/src/pkgdefs/Makefile index 1852a8cf8b..c08f161205 100644 --- a/usr/src/pkgdefs/Makefile +++ b/usr/src/pkgdefs/Makefile @@ -251,6 +251,7 @@ COMMON_SUBDIRS= \ SUNWpl5u \ SUNWpl5v \ SUNWpool \ + SUNWpoold \ SUNWpoolr \ SUNWppm \ SUNWpppd \ diff --git a/usr/src/pkgdefs/SUNWpool/depend b/usr/src/pkgdefs/SUNWpool/depend index 0c07cdcd5e..76f3951c15 100644 --- a/usr/src/pkgdefs/SUNWpool/depend +++ b/usr/src/pkgdefs/SUNWpool/depend @@ -1,6 +1,3 @@ -#pragma ident "%Z%%M% %I% %E% SMI" -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. # # CDDL HEADER START # @@ -23,6 +20,11 @@ # CDDL HEADER END # # +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # This package information file defines software dependencies associated # with the pkg. You can define three types of pkg dependencies with this file: # P indicates a prerequisite for installation @@ -39,6 +41,5 @@ # <type> <pkg.abbr> <name> # ... P SUNWcsl Core Solaris, (Shared Libs) -P SUNWj5rt JDK 1.5 runtime environment P SUNWlxml The XML library P SUNWpoolr Resource Pools (Root) diff --git a/usr/src/pkgdefs/SUNWpool/prototype_com b/usr/src/pkgdefs/SUNWpool/prototype_com index c83bc59691..9c4558f6ee 100644 --- a/usr/src/pkgdefs/SUNWpool/prototype_com +++ b/usr/src/pkgdefs/SUNWpool/prototype_com @@ -20,10 +20,10 @@ # 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. # -#pragma ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package @@ -62,18 +62,6 @@ d none usr/sbin 755 root bin f none usr/sbin/pooladm 555 root bin f none usr/sbin/poolcfg 555 root bin f none usr/sbin/poolbind 555 root bin -d none usr/lib/pool 755 root bin -f none usr/lib/pool/poold 555 root bin -f none usr/lib/pool/libjkstat.so.1 755 root bin -s none usr/lib/pool/libjkstat.so=./libjkstat.so.1 -f none usr/lib/pool/libjlgrp.so.1 755 root bin -s none usr/lib/pool/libjlgrp.so=./libjlgrp.so.1 -f none usr/lib/pool/libjpool.so.1 755 root bin -s none usr/lib/pool/libjpool.so=./libjpool.so.1 -f none usr/lib/pool/libjsyslog.so.1 755 root bin -s none usr/lib/pool/libjsyslog.so=./libjsyslog.so.1 -f none usr/lib/pool/JPool.jar 444 root bin -f none usr/lib/pool/poold.properties 444 root bin d none usr/share 755 root sys d none usr/share/lib 755 root sys d none usr/share/lib/xml 755 root sys diff --git a/usr/src/pkgdefs/SUNWpoold/Makefile b/usr/src/pkgdefs/SUNWpoold/Makefile new file mode 100644 index 0000000000..a4c95af71e --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/Makefile @@ -0,0 +1,37 @@ +# +# 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. +# +#pragma ident "%Z%%M% %I% %E% SMI" +# + +include ../Makefile.com + +.KEEP_STATE: + +all: $(FILES) depend preremove + +install: all pkg + +include ../Makefile.targ + diff --git a/usr/src/pkgdefs/SUNWpoold/depend b/usr/src/pkgdefs/SUNWpoold/depend new file mode 100644 index 0000000000..b4c33ee5ef --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/depend @@ -0,0 +1,44 @@ +# +# 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. +# +#pragma ident "%Z%%M% %I% %E% SMI" +# +# This package information file defines software dependencies associated +# with the pkg. You can define three types of pkg dependencies with this file: +# P indicates a prerequisite for installation +# I indicates an incompatible package +# R indicates a reverse dependency +# <pkg.abbr> see pkginfo(4), PKG parameter +# <name> see pkginfo(4), NAME parameter +# <version> see pkginfo(4), VERSION parameter +# <arch> see pkginfo(4), ARCH parameter +# <type> <pkg.abbr> <name> +# (<arch>)<version> +# (<arch>)<version> +# ... +# <type> <pkg.abbr> <name> +# ... +P SUNWcsl Core Solaris, (Shared Libs) +P SUNWj5rt JDK 1.5 runtime environment +P SUNWpoolr Resource Pools (Root) +P SUNWpool Resource Pools diff --git a/usr/src/pkgdefs/SUNWpoold/pkginfo.tmpl b/usr/src/pkgdefs/SUNWpoold/pkginfo.tmpl new file mode 100644 index 0000000000..53a8a076de --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/pkginfo.tmpl @@ -0,0 +1,55 @@ +# +# 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" +# +# This required package information file describes characteristics of the +# package, such as package abbreviation, full package name, package version, +# and package architecture. +# +PKG="SUNWpoold" +NAME="Dynamic Resource Pools" +ARCH="ISA" +VERSION="ONVERS,REV=0.0.0" +SUNW_PRODNAME="SunOS" +SUNW_PRODVERS="RELEASE/VERSION" +SUNW_PKGTYPE="usr" +MAXINST="1000" +CATEGORY="system" +DESC="core software for dynamic resource pools" +VENDOR="Sun Microsystems, Inc." +HOTLINE="Please contact your local service provider" +EMAIL="" +CLASSES="none" +BASEDIR=/ +SUNW_PKGVERS="1.0" +SUNW_PKG_ALLZONES="true" +SUNW_PKG_HOLLOW="false" +#VSTOCK="<reserved by Release Engineering for package part #>" +#ISTATES="<developer defined>" +#RSTATES='<developer defined>' +#ULIMIT="<developer defined>" +#ORDER="<developer defined>" +#PSTAMP="<developer defined>" +#INTONLY="<developer defined>" diff --git a/usr/src/pkgdefs/SUNWpoold/preremove b/usr/src/pkgdefs/SUNWpoold/preremove new file mode 100644 index 0000000000..2003e458c9 --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/preremove @@ -0,0 +1,41 @@ +# +# 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. +# +#pragma ident "%Z%%M% %I% %E% SMI" + +# +# Make sure that dynamic pools are not enabled before removing this package. +# +if [ "${PKG_INSTALL_ROOT:-/}" = "/" ]; then + if [ -x /usr/bin/svcs ]; then + STATE=`/usr/bin/svcs -Ho STA svc:/system/pools/dynamic` + if [ $? -eq 0 ]; then + if [ "$STATE" != "DIS" ]; then + echo "ERROR: unable to remove package" \ + "while dynamic pools are enabled." + exit 1 + fi + fi + fi +fi diff --git a/usr/src/pkgdefs/SUNWpoold/prototype_com b/usr/src/pkgdefs/SUNWpoold/prototype_com new file mode 100644 index 0000000000..846aa2daa4 --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/prototype_com @@ -0,0 +1,60 @@ +# +# 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. +# +#pragma ident "%Z%%M% %I% %E% SMI" +# +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment + +# packaging files +i pkginfo +i copyright +i depend +i preremove +# +# source locations relative to the prototype file +# +# SUNWpoold +# +d none usr 755 root sys +d none usr/lib 755 root bin +d none usr/lib/pool 755 root bin +f none usr/lib/pool/poold 555 root bin +f none usr/lib/pool/libjkstat.so.1 755 root bin +s none usr/lib/pool/libjkstat.so=./libjkstat.so.1 +f none usr/lib/pool/libjlgrp.so.1 755 root bin +s none usr/lib/pool/libjlgrp.so=./libjlgrp.so.1 +f none usr/lib/pool/libjpool.so.1 755 root bin +s none usr/lib/pool/libjpool.so=./libjpool.so.1 +f none usr/lib/pool/libjsyslog.so.1 755 root bin +s none usr/lib/pool/libjsyslog.so=./libjsyslog.so.1 +f none usr/lib/pool/JPool.jar 444 root bin +f none usr/lib/pool/poold.properties 444 root bin diff --git a/usr/src/pkgdefs/SUNWpoold/prototype_i386 b/usr/src/pkgdefs/SUNWpoold/prototype_i386 new file mode 100644 index 0000000000..502f31cc06 --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/prototype_i386 @@ -0,0 +1,46 @@ +# +# 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" +# +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment +# +# Include ISA independent files (prototype_com) +# +!include prototype_com +# +# List files which are i386 specific here +# +# source locations relative to the prototype file +# +# SUNWpoold +# diff --git a/usr/src/pkgdefs/SUNWpoold/prototype_sparc b/usr/src/pkgdefs/SUNWpoold/prototype_sparc new file mode 100644 index 0000000000..28fb112ebc --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoold/prototype_sparc @@ -0,0 +1,46 @@ +# +# 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" +# +# This required package information file contains a list of package contents. +# The 'pkgmk' command uses this file to identify the contents of a package +# and their location on the development machine when building the package. +# Can be created via a text editor or through use of the 'pkgproto' command. + +#!search <pathname pathname ...> # where to find pkg objects +#!include <filename> # include another 'prototype' file +#!default <mode> <owner> <group> # default used if not specified on entry +#!<param>=<value> # puts parameter in pkg environment +# +# Include ISA independent files (prototype_com) +# +!include prototype_com +# +# List files which are SPARC specific here +# +# source locations relative to the prototype file +# +# SUNWpoold +# diff --git a/usr/src/pkgdefs/SUNWpoolr/Makefile b/usr/src/pkgdefs/SUNWpoolr/Makefile index 4942e4f6f6..7ddbe5ba2a 100644 --- a/usr/src/pkgdefs/SUNWpoolr/Makefile +++ b/usr/src/pkgdefs/SUNWpoolr/Makefile @@ -20,7 +20,7 @@ # 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. # #pragma ident "%Z%%M% %I% %E% SMI" @@ -28,9 +28,13 @@ include ../Makefile.com +DATAFILES += \ + i.manifest \ + r.manifest + .KEEP_STATE: -all: $(FILES) depend preremove +all: $(FILES) depend preremove postinstall install: all pkg diff --git a/usr/src/pkgdefs/SUNWpoolr/pkginfo.tmpl b/usr/src/pkgdefs/SUNWpoolr/pkginfo.tmpl index f7ddc99a6d..e2209827ea 100644 --- a/usr/src/pkgdefs/SUNWpoolr/pkginfo.tmpl +++ b/usr/src/pkgdefs/SUNWpoolr/pkginfo.tmpl @@ -1,7 +1,4 @@ # -# 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 @@ -22,6 +19,10 @@ # # CDDL HEADER END # +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# #ident "%Z%%M% %I% %E% SMI" # # This required package information file describes characteristics of the @@ -41,7 +42,7 @@ DESC="core software for resource pools (Root)" VENDOR="Sun Microsystems, Inc." HOTLINE="Please contact your local service provider" EMAIL="" -CLASSES="none" +CLASSES="none manifest" BASEDIR=/ SUNW_PKGVERS="1.0" SUNW_PKG_ALLZONES="true" diff --git a/usr/src/pkgdefs/SUNWpoolr/postinstall b/usr/src/pkgdefs/SUNWpoolr/postinstall new file mode 100644 index 0000000000..160febc4e6 --- /dev/null +++ b/usr/src/pkgdefs/SUNWpoolr/postinstall @@ -0,0 +1,32 @@ +# +# 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" +# + +if [ -x /usr/sbin/svcadm ] && [ "$UPDATE" = yes ] && + [ -f /etc/pooladm.conf ]; then + echo "/usr/sbin/svcadm enable svc:/system/pools" >> \ + $BASEDIR/var/svc/profile/upgrade +fi diff --git a/usr/src/pkgdefs/SUNWpoolr/prototype_com b/usr/src/pkgdefs/SUNWpoolr/prototype_com index d1c95290ed..47c856d8b9 100644 --- a/usr/src/pkgdefs/SUNWpoolr/prototype_com +++ b/usr/src/pkgdefs/SUNWpoolr/prototype_com @@ -20,7 +20,7 @@ # 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. # #pragma ident "%Z%%M% %I% %E% SMI" @@ -39,11 +39,24 @@ i pkginfo i copyright i depend +i postinstall i preremove # # source locations relative to the prototype file # # SUNWpoolr # +d none lib 755 root bin +d none lib/svc 0755 root bin +d none lib/svc/method 0755 root bin +f none lib/svc/method/svc-poold 555 root bin +f none lib/svc/method/svc-pools 555 root bin +d none var 755 root sys d none var/adm/pool 755 root sys d none var/log/pool 755 root sys +d none var/svc 755 root sys +d none var/svc/manifest 755 root sys +d none var/svc/manifest/system 755 root sys +f manifest var/svc/manifest/system/poold.xml 444 root sys +f manifest var/svc/manifest/system/pools.xml 444 root sys + |
