summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenedikt Boehm <hollow@gentoo.org>2006-09-06 13:50:40 +0000
committerBenedikt Boehm <hollow@gentoo.org>2006-09-06 13:50:40 +0000
commitcf2b319f917866886b68887e45284ad9c77f4bbc (patch)
tree3e0ef78a8dbcfd60eecc5351741f12aba4f0534f /vzctl/init.d
parentadd 2.0.2 patches (diff)
downloadmisc-cf2b319f917866886b68887e45284ad9c77f4bbc.tar.gz
misc-cf2b319f917866886b68887e45284ad9c77f4bbc.tar.bz2
misc-cf2b319f917866886b68887e45284ad9c77f4bbc.zip
fix VPSCONFDIR in init script; let user configure UBC for VE0; add udev rules for /dev/vzctl; fix check for /dev/vzctl
svn path=/; revision=459
Diffstat (limited to 'vzctl/init.d')
-rw-r--r--vzctl/init.d/vz.initd50
1 files changed, 34 insertions, 16 deletions
diff --git a/vzctl/init.d/vz.initd b/vzctl/init.d/vz.initd
index 665be64..9f853c4 100644
--- a/vzctl/init.d/vz.initd
+++ b/vzctl/init.d/vz.initd
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/vzctl/files/vz.initd,v 1.1 2005/09/26 15:32:35 hollow Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/vzctl/files/vz-3.0.10.initd,v 1.2 2006/07/09 10:29:24 phreak Exp $
depend() {
need net
@@ -16,9 +16,10 @@ check_config() {
: ${VZCTL:=/usr/sbin/vzctl}
: ${VZQUOTA:=/usr/sbin/vzquota}
: ${VZVEINFO:=/proc/vz/veinfo}
- : ${VPSCONFDIR:=/etc/vz}
+ : ${VPSCONFDIR:=/etc/vz/conf}
: ${PRELOAD_MODULES:="af_packet"}
: ${MODULES:="vzmon vzdquota vzdev"}
+ : ${MIGRATE_MODULES:="vzcpt vzrst"}
: ${NET_MODULES="vznetdev vznet"}
: ${VZDEV:=venet0}
: ${PARALLEL:=4}
@@ -32,16 +33,6 @@ check_config() {
return 1
fi
- # prevent dumb users from failure
- if [ ! -e /dev/vzctl ]; then
- eerror "Missing device node /dev/vzctl"
- einfo
- einfo "Please create the vzctl device node using the following command:"
- einfo " /bin/mknod /dev/vzctl c 126 0"
- einfo
- return 1
- fi
-
if [ -z "${VE0CPUUNITS}" ]; then
ewarn "VE0CPUUNITS is not set in /etc/conf.d/vz; using default value of 1000"
VE0CPUUNITS=1000
@@ -49,6 +40,20 @@ check_config() {
return 0
}
+setup_ve0() {
+ local msg ve0conf="${VPSCONFDIR}/0.conf"
+
+ msg=$(${VZCTL} set 0 --cpuunits ${VE0CPUUNITS} 2>&1)
+ [ $? -ne 0 ] && ewarn "vzctl set 0 --cpuunits ${VE0CPUUNITS} failed: ${msg}"
+
+ test -f ${ve0conf} || return
+ egrep -q '^ONBOOT=yes\|^ONBOOT=\"yes\"' ${ve0conf} || return
+
+ ebegin "Configuring hardware node UB resources: "
+ msg=$(${VZCTL} set 0 --reset_ub 2>&1)
+ eend $? ${msg}
+}
+
start_net() {
local mod
@@ -197,7 +202,7 @@ stop_ve() {
start() {
check_config || return
- local msg mod rc
+ local mod rc
ebegin "Loading OpenVZ modules"
for mod in ${PRELOAD_MODULES}; do
@@ -213,12 +218,25 @@ start() {
return ${rc}
fi
done
+
+ for mod in ${MIGRATE_MODULES}; do
+ /sbin/modprobe ${mod} >/dev/null 2>&1
+ done
eend
- start_net
+ # prevent dumb users from failure
+ if [ ! -e /dev/vzctl ]; then
+ eerror "Missing device node /dev/vzctl"
+ einfo
+ einfo "Please create the vzctl device node using the following command:"
+ einfo " /bin/mknod /dev/vzctl c 126 0"
+ einfo
+ return 1
+ fi
- msg=$(${VZCTL} set 0 --cpuunits ${VE0CPUUNITS} 2>&1)
- [ $? -ne 0 ] && ewarn "vzctl set 0 --cpuunits ${VE0CPUUNITS} failed: ${msg}"
+ start_net
+
+ setup_ve0
start_ve
}