aboutsummaryrefslogtreecommitdiffstats
path: root/tools/vsperf-img-modify.sh
blob: 3ba697c00e3e1d1fe8df6993171abe41ad51e209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight 
#!/bin/bash
##############################################################################
# Copyright (c) 2017 Nokia
#
# 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
##############################################################################

# installs required packages
# must be run from inside the image (either chrooted or running)

set -ex

if [ $# -eq 1 ]; then
    nameserver_ip=$1

    # /etc/resolv.conf is a symbolic link to /run, restore at end
    rm /etc/resolv.conf
    echo "nameserver $nameserver_ip" > /etc/resolv.conf
    echo "nameserver 8.8.8.8" >> /etc/resolv.conf
    echo "nameserver 8.8.4.4" >> /etc/resolv.conf
fi

# Force apt to use ipv4 due to build problems on LF POD.
echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4

echo 'GRUB_CMDLINE_LINUX="resume=/dev/sda1 default_hugepagesz=1G hugepagesz=1G hugepages=32 iommu=on iommu=pt intel_iommu=on"' >> /etc/default/grub

# Add hostname to /etc/hosts.
# Allow console access via pwd
cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
manage_etc_hosts: True
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
EOF

linuxheadersversion=`echo ls boot/vmlinuz* | cut -d- -f2-`

apt-get update
apt-get install -y \
    linux-headers-$linuxheadersversion \
    screen \
    locate \
    sshpass \
    git

cd /root
git clone -b stable/danube https://gerrit.opnfv.org/gerrit/vswitchperf

# do not compile ovs and qemu
sed -i.bak -e 's/^\(SUBBUILDS\ =\ src_vanilla\)/#\1/' \
           -e 's/^\(SUBDIRS\ += ovs.*\)/#\1/' \
           -e 's/^\(SUBDIRS\ += qemu.*\)/#\1/' \
    vswitchperf/src/Makefile
# If these paths do not exist, vsperf wont start
mkdir -p /root/vswitchperf/src/ovs/ovs/ovsdb/
touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-tool
touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-server
mkdir -p /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/
touch /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/qemu-system-x86_64
mkdir -p /root/vswitchperf/src/ovs/ovs/utilities/
touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-dpctl
touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-vsctl
touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-ofctl
touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-appctl
mkdir -p /root/vswitchperf/src/ovs/ovs/vswitchd/
touch /root/vswitchperf/src/ovs/ovs/vswitchd/vswitch.ovsschema
touch /root/vswitchperf/src/ovs/ovs/vswitchd/ovs-vswitchd

# restore symlink
#ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf