diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ubuntu-server-cloudimg-dpdk-modify.sh | 36 | ||||
-rwxr-xr-x | tools/vsperf-img-finalize.sh | 51 | ||||
-rwxr-xr-x | tools/vsperf-img-modify.sh | 74 | ||||
-rw-r--r-- | tools/vsperf_install.yml | 125 |
4 files changed, 284 insertions, 2 deletions
diff --git a/tools/ubuntu-server-cloudimg-dpdk-modify.sh b/tools/ubuntu-server-cloudimg-dpdk-modify.sh index 847c5053c..9821c1125 100755 --- a/tools/ubuntu-server-cloudimg-dpdk-modify.sh +++ b/tools/ubuntu-server-cloudimg-dpdk-modify.sh @@ -59,7 +59,7 @@ chpasswd: { expire: False } ssh_pwauth: True EOF -linuxheadersversion=$(echo ls boot/vmlinuz* | cut -d- -f2-) +linuxheadersversion=$(echo ls /boot/vmlinuz* | cut -d- -f2-) apt-get update apt-get install -y \ @@ -74,6 +74,7 @@ apt-get install -y \ linux-tools-generic \ lmbench \ make \ + unzip \ netperf \ patch \ perl \ @@ -82,7 +83,23 @@ apt-get install -y \ sysstat \ linux-headers-"${linuxheadersversion}" \ libpcap-dev \ - lua5.2 + lua5.2 \ + net-tools \ + wget \ + unzip \ + libpcap-dev \ + ncurses-dev \ + libedit-dev \ + pciutils \ + pkg-config \ + liblua5.2-dev \ + libncursesw5-dev \ + ncurses-dev \ + libedit-dev + +dpkg -L liblua5.2-dev +cp /usr/include/lua5.2/lua.h /usr/include/ +cp /usr/include/lua5.2/lua.h /usr/include/x86_64-linux-gnu/ git clone http://dpdk.org/git/dpdk git clone http://dpdk.org/git/apps/pktgen-dpdk @@ -100,5 +117,20 @@ bash build.sh git clone https://github.com/beefyamoeba5/cachestat.git "${CLONE_DEST}"/Cachestat +cd /root +wget http://dpdk.org/browse/dpdk/snapshot/dpdk-17.02.zip +unzip dpdk-17.02.zip +cd dpdk-17.02 +make install T=x86_64-native-linuxapp-gcc + +cd /root +wget https://01.org/sites/default/files/downloads/intelr-data-plane-performance-demonstrators/dppd-prox-v035.zip +unzip dppd-prox-v035.zip +cd dppd-PROX-v035 +chmod +x helper-scripts/trailing.sh +export RTE_SDK=/root/dpdk-17.02 +export RTE_TARGET=x86_64-native-linuxapp-gcc +make + # restore symlink ln -sfrT /run/resolvconf/resolv.conf /etc/resolv.conf diff --git a/tools/vsperf-img-finalize.sh b/tools/vsperf-img-finalize.sh new file mode 100755 index 000000000..cf3677b84 --- /dev/null +++ b/tools/vsperf-img-finalize.sh @@ -0,0 +1,51 @@ +#!/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 +############################################################################## + +# PREREQUISITES +# modified image (yardstick-vsperf) must be uploaded to OpenStack +# must have a proper flavor (vsperf-flavor) for the image e.g. +# nova flavor-create vsperf-flavor auto 8192 80 6 +# nova flavor-key vsperf-flavor set hw:numa_nodes=1 +# nova flavor-key vsperf-flavor set hw:mem_page_size=1GB +# nova flavor-key vsperf-flavor set hw:cpu_policy=dedicated +# nova flavor-key vsperf-flavor set hw:vif_multiqueue_enabled=true + +stackname="vsperf-install-stack" +template=vsperf_install.yml +new_image_name="yardstick-vsperf-server" + +openstack stack create $stackname -f yaml -t $template +progress="WARMING_UP" + +while [ "$progress" != "CREATE_COMPLETE" ] +do + sleep 10 + echo "check stack status......." + show_output=$(openstack stack show $stackname) + progress=$(echo $show_output | sed 's/^.*stack_status . \([^ ]*\).*$/\1/') + echo "$progress" + if [ "$progress" == "CREATE_FAILED" ];then + echo "create $stackname failed" + exit 1 + fi +done + +# has to stop the instance before taking the snapshot +nova stop $stackname +sleep 10 + +status=$(nova image-create --poll $stackname $new_image_name) +if [[ "$status" =~ "Finished" ]];then + echo "$new_image_name finished" +fi + +nova delete $stackname +sleep 10 +openstack stack delete --yes $stackname diff --git a/tools/vsperf-img-modify.sh b/tools/vsperf-img-modify.sh new file mode 100755 index 000000000..3ba697c00 --- /dev/null +++ b/tools/vsperf-img-modify.sh @@ -0,0 +1,74 @@ +#!/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 diff --git a/tools/vsperf_install.yml b/tools/vsperf_install.yml new file mode 100644 index 000000000..3c78e0ca8 --- /dev/null +++ b/tools/vsperf_install.yml @@ -0,0 +1,125 @@ +############################################################################## +# 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 +############################################################################## +heat_template_version: 2015-04-30 + +description: > + Used to run VMs with Vsperf + +parameters: + image: + type: string + description: Name of the image + default: yardstick-vsperf + + flavor: + type: string + default: vsperf-flavor + + timeout: + type: number + description: Timeout in seconds for WaitCondition, depends on your image and environment + default: 6000 + + external_net_name: + type: string + description: Name of the external network which management network will connect to + default: ext-net1 + +resources: + network: + type: OS::Neutron::Net + properties: + name: vsperf_net + + subnet: + type: OS::Neutron::Subnet + properties: + name: vsperf_subnet + ip_version: 4 + cidr: 192.168.0.0/24 + network: { get_resource: network } + + management_router: + type: OS::Neutron::Router + properties: + name: management_router + external_gateway_info: + network: { get_param: external_net_name } + + management_router_interface: + type: OS::Neutron::RouterInterface + properties: + router: { get_resource: management_router } + subnet: { get_resource: subnet } + + floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network: { get_param: external_net_name } + + floating_ip_association: + type: OS::Nova::FloatingIPAssociation + properties: + floating_ip: { get_resource: floating_ip } + server_id: {get_resource: vsperf_vm} + + keypair: + type: OS::Nova::KeyPair + properties: + name: yardstick-key + public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 yardstick@yardstick.opnfv.org + + wait_handle: + type: OS::Heat::WaitConditionHandle + + wait_condition: + type: OS::Heat::WaitCondition + properties: + handle: { get_resource: wait_handle } + count: 1 + timeout: { get_param: timeout } + + vsperf_vm: + type: OS::Nova::Server + depends_on: [subnet, keypair] + properties: + name: { get_param: "OS::stack_name" } + image: { get_param: image } + flavor: { get_param: flavor } + key_name: {get_resource: keypair} + networks: + - network: { get_resource: network } + config_drive: True + user_data_format : RAW + user_data: + str_replace: + template: | + #!/bin/bash + cat <<'CEOF' > /tmp/vsperf_post_build.sh + echo "Install vswitchperf" + mv /root/vswitchperf /home/ubuntu + chown -R ubuntu:ubuntu /home/ubuntu/vswitchperf + cd /home/ubuntu/vswitchperf/systems + sudo -H -u ubuntu ./build_base_machine.sh + echo "Set password less access to MoonGen server" + sudo -H -u ubuntu ssh-keygen -b 2048 -t rsa -f /home/ubuntu/.ssh/id_rsa -N '' + sudo -H -u ubuntu touch /home/ubuntu/.cloud-warnings.skip + echo "Enable 1GB huge pages" + update-grub + $NOTIFY --data-binary '{"status": "SUCCESS"}' + CEOF + chmod +x /tmp/vsperf_post_build.sh + nohup /tmp/vsperf_post_build.sh & + params: + $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] } + +outputs: + vm_uuid: + description: uuid of the VM + value: { get_attr: [ vsperf_vm, show,id ] } |