summaryrefslogtreecommitdiffstats
path: root/ci/envs
diff options
context:
space:
mode:
authorshravani <shravani.p@tcs.com>2017-01-05 18:36:26 +0530
committerShravani Paladugula <shravani.p@tcs.com>2017-02-07 12:24:08 +0000
commit2046178d894438b492d93f30941076ee7964f6ab (patch)
tree062cd5a9ce3d01e2f5f3d86de46bd77b7098ea82 /ci/envs
parentb79d79eb6385a92cdc8c29bf080810becc4602b7 (diff)
This patch contains the scripts to install the Qemu rpm and make use of it for
lauching guest VM's Change-Id: I74ce89e1e0d628b0be2d9165b8418a519b52064d Co-Authored-By: Y Rajitha <y.rajitha@tcs.com> Signed-off-by: Shravani <shravani.p@tcs.com>
Diffstat (limited to 'ci/envs')
-rwxr-xr-xci/envs/host-config2
-rwxr-xr-xci/envs/host-install-qemu.sh44
-rwxr-xr-xci/envs/host-run-qemu.sh1
-rwxr-xr-xci/envs/utils.sh13
4 files changed, 59 insertions, 1 deletions
diff --git a/ci/envs/host-config b/ci/envs/host-config
index a6beb06b6..0f77b7ac5 100755
--- a/ci/envs/host-config
+++ b/ci/envs/host-config
@@ -14,7 +14,7 @@ numa_node=1
huge_pages=2
# QEMU executable path and number of cpus for guest
-qemu=/usr/libexec/qemu-kvm
+qemu=/usr/local/bin/qemu-system-x86_64
guest_cpus=2
# Isolated cpus for nfv, must be given as a range '-' and Numa node1 CPU's should be considered
diff --git a/ci/envs/host-install-qemu.sh b/ci/envs/host-install-qemu.sh
new file mode 100755
index 000000000..18886ea53
--- /dev/null
+++ b/ci/envs/host-install-qemu.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+###############################################################################
+## Copyright (c) 2016 Intel Corp.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+source utils.sh
+source host-config
+
+QEMU_VERSION=$( getQemuVersion )
+
+if [ -z $QEMU_VERSION ];then
+ echo "qemu RPM not found"
+ exit 1
+fi
+rpmdir=${1:-"/root/workspace/rpm/"}
+rpmpat="qemu-${QEMU_VERSION}*.rpm"
+
+install_qemu () {
+ # Removing Existing qemu rpms
+ qemu_rpm=$(rpm -qa | grep 'qemu')
+ echo "Removing Existing qemu packages"
+ rpm -ev $qemu_rpm
+ # Install the qemu rpm
+ filenum=`ls -l ${rpmdir}/${rpmpat} |wc -l`
+ if [ $filenum -eq 0 ]
+ then
+ echo "No qemu rpm found in workspace/rpm"
+ exit 1
+ elif [ $filenum -gt 1 ]
+ then
+ echo "Multiple qemu rpm found in workspace/rpm"
+ exit 1
+ else
+ qrpm=`find "${rpmdir}" -name "${rpmpat}"`
+ rpm -ihv $qrpm
+ fi
+}
+install_qemu
diff --git a/ci/envs/host-run-qemu.sh b/ci/envs/host-run-qemu.sh
index 9cd4b45c2..389790eda 100755
--- a/ci/envs/host-run-qemu.sh
+++ b/ci/envs/host-run-qemu.sh
@@ -36,6 +36,7 @@ ${qemu} -smp ${guest_cpus} -monitor unix:${qmp_sock},server,nowait \
-realtime mlock=on -mem-prealloc -enable-kvm -m 1G \
-mem-path /mnt/hugetlbfs-1g \
-device virtio-net-pci,netdev=net0 \
+ -vnc :1
threads=`echo "info cpus" | nc -U ${qmp_sock} | grep thread_id | cut -d= -f3`
diff --git a/ci/envs/utils.sh b/ci/envs/utils.sh
index 90c66bab3..89df273ac 100755
--- a/ci/envs/utils.sh
+++ b/ci/envs/utils.sh
@@ -27,3 +27,16 @@ function getHostIP {
fi
echo $HOST_IP
}
+#Get the Qemu version from RPM generated(example:qemu-2.6.0-1.x86_64.rpm)
+function getQemuVersion {
+ rpm_dir="/root/workspace/rpm/"
+ if [ -d "$WORKSPACE" ];then
+ cd $WORKSPACE/build_output 2>/dev/null; qemuRPM=`ls qemu-[[:digit:]]* 2>/dev/null`
+ RPMVERSION=`echo ${qemuRPM}|awk -F '-' '{print $2}' | awk -F '-' '{print $NF}'`
+ elif [ -d "$rpm_dir" ];then
+ cd $rpm_dir 2>/dev/null; qemuRPM=`ls qemu-[[:digit:]]* 2>/dev/null`
+ RPMVERSION=`echo ${qemuRPM}|awk -F '-' '{print $2}' | awk -F '-' '{print $NF}'`
+ fi
+ echo ${RPMVERSION}
+}
+