CI integration for KVMforNFV. 77/18877/9
authorswatisharma <swatix.sharma@intel.com>
Wed, 17 Aug 2016 19:32:53 +0000 (01:02 +0530)
committerswatisharma <swatix.sharma@intel.com>
Fri, 19 Aug 2016 21:21:42 +0000 (02:51 +0530)
This patch contains scripts for running cyclictest through yardstick
as part of CI integration for KVMforNFV. The scripts will be
triggered to create a docker ubuntu container for running yardstick,
configuring the host, launching a guest VM and executing cyclictest
through yardstick. The verification process gets completed after
running the cyclictest.

Co-Authored-By: Gundarapu Reddy <reddyx.gundarapu@intel.com>
Signed-off-by: Swati Sharma <swatix.sharma@intel.com>
ci/envs/cyclictest.sh [changed mode: 0644->0755]
ci/envs/guest-setup0.sh
ci/envs/host-run-qemu.sh
ci/envs/host-setup0.sh
ci/test_kvmfornfv.sh

old mode 100644 (file)
new mode 100755 (executable)
index e4dd993..c261fe0
@@ -18,6 +18,10 @@ if [ ! -f ${cyclictest_context_file} ] ; then
     exit 1
 fi
 
+#setting up of image for launching guest vm.
+sudo ssh root@10.2.117.23 "cp /root/images/guest1.qcow2 /root/"
+
 #Running cyclictest through yardstick
-yardstick task start ${cyclictest_context_file}
-mv /tmp/yardstick.out  /opt/
+yardstick -d task start ${cyclictest_context_file}
+chmod 777 /tmp/yardstick.out
+cat /tmp/yardstick.out  > /opt/yardstick.out
index 490bd57..4f9eaa4 100755 (executable)
@@ -9,27 +9,26 @@
 ###############################################################################
 
 
-rpmdir=${1:-"/root/workspace/"}
-rpmpat="kernel-4.1*.rpm"
-rpm -ihv ${rpmdir}/rt-tests-0.96-1.el7.centos.x86_64.rpm
+rpmdir=${1:-"/root/workspace/rpm"}
+rpmpat="kernel-4.4*.rpm"
 guest_isolcpus=1
 
-# The script's caller should passing the rpm directory that is built out from 
+# The script's caller should passing the rpm directory that is built out from
 # build.sh. The default rpmdir is the one used by yardstick scripts.
 install_kernel () {
     # Install the kernel rpm
     filenum=`ls -l ${rpmdir}/${rpmpat} |wc -l`
     if [ $filenum -eq 0 ]
     then
-       echo "No kernel rpm found in workspace/rpm"
-       exit 1
+        echo "No kernel rpm found in workspace/rpm"
+        exit 1
     elif [ $filenum -gt 1 ]
     then
-       echo "Multiple kernel rpm found in workspace/rpm"
-       exit 1
+        echo "Multiple kernel rpm found in workspace/rpm"
+        exit 1
     else
-       krpm=`find "${rpmdir}" -name "${rpmpat}"`
-       rpm -ihv $krpm
+        krpm=`find "${rpmdir}" -name "${rpmpat}"`
+        rpm -ihv $krpm
     fi
 }
 
index c7a2fec..487aebe 100755 (executable)
@@ -18,14 +18,20 @@ cpumask () {
 
 qmp_sock="/tmp/qmp-sock-$$"
 
-${qemu} -smp ${guest_cpus} -monitor unix:${qmp_sock},server,nowait -daemonize \
-    -cpu host,migratable=off,+invtsc,+tsc-deadline,pmu=off \
-    -realtime mlock=on -mem-prealloc -enable-kvm -m 1G \
-    -mem-path /mnt/hugetlbfs-1g \
-    -drive file=/root/workspace/image/guest.img,cache=none,aio=threads \
-    -netdev user,id=guest0,hostfwd=tcp::5555-:22 \
-    -device virtio-net-pci,netdev=guest0 \
-    -nographic -serial /dev/null -parallel /dev/null
+#${qemu} -smp ${guest_cpus} -monitor unix:${qmp_sock},server,nowait -daemonize \
+#    -cpu host,migratable=off,+invtsc,+tsc-deadline,pmu=off \
+#    -realtime mlock=on -mem-prealloc -enable-kvm -m 1G \
+#    -mem-path /mnt/hugetlbfs-1g \
+#    -drive file=/root/minimal-centos1.qcow2,cache=none,aio=threads \
+#    -netdev user,id=guest0,hostfwd=tcp:10.2.117.23:5555-:22 \
+#    -device virtio-net-pci,netdev=guest0 \
+#    -nographic -serial /dev/null -parallel /dev/null
+
+${qemu} -smp ${guest_cpus} -drive file=/root/guest1.qcow2 -daemonize \
+     -netdev user,id=net0,hostfwd=tcp:10.2.117.23:5555-:22 \
+     -realtime mlock=on -mem-prealloc -enable-kvm -m 1G \
+     -mem-path /mnt/hugetlbfs-1g \
+     -device virtio-net-pci,netdev=net0 \
 
 i=0
 for c in `echo ${host_isolcpus} | sed 's/,/ /g'` ; do
index 79d1f58..28c49b8 100755 (executable)
@@ -12,7 +12,7 @@
 source host-config
 
 rpmdir=${1:-"/root/workspace/rpm/"}
-rpmpat="kernel-4.1*.rpm"
+rpmpat="kernel-4.4*.rpm"
 
 config_grub () {
     key=$1
index 70961d7..45d1ea2 100755 (executable)
@@ -9,4 +9,46 @@
 ## and verifies the test results.
 ############################################################
 
-echo "Hello world"
+
+function env_clean {
+    container_id=`sudo docker ps -a | grep kvmfornfv |awk '{print $1}'`
+    sudo docker rm $container_id
+    sudo ssh root@10.2.117.23 "rm -rf /root/workspace/*"
+    sudo ssh root@10.2.117.23 "pid=\$(ps aux | grep 'qemu' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
+    sudo rm -rf /tmp/kvmtest-*
+}
+
+#Cleaning up the test environment before running cyclictest through yardstick.
+env_clean
+
+time_stamp=$(date +%Y%m%d%H%M%S)
+volume=/tmp/kvmtest-${time_stamp}
+mkdir -p $volume/{image,rpm,scripts}
+
+#copying required files to run yardstick cyclic testcase
+mv $WORKSPACE/build_output/kernel-4.4*.rpm $volume/rpm
+cp -r $WORKSPACE/ci/envs/* $volume/scripts
+cp -r $WORKSPACE/tests/cyclictest-node-context.yaml $volume
+cp -r $WORKSPACE/tests/pod.yaml $volume
+
+#Launching ubuntu docker container to run yardstick
+sudo docker run -i -v $volume:/opt --net=host --name kvmfornfv \
+kvmfornfv:latest  /bin/bash -c "cd /opt/scripts && ls; ./cyclictest.sh"
+
+#Verifying the results of cyclictest
+result=`grep -o '"errors":[^,]*' $volume/yardstick.out | awk -F '"' '{print $4}'`
+
+if [ -z "$result" ]; then
+    echo "####################################################"
+    echo ""
+    echo `grep -o '"data":[^}]*' $volume/yardstick.out | awk -F '{' '{print $2}'`
+    echo ""
+    echo "####################################################"
+    env_clean
+    exit 0
+else
+    echo "Testcase failed"
+    echo `grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
+    env_clean
+    exit 1
+fi