Fix docs path in common rpm spec file
[apex.git] / build / set_perf_images.sh
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2016 Red Hat Inc.
5 # Michael Chapman <michapma@redhat.com>, Tim Rozet <trozet@redhat.com>
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 for ROLE in $@; do
13   RAMDISK=${ROLE}-bm-deploy-ramdisk
14
15   if [ -f $ROLE-overcloud-full.qcow2 ]; then
16     echo "Uploading ${RAMDISK}"
17     glance image-create --name ${RAMDISK} --disk-format ari --container-format ari --file ${ROLE}-ironic-python-agent.initramfs --is-public True
18     echo "Uploading $ROLE-overcloud-full.qcow2 "
19     KERNEL=$(glance image-show overcloud-full | grep 'kernel_id' | cut -d '|' -f 3 | xargs)
20     RAMDISK_ID=$(glance image-show ${RAMDISK} | grep id | awk {'print $4'})
21     glance image-create --name $ROLE-overcloud-full --disk-format qcow2 --file $ROLE-overcloud-full.qcow2 --container-format bare --property ramdisk_id=$RAMDISK_ID --property kernel_id=$KERNEL --is-public True
22     rm -f $ROLE-overcloud-full.qcow2
23   fi
24
25   if [ "$ROLE" == "Controller" ]; then
26     sed -i "s/overcloud-full/Controller-overcloud-full/" opnfv-environment.yaml
27     sed -i '/OvercloudControlFlavor:/c\  OvercloudControlFlavor: control' opnfv-environment.yaml
28   fi
29
30   if [ "$ROLE" == "Compute" ]; then
31     sudo sed -i "s/NovaImage: .*/NovaImage: Compute-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
32     sudo sed -i '/OvercloudComputeFlavor:/c\  OvercloudComputeFlavor: compute' /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
33   fi
34
35   if [ "$ROLE" == "BlockStorage" ]; then
36     sudo sed -i "s/BlockStorageImage: .*/BlockStorageImage: BlockStorage-overcloud-full/" /usr/share/openstack-tripleo-heat-templates/environments/numa.yaml
37   fi
38
39   RAMDISK_ID=$(glance image-show ${RAMDISK} | grep id | awk {'print $4'})
40   nodes=$(ironic node-list | awk {'print $2'} |  grep -Eo [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})
41   role=$(echo $ROLE | awk '{print tolower($0)}')
42   if [ "$role" == "controller" ]; then
43     role="control"
44   fi
45   for node in $nodes; do
46     if ironic node-show $node | grep profile:${role}; then
47       ironic node-update $node replace driver_info/deploy_ramdisk=${RAMDISK_ID}
48     fi
49   done
50 done