68f74ea253c696155ca35df6bd20ffb0e5f92ffe
[apex.git] / build / build_perf_image.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 Red Hat Inc.
4 # Michael Chapman <michapma@redhat.com>
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 ROLE=$1
12 shift
13 CATEGORY=$1
14 shift
15 KEY=$1
16 shift
17 VALUE=$1
18 shift
19
20 IMAGE=$ROLE-overcloud-full.qcow2
21
22 # Create image copy for this role
23 if [ ! -f $IMAGE ] ; then
24   cp overcloud-full.qcow2 $IMAGE
25 fi
26
27 if [ "$CATEGORY" == "nova" ]; then
28   if [ "$KEY" == "libvirtpin" ]; then
29     sudo sed -i "s/#LibvirtCPUPinSet:.*/LibvirtCPUPinSet: '${VALUE}'/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
30   fi
31 fi
32
33 if [ "$CATEGORY" == "kernel" ]; then
34   echo "${KEY}=${VALUE}" >> $ROLE-kernel_params.txt
35   if [[ "$dataplane" == 'fdio' && "$KEY" == 'hugepages' ]]; then
36     # set kernel hugepages params for fdio
37     LIBGUESTFS_BACKEND=direct virt-customize --run-command "echo vm.hugetlb_shm_group=0 >> /usr/lib/sysctl.d/00-system.conf" \
38                                              --run-command "echo vm.max_map_count=$(printf "%.0f" $(echo 2.2*$VALUE | bc)) >> /usr/lib/sysctl.d/00-system.conf" \
39                                              --run-command "echo kernel.shmmax==$((VALUE * 2 * 1024 * 1024)) >> /usr/lib/sysctl.d/00-system.conf" \
40                                              -a ${IMAGE}
41   fi
42 fi
43
44 if [ "$CATEGORY" == "vpp" ]; then
45   if [ "$KEY" == "main-core" ]; then
46     sudo sed -i "/${ROLE}VPPMainCore:/c\  ${ROLE}VPPMainCore: '${VALUE}'" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
47   fi
48   if [ "$KEY" == "corelist-workers" ]; then
49     sudo sed -i "/${ROLE}VPPCorelistWorkers:/c\  ${ROLE}VPPCorelistWorkers: '${VALUE}'" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
50   fi
51   if [ "$KEY" == "uio-driver" ]; then
52     sudo sed -i "/${ROLE}UIODriver:/c\  ${ROLE}UIODriver: '${VALUE}'" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
53   fi
54 fi