f35e3ceb36a51ac688872eb284a345fab0b90a28
[apex.git] / build / overcloud-full.sh
1 #!/bin/sh
2 ##############################################################################
3 # Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
4 #
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 set -e
11 source ./cache.sh
12 source ./variables.sh
13 source ./functions.sh
14
15 populate_cache "$rdo_images_uri/overcloud-full.tar"
16
17 if [ ! -d images/ ]; then mkdir images; fi
18 tar -xf cache/overcloud-full.tar -C images/
19 mv -f images/overcloud-full.qcow2 images/overcloud-full_build.qcow2
20
21 # Add extra space to the overcloud image
22 qemu-img resize images/overcloud-full_build.qcow2 +1G
23 LIBGUESTFS_BACKEND=direct virt-customize -a images/overcloud-full_build.qcow2 \
24                                          --run-command 'resize2fs /dev/sda'
25
26 ##########################################################
27 #####  Prep initial overcloud image with common deps #####
28 ##########################################################
29
30 # prep opnfv-puppet-tripleo for undercloud
31 clone_fork opnfv-puppet-tripleo
32 pushd opnfv-puppet-tripleo > /dev/null
33 git archive --format=tar.gz --prefix=tripleo/ HEAD > ../opnfv-puppet-tripleo.tar.gz
34 popd > /dev/null
35
36 # download customized os-net-config
37 rm -fr os-net-config
38 git clone https://github.com/trozet/os-net-config.git -b hiera_nic_mapping
39 pushd os-net-config > /dev/null
40 pushd os_net_config > /dev/null
41 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ../../os-net-config.tar.gz
42 popd > /dev/null
43 popd > /dev/null
44
45 pushd images > /dev/null
46
47 dpdk_pkg_str=''
48 for package in ${dpdk_rpms[@]}; do
49   curl -O "$dpdk_uri_base/$package"
50   dpdk_pkg_str+=" --upload $package:/root/dpdk_rpms"
51 done
52
53 # installing forked opnfv-puppet-tripleo
54 # enable connection tracking for protocal sctp
55 # upload dpdk rpms but do not install
56 LIBGUESTFS_BACKEND=direct virt-customize \
57     --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
58     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
59     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
60     --run-command "mkdir /root/dpdk_rpms" \
61     $dpdk_pkg_str \
62     --install "centos-release-qemu-ev" \
63     --run-command "yum update -y" \
64     --run-command "yum remove -y qemu-system-x86" \
65     --upload ../os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
66     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
67     -a overcloud-full_build.qcow2
68
69 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
70 popd > /dev/null