Automated test lanucher has been added.
Run a bunch of test that create vm, configure it,
run test and clean allocated resources.
diff --git a/scripts/run_vm.sh b/scripts/run_vm.sh
index f93e475..94a39ea 100644
--- a/scripts/run_vm.sh
+++ b/scripts/run_vm.sh
@@ -1,21 +1,21 @@
#!/bin/bash
MASTER_IP=$1
FUEL_PASSWD=$2
+NEW_IP=$3
+VM_NAME=disk-io-test
# VM_IP=$(nova floating-ip-create "$FLOATIN_NET" | grep "$FLOATIN_NET" | awk '{print $2}')
-VM_IP=172.16.53.16
-OS_ORIGIN_IP=192.168.0.2
-OS_EXT_IP=172.16.53.2
-VM_NAME=koder-disk-test
+VM_IP=172.16.55.14
+OS_ORIGIN_IP=10.20.0.129
+OS_EXT_IP=172.16.53.66
-# FIXED_NET_NAME="net04"
-FIXED_NET_NAME="novanetwork"
+
+
+FIXED_NET_NAME="net04"
FLOATING_NET="net04_ext"
-# my_dir="$(dirname "$0")"
-# source "$my_dir/config.sh"
-source config.sh
-
+my_dir="$(dirname -- "$0")"
+source "$my_dir/config.sh"
SSH_OVER_MASTER="sshpass -p${FUEL_PASSWD} ssh root@${MASTER_IP}"
VOLUME_NAME="test-volume"
VOLUME_SIZE=20
@@ -25,35 +25,55 @@
function get_openrc() {
OPENRC=`tempfile`
CONTROLLER_NODE=$($SSH_OVER_MASTER fuel node | grep controller | awk '-F|' '{gsub(" ", "", $5); print $5}')
- $SSH_OVER_MASTER ssh $CONTROLLER_NODE cat openrc 2>/dev/null | sed "s/$OS_ORIGIN_IP/$OS_EXT_IP/g" > $OPENRC
+ $SSH_OVER_MASTER ssh $CONTROLLER_NODE cat openrc 2>/dev/null | \
+ sed -r 's/(\b[0-9]{1,3}\.){3}[0-9]{1,3}\b'/$NEW_IP/ > $OPENRC
echo $OPENRC
}
function wait_vm_active() {
vm_state="none"
- vm_name=$1
+ vm_name=$VM_NAME
+ counter=0
- while [ "$vm_state" != "ACTIVE" ] ; do
+ while [ $vm_state != "ACTIVE" ] ; do
sleep 1
vm_state=$(nova list | grep $vm_name | awk '{print $6}')
+ counter=$((counter + 1))
+
+ if [ $counter -eq $TIMEOUT ]
+ then
+ echo "Time limit exceed"
+ break
+ fi
done
}
function boot_vm() {
FIXED_NET_ID=$(nova net-list | grep "\b${FIXED_NET_NAME}\b" | awk '{print $2}')
- VOL_ID=$(cinder create --display-name $VOLUME_NAME $VOLUME_SIZE | grep '\bid\b' | awk '{print $4}')
+ VOL_ID=$(cinder create --display-name $VOLUME_NAME $VOLUME_SIZE | grep '\bid\b' | grep available | awk '{print $4}')
+
+ if [ -z $VOL_ID ]; then
+ VOL_ID=$(cinder list | grep test-volume | grep available| awk '{print $2}'| head -1)
+ fi
+
nova boot --flavor "$FLAVOR_NAME" --image "$IMAGE_NAME" --key-name "$KEYPAIR_NAME" --security-groups default --nic net-id=$FIXED_NET_ID $VM_NAME >/dev/null
wait_vm_active $VM_NAME
nova floating-ip-associate $VM_NAME $VM_IP
+
nova volume-attach $VM_NAME $VOL_ID $VOLUME_DEVICE >/dev/null
+ echo $VOL_ID
}
function prepare_vm() {
scp -i "$KEY_FILE_NAME" -r ../io_scenario ubuntu@${VM_IP}:/tmp >/dev/null
+ echo "Copy io scenario folded"
scp -i "$KEY_FILE_NAME" $DEBS ubuntu@${VM_IP}:/tmp >/dev/null
+ echo "Copy DEBS packages"
scp -i "$KEY_FILE_NAME" single_node_test_short.sh ubuntu@${VM_IP}:/tmp >/dev/null
+ echo "Copy single_node_test_short"
ssh -i "$KEY_FILE_NAME" ubuntu@${VM_IP} sudo dpkg -i $DEBS >/dev/null
+ echo "dpkg on vm"
}
function prepare_node() {