727ba1574797fc6ff2f79fd535835995c28ab7cd
[kvmfornfv.git] / ci / envs / host-config
1 #!/bin/bash
2
3 ##############################################################################
4 ## Copyright (c) 2015 Intel Corp.
5 ##
6 ## All rights reserved. This program and the accompanying materials
7 ## are made available under the terms of the Apache License, Version 2.0
8 ## which accompanies this distribution, and is available at
9 ## http://www.apache.org/licenses/LICENSE-2.0
10 ###############################################################################
11
12 # Number of huge pages to create and on which NUMA node
13 numa_node=1
14 huge_pages=2
15
16 # QEMU executable path and number of cpus for guest
17 qemu=/usr/local/bin/qemu-system-x86_64
18 guest_cpus=2
19 pcm_memory=/root/pcm/pcm-memory.x
20
21 # Isolated cpus for nfv, must be given as a range '-' and Numa node1 CPU's should be considered
22 host_isolcpus=`lscpu | grep "NUMA node1 CPU(s)"| awk -F ':' '{print \$2}' | sed 's/[[:space:]]//g'`
23 first=$(echo ${host_isolcpus} | cut -f1 -d-)
24 last=$(echo ${host_isolcpus} | cut -f2 -d-)
25
26 # Bind cpus from host_isolcpus range for QEMU processor threads
27 i=0
28 while [ ${i} -lt ${guest_cpus} ]; do
29  qemu_cpu[$i]=${first}
30  i=`expr $i + 1`
31  first=`expr $first + 1`
32 done
33
34 #Isolated cpus from host_isolcpus range to run Stress tool
35 stress_isolcpus=${first}-${last}
36 echo "Stress tool runs on $stress_isolcpus"
37
38 #Tar the log files generated during testcase execution and exit.
39 function test_exit {
40    exitCode=$1
41    cd $WORKSPACE/build_output/
42    if [ -d log ];then
43       tar -czvf log-$(date -u +"%Y-%m-%d_%H-%M-%S").tar.gz log
44    fi
45    exit $exitCode
46 }
47
48 function copyLogs {
49    echo "Copying Log files from Node to Jump Server"
50    sudo ssh root@${HOST_IP} "cd /root;tar -czvf MBWInfo.tar.gz MBWInfo"
51    mkdir -p $WORKSPACE/build_output/log/MBWInfo
52    scp root@${HOST_IP}:/root/MBWInfo.tar.gz $WORKSPACE/build_output/log/MBWInfo
53    echo "Listing all the logs collected"
54    cd $WORKSPACE;ls build_output/log/MBWInfo;
55    sudo ssh root@${HOST_IP} "cd /root;rm -rf MBWInfo MBWInfo.tar.gz"
56 }
57