summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gerdts <mike.gerdts@joyent.com>2018-04-09 20:15:48 +0000
committerMike Gerdts <mike.gerdts@joyent.com>2018-04-24 14:33:22 +0000
commit77b57dc55fffa7007fdcbac3f84f00c7211e2754 (patch)
treef071ac47046adf6f5b70f4407fa66547702ac1b8
parent3df640c357a71565dc0d3c32389ee6d43b0bb6b6 (diff)
downloadillumos-joyent-77b57dc55fffa7007fdcbac3f84f00c7211e2754.tar.gz
OS-6863 presetate should enforce zlog-name
-rw-r--r--usr/src/lib/brand/bhyve/zone/statechange45
1 files changed, 3 insertions, 42 deletions
diff --git a/usr/src/lib/brand/bhyve/zone/statechange b/usr/src/lib/brand/bhyve/zone/statechange
index 130b53b5e7..76cfbffc17 100644
--- a/usr/src/lib/brand/bhyve/zone/statechange
+++ b/usr/src/lib/brand/bhyve/zone/statechange
@@ -15,47 +15,8 @@
ps_brand=bhyve
-subcommand=$1
-ZONENAME=$2
-ZONEPATH=$3
-state=$4
-cmd=$5
+typeset -A FORCED_ATTRS
+FORCED_ATTRS["zlog-mode"]=g--
+FORCED_ATTRS["zlog-name"]=platform.log
-#
-# In the initial release of the bhyve brand, the platform log did not exist.
-# If zlog-mode and/or zlog-name attributes are not set in the zone's
-# configuration, this sets it and moves aside any stale zhyve.log file.
-#
-function setup_platform_log {
- if [[ -n $_ZONECFG_attr_zlog_mode && -n $_ZONECFG_attr_zlog_name ]]
- then
- return
- fi
-
- zonecfg -z "$ZONENAME" \
- "remove attr name=zlog-mode; add attr; set name=zlog-mode;" \
- "set type=string; set value=g--; end;" \
- "remove attr name=zlog-name; add attr; set name=zlog-name;" \
- "set type=string; set value=platform.log; end;"
-
- typeset logdir=$ZONEPATH/root/tmp
- (
- # exit this subshell if things aren't as expected
- set -e
- cd "$logdir"
- [[ $(pwd -P) == "$logdir" ]] || exit
- [[ -f zhyve.log ]] || exit
-
- rm -f zhyve.log.obsolete
- mv zhyve.log zhyve.log.obsolete
- )
-}
-
-if [[ $subcommand == pre && $cmd == 1 ]]; then
- setup_platform_log
-fi
-
-#
-# Now, carry on with all of the common statechange work.
-#
. /usr/lib/brand/jcommon/statechange