Speeding up start was more difficult - as it waits for result and shows its start OK for every VPS.
Now its 20s against 120s before.
Here is changed part of /etc/init.d/vz
for veid in $velist; do
[ "${veid}" = "0" ] && continue
# __echo "Starting VE ${veid}: "
if [ "x${VZFASTBOOT}" = "xyes" -a "x${DISK_QUOTA}" = "xyes" ];
then
$VZQUOTA stat ${veid} >/dev/null 2>&1
if [ $? -eq 6 ]; then
if $VZQUOTA show ${veid} 2>&1 | grep "vzquota : .....................
$VZQUOTA on ${veid} --nocheck >/dev/null
need_restart="${need_restart} ${veid}"
fi
fi
# msg=`$VZCTL start ${veid} 2>&1`
/home/openvz/scripts/vzstart ${veid} >/tmp/vzstart_${veid}.log
usleep 200000
# if [ $? -eq 0 ]; then
# print_success
# else
# print_failure "$msg"
# fi
done
sleep 4
for veid in $velist; do
__echo "Starting VE ${veid}: "
msg="`cat /tmp/vzstart_${veid}.log`"
if [ ! -z "`echo \"$msg\"| grep SUCCESS`" ]; then
print_success
else
print_failure "$msg"
fi
done
for veid in ${need_restart}; do
__echo "Stopping VE ${veid}: "
.................
/home/openvz/scripts/vzstart is
#!/bin/sh
sudo vzctl start $1
if [ $? -eq 0 ];then
echo SUCCESS
Had to write auxilluary script for tracking this status.
Also found out that need some interval between VPSs start anyway, cause simultaneous mounts give error for me(may be its only for loopback device mount ). Should make interval 0.2 s, less is not good + sleep 4 (must be more then single vps start duration) after starting to make sure all starts finished with log files and its ok to read status.
Actually it starts even faster then 20s - because "sleep 4" necessary only because of VPSs which launched last and because print_success function has its own sleep.