blob: 913d81899b02833382b21d290763816737098b68 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/bin/ksh -p
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2014 Joyent, Inc. All rights reserved.
#
#
# This file contains various hooks that are used by more than a single
# brand. This file should be included by the brand-specific files.
#
jattach_kvm_final_setup()
{
ZRAM=$(zonecfg -z ${ZONENAME} info attr name=ram | \
grep "value: " | cut -d ':' -f2 | tr -d ' ')
if [[ -z ${ZRAM} ]]; then
echo "Unable to find RAM value for KVM VM"
exit $ZONE_SUBPROC_FATAL
fi
# 100G unless the VM has 80G or more DRAM, in which case: DRAM + 20G.
CORE_QUOTA=102400
if [[ ${ZRAM} -gt 81920 ]]; then
CORE_QUOTA=$((${ZRAM} + 20480))
fi
# The cores quota exists to control run-away zones. As such we make it
# such that it will protect the system from a single run-away, but
# still allow us to get most cores.
rm -rf $ZONEPATH/cores
zfs create -o quota=${CORE_QUOTA}m -o mountpoint=/${PDS_NAME}/$bname/cores \
${PDS_NAME}/cores/$bname
}
jattach_zone_final_setup()
{
if [[ -z ${REPROVISIONING} ]]; then
# The cores quota exists to control run-away zones. As such we make it
# such that it will protect the system from a single run-away, but
# still allow us to get most cores. 100G seems good enough based on
# samples from JPC.
rm -rf $ZONEPATH/cores
CORE_QUOTA=102400
zfs create -o quota=${CORE_QUOTA}m -o mountpoint=/${PDS_NAME}/$bname/cores \
${PDS_NAME}/cores/$bname
chmod 700 $ZONEPATH
fi
egrep -s "netcfg:" $ZROOT/etc/passwd
if (( $? != 0 )); then
echo "netcfg:x:17:65:Network Configuration Admin:/:" \
>> $ZROOT/etc/passwd
echo "netcfg:*LK*:::::::" >> $ZROOT/etc/shadow
fi
egrep -s "netadm:" $ZROOT/etc/group
(( $? != 0 )) && echo "netadm::65:" >> $ZROOT/etc/group
# /etc/svc/profile needs to be a directory with some contents which we
# can get from the template. The early manifest import svc
# (lib/svc/method/manifest-import) copies some symlinks from the
# template's var/svc/profile dir and we need to make sure those are
# pointing at the right files and not left dangling.
ZPROFILE=$ZROOT/etc/svc/profile
if [ ! -d $ZPROFILE ]; then
mkdir $ZPROFILE
cp -p $ZROOT/var/svc/profile/generic_limited_net.xml $ZPROFILE
cp -p $ZROOT/var/svc/profile/inetd_generic.xml $ZPROFILE
cp -p $ZROOT/var/svc/profile/ns_dns.xml $ZPROFILE
cp -p $ZROOT/var/svc/profile/platform_none.xml $ZPROFILE
fi
touch $ZROOT/var/log/courier.log
}
|