Re: TEST IDEA - Scaling with openvz [message #13552 is a reply to message #13514] |
Tue, 29 May 2007 23:02  |
kingneutron
Messages: 30 Registered: May 2007 Location: NE IL, USA
|
Member |
|
|
--Latest pseudocode update, comments/advice are welcome:
BEGIN VE 101 /etc/init.d/rc.local (PARTIAL)
# Openvz mods: 2007.0528
/bin/rm /dev/shm/THISVE
thisve=`cat /proc/user_beancounters \
|grep kmemsize \
|awk '{ print $1 }'`
thisve=${thisve//:/} # Take out the trailing ":"
echo $thisve > /dev/shm/THISVE
# source /etc/openvz/clonesetup/VARS
# If NOT "clonesetupran" then
# If THISVE > 100 AND < 1000, it is a Master Image.
# If not, consider it a clone:
# o Setup IP
# and start listening:
# sed /etc/network/interfaces
# /etc/init.d/networking restart
# cd / ; time nc -l -p $port |tar xpvf -
# > /root/log-this-somewhere.log
# After NC tarball...
# If exist /root/bin/vz-postprocess-exec (can be sent as part of the tarball),
# Source it and run it.
# Then rename it so it is not processed anymore after subsequent reboots.
# Regardless:
# mkdir -pv /etc/openvz/clonesetup
# echo 'clonesetupran=1' > /etc/openvz/clonesetup/VARS
# Else
}
kingneutron wrote on Tue, 29 May 2007 01:43 | [[
I'm pretty sure I can do this programmatically with simple Bash scripting; but is there a way in-VE to have it determine what its number is on the host? (i.e. VE 1003 should "know" it's number is 1003 somehow without having networking enabled yet.)
]]
--What I've got so far is that beancounters knows what its VE number is:
BEGIN VE 101 /etc/init.d/rc.local (PARTIAL)
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scrip
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
# Openvz mods: 2007.0528
/bin/rm /dev/shm/THISVE
thisve=`cat /proc/user_beancounters \
|grep kmemsize \
|awk '{ print $1 }'`
thisve=${thisve//:/} # Take out the trailing ":"
echo $thisve > /dev/shm/THISVE
# If THISVE < 1000, it is a Master Image.
# If not, consider it a clone:
# o Setup IP
# and start listening.
}
case "$1" in
start)
|
|
|
|