tests/lxc/config.debian6 -text
tests/lxc/lxc-centos5 -text
tests/lxc/lxc-debian6 -text
+tests/lxc/start -text
tests/openvz/Makefile -text
tests/openvz/README -text
tests/openvz/interfaces.sample -text
tests/scripts/phpunit.sh -text
tests/scripts/scan_deprecated.pl -text svneol=unset#text/x-perl
tests/scripts/start_lxc.sh -text
+tests/scripts/start_vm -text
tests/scripts/start_vm.sh -text svneol=unset#text/x-sh
tests/scripts/start_vz.sh -text svneol=unset#text/x-sh
tests/scripts/stop_lxc.sh -text
DNSDOMAIN=local
DEBMIRROR=http://cdn.debian.net/debian/
DEBMIRRORSEC=http://security.debian.org/
+
+# WIP: NEW WAY TO SET CONFIG (used by new start_vm script)
+
+# The following is for static ip config
+# hostname=vmengine:template:address/mask:gateway
+vzdebian6=vz:debian6:192.168.222.105/24:192.168.222.1
+vzdebian6src=vz:debian6:192.168.222.120/24:192.168.222.1
+vzcentos5=vz:centos5:192.168.222.110/24:192.168.222.1
+vzcentos5src=vz:centos5:192.168.222.115/24:192.168.222.1
+
+debian6=lxc:debian6:192.168.222.105/24:192.168.222.1
+debian6src=lxc:debian6:192.168.222.120/24:192.168.222.1
+centos5=lxc:centos5:192.168.222.110/24:192.168.222.1
+centos5src=lxc:centos5:192.168.222.115/24:192.168.222.1
+
+# For dhcpconfig
+dhdebian6=lxc:debian6::
+dhdebian6src=lxc:debian6::
+dhcentos5=lxc:centos5::
+dhcentos5src=lxc:centos5::
--- /dev/null
+#! /bin/sh -x
+
+lxcdir=`dirname $0`/../lxc
+
+IFS=: ; VARS=`eval echo \\\$$BASEHOST` ; unset IFS ; set $VARS
+VMENGINE=$1
+TEMPLATE=$2
+CIDR=$3
+IPGW=$4
+
+if [ ! -e /usr/lib/lxc/templates/lxc-$TEMPLATE ]
+then
+ echo "/usr/lib/lxc/templates/lxc-$TEMPLATE not found"
+ echo "you need to install template"
+ echo "run: (cd $lxcdir ; sudo make)"
+else
+ tmpconf=`mktemp`
+ cat $lxcdir/config.$TEMPLATE > $tmpconf
+ if [ ! -z "$CIDR" ]
+ then
+ echo "lxc.network.ipv4 = $CIDR" >> $tmpconf
+ fi
+ # Next is a bit hacky, the only way I found to pass pubkey to the template
+ # LXC don't allow to pass extra args
+ echo "#lxc.pubkey = $SSHPUBKEY" >> $tmpconf
+ sudo /usr/bin/lxc-create -n $HOST -f $tmpconf -t $LXCTEMPLATE
+ rm -f $tmpconf
+ sudo /usr/bin/lxc-start -n $HOST -d
+fi
--- /dev/null
+#! /bin/sh
+
+usage()
+{
+ cat <<EOF
+$1 -h|--host=<hostname> -e|--engine=<vmengine> -t|--template=<templatename>
+EOF
+ return 0
+}
+
+scriptdir=`dirname $0`/../scripts
+configdir=`dirname $0`/../config
+
+# Loading default config
+if [ -f $configdir/default ]
+then
+ . $configdir/default
+else
+ echo "Something went wrong, could not find default config: $configdir/default"
+ exit 1
+fi
+
+options=`getopt -o h:e:c: -l host:,engine:,config: -- "$@"`
+if [ $? -ne 0 ]; then
+ usage `basename $0`
+ exit 1
+fi
+eval set -- "$options"
+
+while true
+do
+ case "$1" in
+ -e|--engine) VMENGINE=$2; shift 2;;
+ -h|--host) HOST=$2; shift 2;;
+ -c|--config) CONFIG=$2; shift 2;;
+ --) shift 1; break ;;
+ *) break ;;
+ esac
+done
+
+# Loading specific config
+if [ -f $configdir/`hostname` ]
+then
+ echo "Using specific config: $configdir/`hostname`"
+ . $configdir/`hostname`
+else
+ echo "Using default config"
+fi
+
+# Host can be defined by env var
+if [ -z "$HOST" ]
+then
+ echo "host not defined"
+ usage
+ exit 2
+fi
+
+BASEHOST=`echo $HOST|cut -d. -f1`
+# Config as a param
+if [ ! -z "$CONFIG" ]
+then
+ eval "$BASEHOST=$CONFIG"
+fi
+
+# Now let's look if host/engine is defined in config
+IFS=: ; VARS=`eval echo \\\$$BASEHOST` ; unset IFS ;
+if [ ! -z "$VARS" ]
+then
+ set $VARS
+ VMENGINE=$1
+ echo "$BASEHOST=`eval echo \\\$$BASEHOST`"
+ export HOST BASEHOST $BASEHOST
+fi
+export SSHPUBKEY
+
+# Here VM engine must be defined by env var
+if [ -z "$VMENGINE" ]
+then
+ if [ -z "$2" ]
+ then
+ echo "VM engine not defined"
+ usage
+ exit 3
+ fi
+fi
+
+# Start script for this engine must exist
+if [ ! -x $scriptdir/${VMENGINE}/start ]
+then
+ echo "Don't know how to run ${VMENGINE} engine"
+ echo "$scriptdir/${VMENGINE}/start not found"
+ exit 4
+else
+ $scriptdir/${VMENGINE}/start
+fi
+
+# Loop until engine is up and ssh is running
+ssh -o 'StrictHostKeyChecking=no' "root@$HOST" uname -a
+ret=$?
+for loop in 1 2 3 4 5 6 7 8 9
+do
+
+ if [ $ret -ne 0 ];then
+ echo -n $loop
+ sleep 20;
+ ssh -o 'StrictHostKeyChecking=no' "root@$HOST" uname -a
+ ret=$?
+ fi
+done
+sleep 1
+exit $ret