|
root / base / usr / src / zyginit / services / resource-mgmt
resource-mgmt Plain Text 48 lines 1.4 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Resource management oneshot: enables the pools subsystem, commits
# /etc/pooladm.conf if present, and applies global-zone resource
# controls. Folds /lib/svc/manifest/system/pools.xml and
# /lib/svc/manifest/system/resource-mgmt.xml into one boot-time step.
#
# rcapd (resource capping daemon) is its own service — see rcapd.toml.
[service]
name = "resource-mgmt"
description = "Resource pools and global-zone controls"
type = "oneshot"
[exec]
start = "/etc/zyginit/services/resource-mgmt/start.sh"
stop  = "/etc/zyginit/services/resource-mgmt/stop.sh"
[dependencies]
requires = ["filesystem"]
[restart]
on = "never"
#!/bin/sh
# Enable resource pools, commit config if present, apply global-zone
# resource controls. Skip pieces whose binaries aren't installed
# (resource pools is optional in zyginit deployments).
set -e

if [ -x /usr/sbin/pooladm ]; then
    /usr/sbin/pooladm -e
    if [ -f /etc/pooladm.conf ]; then
        /usr/sbin/pooladm -c || {
            /usr/sbin/pooladm -d
            /bin/echo "pooladm -c failed; pools subsystem disabled" >&2
            exit 1
        }
    fi
fi

# Apply global-zone resource controls (was the resource-mgmt oneshot).
if [ -x /usr/sbin/zoneadm ] && [ -f /etc/zones/global.xml ]; then
    /usr/sbin/zoneadm -z global apply
fi

exit 0
#!/bin/sh
# Tear down pools subsystem.
if [ -x /usr/sbin/pooladm ]; then
    /usr/sbin/pooladm -x 2>/dev/null
    /usr/sbin/pooladm -d 2>/dev/null
fi
exit 0