summaryrefslogtreecommitdiffstats
path: root/docs/configguide/configguide.rst
blob: bc66d3856356d954d8ab30e3b6ce3cf05aed7cfa (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0


Preparing the Docker container
------------------------------

Pull the Functest Docker image from the Docker hub::

  docker pull opnfv/functest:brahmaputra.1.0


Check that the image is available::

  docker images

Run the docker container giving the environment variables:

 * **INSTALLER_TYPE** : possible values are **apex**, **compass**, **fuel** or **joid**.
 * **INSTALLER_IP** : IP of the installer node/VM.

Functest may need to know the IP of the installer to retrieve automatically the
credentials from the installer node/VM or even from the actual controllers.

The minimum command to create the Functest Docker container can be described as
follows::

  docker run -it -e "INSTALLER_IP=10.20.0.2" -e "INSTALLER_TYPE=fuel" opnfv/functest:brahmaputra.1.0 /bin/bash

Optionally, it is possible to precise the container name through the option
**--name**::

  docker run --name "CONTAINER_NAME" -it -e "INSTALLER_IP=10.20.0.2" -e "INSTALLER_TYPE=fuel" opnfv/functest:brahmaputra.1.0 /bin/bash

It is also possible to to indicate the path of the OpenStack credentials using **-v**::

  docker run  -it -e "INSTALLER_IP=10.20.0.2" -e "INSTALLER_TYPE=fuel" -v <path_to_your_local_creds_file>:/home/opnfv/functest/conf/openstack.creds opnfv/functest:brahmaputra.1.0 /bin/bash

The local file will be mounted in the container under
*/home/opnfv/functest/conf/openstack.creds*

If the intention is to run Functest against any of the supported OPNFV scenarios,
it is recommended to include also the environment variable **DEPLOY_SCENARIO**,
for example::

  docker run -it -e "INSTALLER_IP=10.20.0.2" -e "INSTALLER_TYPE=fuel" -e "DEPLOY_SCENARIO=os-odl_l2-nofeature-ha" opnfv/functest:brahmaputra.1.0 /bin/bash

Inside the container, the following directory structure should be in place::

  `-- home
      `-- opnfv
        |-- functest
        |   |-- conf
        |   |-- data
        |   `-- results
        `-- repos
            |-- bgpvpn
            |-- doctor
            |-- functest
            |-- odl_integration
            |-- onos
            |-- promise
            |-- rally
            |-- releng
            `-- vims-test


Basically the container includes:

  * Functest directory to store the configuration (the OpenStack creds are stored
    in /home/opngb/functest/conf/openstack.creds), the data (cirros image needed for
    some tests), results (some temporary result logs may be stored here)
  * Repositories: the functest repository will be used to prepare the
    environment and run the tests. Other repositories are used for the installation
    of the needed tooling (e.g. rally) and/or the retrieval of feature projects
    scenarios (e.g. promise)

The structure under the Functest repository can be described as follows::

  .
    |-- INFO
    |-- LICENSE
    |-- commons
    |   |-- ims
    |   |-- mobile
    |   `-- traffic-profile-guidelines.rst
    |-- docker
    |   |-- Dockerfile
    |   |-- common.sh
    |   |-- prepare_env.sh
    |   |-- requirements.pip
    |   `-- run_tests.sh
    |-- docs
    |   |-- configguide
    |   |-- devguide
    |   |-- images
    |   |-- results
    |   `-- userguide
    `-- testcases
        |-- Controllers
        |-- features
        |-- tests
        |-- VIM
        |-- vIMS
        |-- vPing
        |-- __init__.py
        |-- config_functest.py
        |-- config_functest.yaml
        `-- functest_utils.py

We may distinguish 4 different folders:

  * **commons**: it is a folder dedicated to store traffic profile or any test
    inputs that could be reused by any test project
  * **docker**: this folder includes the scripts that will be used to setup the
    environment and run the tests
  * **docs**: this folder includes the user and installation/configuration guide
  * **testcases**: this folder includes the scripts required by Functest internal
    test cases and other feature projects test cases.

After the *run* command, a new prompt appears which means that we are inside the
container and ready to move to the next step.


Useful Docker commands
----------------------

When typing **exit** in the container prompt, this will cause
exiting the container and probably stopping it. When stopping a running Docker container
all the changes will be lost, there is a keyboard shortcut to
quit the container without stopping it: CTRL+P+Q.
To reconnect to the running container **DO NOT** use the *run* command again
(since it will create a new container), use *exec* instead::

  docker ps
  <copy the container ID>
  docker exec -ti <CONTAINER_ID> /bin/bash

or simply::

  docker exec -ti $(docker ps|grep functest|awk '{print $1}') /bin/bash

There are other useful Docker commands that might be needed to manage possible
issues with the containers.

List the running containers::

   docker ps

List all the containers including the stopped ones::

  docker ps -a

It is useful sometimes to remove a container if there are some problems::

  docker rm <CONTAINER_ID>

Use the *-f* option if the container is still running, it will force to destroy it::

  docker -f rm <CONTAINER_ID>

The Docker image is called **opnfv/functest** and it is stored in the public
Docker registry under the OPNFV account: dockerhub_.
The are many different tags that have been created automatically by the CI
mechanisms, but the one that this document refers to is **brahmaputra.1.0**.
Pulling other tags might cause some problems while running the tests.

Check the Docker documentation dockerdocs_ for more information.


Preparing the Functest environment
----------------------------------

Once the docker container is up and running, execute the following command in the
prompt::

    ${repos_dir}/functest/docker/prepare_env.sh

NOTE: **${repos_dir}** is a default environment variable inside the docker
container, which points to */home/opnfv/repos/*

This script will make sure that the requirements to run the tests are met and will
install the needed libraries and tools by all Functest test cases. It must be run
only once every time the docker is started from sratch.


Focus on the OpenStack credentials
----------------------------------

The OpenStack credentials are needed to run the tests against the VIM.
There are 3 ways to provide them to Functest:

  * using the -v option when running the Docker container
  * create an empty file in /home/opnfv/functest/conf/openstack.creds and paste
    the credentials in it.
  * automatically retrieved using the following script::
         $repos_dir/releng/utils/fetch_os_creds.sh

Once the credentials are there, they shall be sourced before running the tests::

    source /home/opnfv/functest/conf/openstack.creds

or simply using the environment variable **creds**::

    . $creds

After this, try to run any OpenStack command to see if you get any output,
for instance::

    openstack user list

This will return a list of the actual users in the OpenStack deployment. In any
other case, check that the credentials are sourced::

    env|grep OS_

This command must show a set of environment variables starting with *OS_*, for example::

    OS_REGION_NAME=RegionOne
    OS_DEFAULT_DOMAIN=default
    OS_PROJECT_NAME=admin
    OS_PASSWORD=admin
    OS_AUTH_STRATEGY=keystone
    OS_AUTH_URL=http://172.30.10.3:5000/v2.0
    OS_USERNAME=admin
    OS_TENANT_NAME=admin
    OS_ENDPOINT_TYPE=internalURL
    OS_NO_CACHE=true

If still the OpenStack command does not show anything or complains about
connectivity issues, it could be due to an incorrect url given to the OS_AUTH_URL
environment variable. Check the deployment settings.

Additional Options
------------------

In case you need to provide different configuration parameters to Functest (e.g.
commit IDs or branches for the repositories, ...) copy the **config_functest.yaml**
from the repository to your current directory and run the container with a volume::

    wget https://git.opnfv.org/cgit/functest/plain/testcases/config_functest.yaml

    <modify the file accordingly>

    docker run -ti -e \
    "INSTALLER_TYPE=fuel" -e "INSTALLER_IP=10.20.0.2" \
    opnfv/functest:brahmaputra.1.0 \
    -v $(pwd)/config_functest.yaml:/home/opnfv/functest/conf/config_functest.yaml \
    /bin/bash\

However, this is not recommended since most of the test cases rely on static
parameters read from this file, and changing them might cause problems.

.. _dockerdocs: https://docs.docker.com/
.. _dockerhub: https://hub.docker.com/r/opnfv/functest/
alldrive="undefined" forceformat="no" for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done set ${drives} ${removable_drives} numdrives=`echo $#` tgtdrive="${installdrive}" function confirm_format { check_drive="$1" local confirm_format="no" if [[ "$forceformat" == "yes" ]] ; then return 0 fi if parted -s /dev/$check_drive print &>/dev/null ; then echo echo "$check_drive drive contains partition table:" parted -s /dev/$check_drive print echo read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then return 0 else return 1 fi else return 0 fi } format_confirmed="no" if [ $numdrives -lt 1 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* There is no suitable media available for installation. *' echo '* Please attach a drive and try again. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to shut down the system: " _ poweroff fi if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 while [ "${tgtdrive}" = "undefined" ]; do clear echo echo '********************************************************************************' echo '* W A R N I N G *' echo '* *' echo '* Which of the detected hard drives do you want to be used as *' echo '* the installation target? *' echo '* *' echo '********************************************************************************' echo echo "Possible choices" echo "Persistent drives: ${drives}" echo "Removable drives: ${removable_drives}" echo if [ `echo ${drives} | wc -w` -eq 1 ] ; then read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive else read -p "Choose hard drive: " tgtdrive fi match="no" for drive in ${drives[@]} ${removable_drives[@]}; do if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then if confirm_format $tgtdrive ; then format_confirmed="yes" break else tgtdrive="undefined" read -p "You may select another disk. Press Enter to continue." _ fi fi done if [[ "$match" == "no" ]]; then tgtdrive="undefined" read -p "Invalid choice. Press Enter to continue." _ fi done clear chvt 1 else tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"` fi if [ "$format_confirmed" != "yes" ] ; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 if ! confirm_format $tgtdrive ; then clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* Disk $tgtdrive contains active partition(s). *' echo '* Installation cannot continue without confirmation. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to restart: " _ reboot fi chvt 1 fi # verify tgtdrive is at least 41GB tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) if [ $tgtdrivesize -lt 41984 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear echo echo '********************************************************************' echo '* E R R O R *' echo '* *' echo '* Your disk is under 41GB in size. Installation cannot continue. *' echo '* Restart installation with a larger disk. *' echo '* *' echo '********************************************************************' echo read -p "Press Enter to restart: " _ reboot fi # paths in /dev have "/" instead of "!" for cciss devices tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') # source if test -e /dev/disk/by-label/"OpenStack_Fuel"; then echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks else echo "cdrom" > /tmp/source.ks fi vgremove -ff os dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10 sleep 3 hdparm -z /dev/${tgtdrive} parted -s /dev/${tgtdrive} mklabel gpt parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24 parted -s /dev/${tgtdrive} set 1 bios_grub on parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224 parted -s /dev/${tgtdrive} set 2 boot on parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424 sleep 3 hdparm -z /dev/${tgtdrive} # partition # This adds support for the p seperator required for cciss devices if echo ${tgtdrive} | grep -q -e cciss ; then bootdev=${tgtdrive}p else bootdev=${tgtdrive} fi echo > /tmp/partition.ks echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks echo "volgroup os pv.001" >> /tmp/partition.ks echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks # bootloader echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks # Anaconda can not install grub 0.97 on disks which are >4T. # The reason is that grub does not support such large geometries # and it simply thinks that the cylinder number has negative value. # Here we just set geometry manually so that grub thinks that disk # size is equal to 1G. # 130 cylinders * (16065 * 512 = 8225280 bytes) = 1G echo "%post --nochroot --log=/mnt/sysimage/root/anaconda-post-partition.log" > /tmp/post_partition.ks echo "echo \"device (hd0) /dev/${tgtdrive}\" >> /tmp/grub.script" >> /tmp/post_partition.ks echo "echo \"geometry (hd0) 130 255 63\" >> /tmp/grub.script" >> /tmp/post_partition.ks echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks %end %packages --nobase --excludedocs @Core fuel fuel-library >= 7.0 fuel-dockerctl authconfig bind-utils cronie crontabs curl daemonize dhcp docker-io fuel-bootstrap-image fuel-bootstrap-image-builder fuel-createmirror fuel-target-centos-images6.6 fuel-package-updates fuelmenu fuel-docker-images gdisk lrzip lsof man mlocate nmap-ncat ntp ntpdate openssh-clients policycoreutils python-daemon rsync ruby21-puppet ruby21-rubygem-netaddr ruby21-rubygem-openstack selinux-policy-targeted strace subscription-manager sysstat system-config-firewall-base tcpdump telnet vim-enhanced virt-what wget yum yum-plugin-priorities %include /tmp/post_partition.ks # POSTINSTALL SECTION # HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER # INSTALLATION ITSELF COMPLETED %post echo -e "modprobe nf_conntrack_ipv4\nmodprobe nf_conntrack_ipv6\nmodprobe nf_conntrack_tftp\nmodprobe nf_nat_tftp" >> /etc/rc.modules chmod +x /etc/rc.modules echo -e "net.nf_conntrack_max=1048576" >> /etc/sysctl.conf mkdir -p /var/log/coredump echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.conf chmod 777 /var/log/coredump echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf # Mount installation media in chroot %post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log #!/bin/sh set -x SOURCE="/mnt/sysimage/tmp/source" for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done mkdir -p "${SOURCE}" case "${repo}" in nfs:*) nfs_url="${repo#nfs:}" mount -t nfs "${nfs_url}" "${SOURCE}" ;; *) if [ -d "/mnt/source" ]; then mount -o bind "/mnt/source" "${SOURCE}" fi ;; esac %post --log=/root/anaconda-post-after-chroot.log #!/bin/bash set -x function save_cfg { scrFile="/etc/sysconfig/network-scripts/ifcfg-$admin_interface" search="domain $domain\nsearch $domain" sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream echo DEVICE=$admin_interface > $scrFile echo ONBOOT=yes >> $scrFile echo NM_CONTROLLED=no >> $scrFile echo HWADDR=$hwaddr >> $scrFile echo USERCTL=no >> $scrFile echo PEERDNS=no >> $scrFile if [ $ip ]; then echo BOOTPROTO=static >> $scrFile echo IPADDR=$ip >> $scrFile echo NETMASK=$netmask >> $scrFile else echo BOOTPROTO=dhcp >> $scrFile fi scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface" #Ignore gateway and set up DHCP if it is used, otherwise apply it if [ $dhcp_interface ] && [ "$dhcp_interface" != "$admin_interface" ]; then echo "DEVICE=$dhcp_interface" > $scrDHCPFile echo "BOOTPROTO=dhcp" >> $scrDHCPFile echo "ONBOOT=yes" >> $scrDHCPFile echo "USERCTL=no" >> $scrDHCPFile else echo GATEWAY=$gw >> /etc/sysconfig/network fi [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images } # Default FQDN hostname="nailgun.mirantis.com" for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done hostname=$hostname domain=${hostname#*.} ip=$ip netmask=$netmask gw=$gw admin_interface=${admin_interface:-"eth0"} hwaddr=`ifconfig $admin_interface | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'` dhcp_interface=$dhcp_interface build_images=$build_images wait_for_external_config=$wait_for_external_config save_cfg # Mounting installation source SOURCE=/tmp/source FS=/tmp/fs echo mkdir -p ${SOURCE} mkdir -p ${FS} if test -e /dev/disk/by-label/"OpenStack_Fuel"; then mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE} elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS} mount -o loop ${FS}/nailgun.iso ${SOURCE} fi OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version` # ---------------------- # UNPACKING REPOSITORIES # ---------------------- wwwdir="/var/www/nailgun" repodir="${wwwdir}/${OPENSTACK_VERSION}" # Copying Centos files mkdir -p ${repodir}/centos/x86_64 cp -r ${SOURCE}/images ${repodir}/centos/x86_64 cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64 cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64 cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64 cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64 # Copying Ubuntu files mkdir -p ${repodir}/ubuntu/x86_64/images cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64 cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64 # We do not ship debian-installer kernel and initrd on ISO. # But we still need to be able to create ubuntu cobbler distro # which requires kernel and initrd to be available. So, we # just touch these files to work around cobbler's limitation. touch ${repodir}/ubuntu/x86_64/images/linux touch ${repodir}/ubuntu/x86_64/images/initrd.gz # make links for backward compatibility ln -s ${repodir}/centos ${wwwdir}/centos ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu # -------------------------- # UNPACKING PUPPET MANIFESTS # -------------------------- # create folders #mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/ #mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/ #rm -rf /etc/puppet/modules/ # TODO(ikalnitsky): investigate why we need this #cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/ # place modules and manifests #tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules #cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/ # make links for backward compatibility #pushd /etc/puppet #ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests #ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules #popd cp ${SOURCE}/send2syslog.py /bin/send2syslog.py mkdir -p /var/lib/hiera touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml # Prepare local repository specification rm /etc/yum.repos.d/CentOS*.repo cat > /etc/yum.repos.d/nailgun.repo << EOF [nailgun] name=Nailgun Local Repo baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64 gpgcheck=0 EOF # Disable subscription-manager plugins sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || : sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf || : # Disable GSSAPI in ssh server config sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config # Enable MOTD banner in sshd sed -i -e "s/^\s*PrintMotd no/PrintMotd yes/g" /etc/ssh/sshd_config # Add note regarding local repos creation to MOTD cat >> /etc/motd << EOF All environments use online repositories by default. Use the following commands to create local repositories on master node and change default repository settings: * CentOS: fuel-package-updates (see --help for options) * Ubuntu: fuel-createmirror (see --help for options) Please refer to the following guide for more information: https://docs.mirantis.com/openstack/fuel/fuel-7.0/reference-architecture.html#fuel-rep-mirror EOF # Copying bootstrap_admin_node.sh, chmod it and # adding /etc/init/bootstrap_admin_node.conf cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node # Copying version.yaml file. It contains COMMIT_SHA of last commit. RELEASE=$(awk '/release/{gsub(/"/, "");print $2}' ${SOURCE}/version.yaml) mkdir -p /etc/nailgun /etc/fuel/${RELEASE} /etc/fuel/release_versions cp ${SOURCE}/version.yaml /etc/nailgun/version.yaml cp ${SOURCE}/version.yaml /etc/fuel/${RELEASE}/version.yaml ln -s /etc/fuel/${RELEASE}/version.yaml /etc/fuel/version.yaml cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_version`.yaml # Generete Fuel UUID uuidgen > /etc/fuel/fuel-uuid # Run fuel menu [ -z "$showmenu" ] && showmenu="no" # Pause during bootstrap_admin_node to wait for external config [ -z "$wait_for_external_config" ] && wait_for_external_config="no" # Prepare bootstrap_admin_node config cat > /etc/fuel/bootstrap_admin_node.conf << EOF #Set to yes to run Fuel Setup #Set to no to accept default settings ADMIN_INTERFACE=${admin_interface} showmenu=${showmenu} wait_for_external_config=${wait_for_external_config} EOF # Prepare custom /etc/issue logon banner and script for changing IP in it cat > /etc/issue << EOF ######################################### # Welcome to the Fuel server # ######################################### Server is running on \m platform Fuel UI is available on: https://:8443 Default administrator login: root Default administrator password: r00tme Default Fuel UI login: admin Default Fuel UI password: admin Please change root password on first login. EOF cat >> '/etc/rc.local' << EOF first=yes for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do if [ "\$first" = "yes" ]; then ipstr="Fuel UI is available on: https://\$ip:8443" first=no else ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "https://\$ip:8443") fi done tmpissue=\$(mktemp) while read -r line; do if [[ "\$line" =~ "Fuel UI is available on" ]]; then echo -e "\$ipstr" >> \$tmpissue elif [[ "\$line" =~ :8443$ ]]; then : else echo -e "\$line" >> \$tmpissue fi done < /etc/issue mv "\$tmpissue" /etc/issue EOF ######### OPNFV addition BEGIN ############ # Copy data into /opt/opnfv # TODO: This ought to be a package instead! mkdir -p /opt/opnfv cp -r ${SOURCE}/opnfv /opt cp ${SOURCE}/gitinfo.txt / ######### OPNFV addition END ############ # Unmounting source umount -f ${SOURCE} rm -rf ${SOURCE} umount -f ${FS} || true rm -rf ${FS} echo "tos orphan 7" >> /etc/ntp.conf # Do not show error message on ntpdate failure. Customers should not be confused # if admin node does not have access to the internet time servers. sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/' # Disabling splash sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf # Disabling console clearing sed -i 's/getty/getty --noclear/' /etc/init/tty.conf # Disabling starting first console from start-ttys service sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init # Copying default bash settings to the root directory cp -f /etc/skel/.bash* /root/ # Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors [[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf %end