[Fusionforge-commits] r10930 - trunk/tests/scripts

Christian Bayle cbayle at libremir.placard.fr.eu.org
Sun Oct 10 21:26:36 CEST 2010


Author: cbayle
Date: 2010-10-10 21:26:36 +0200 (Sun, 10 Oct 2010)
New Revision: 10930

Modified:
   trunk/tests/scripts/start_vz.sh
Log:
Start alternate vm if none is declared


Modified: trunk/tests/scripts/start_vz.sh
===================================================================
--- trunk/tests/scripts/start_vz.sh	2010-10-10 19:26:29 UTC (rev 10929)
+++ trunk/tests/scripts/start_vz.sh	2010-10-10 19:26:36 UTC (rev 10930)
@@ -1,13 +1,31 @@
 #!/bin/sh
 
-sudo /root/start_vz.sh centos-5-x86 "$1"
+VZHOST=$1
+if sudo /root/start_vz.sh centos-5-x86 "$1"
+then
+	echo "VM Started"
+else
+	pwd
+	. ../openvz/config.default
+	if [ -f ../openvz/config.`hostname` ]
+	then
+		. ../openvz/config.`hostname`
+	fi
+	ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
+	sudo /usr/sbin/vzctl create $VEIDCEN --private $VZPRIVATEDIR/$VEIDCEN --ostemplate centos-$CENTVERS-$ARCH-minimal
+	sudo /usr/sbin/vzctl start $VEIDCEN
+	VZHOST=$IPCENTOSBASE.$VEIDCEN
+	export VZHOST
+	sudo /usr/sbin/vzctl set $VEIDCEN --ipadd $IPCENTOSBASE.$VEIDCEN --save
+        sudo /usr/sbin/vzctl set $VEIDCEN --nameserver $IPCENTOSDNS --save
+fi
 
-ssh -o 'StrictHostKeyChecking=no' "root@$1" uname -a
+ssh -o 'StrictHostKeyChecking=no' "root@$VZHOST" uname -a
 ret=$?
 
 if [ $ret -ne 0 ];then
 	sleep 10;
-	ssh -o 'StrictHostKeyChecking=no' "root@$1" uname -a
+	ssh -o 'StrictHostKeyChecking=no' "root@$VZHOST" uname -a
 fi
 
 sleep 1




More information about the Fusionforge-commits mailing list