[Openstack](EN) Build kolla images using source

Build openstack kolla image by using source


Environment and Prerequisite

  • Linux base system(Done tests on Mac and CentOS-7.6)
  • Bash shell(/bin/bash)
  • Docker
  • pip
  • Git


Kolla Image?

Kolla Image

  • Kolla’s mission is to provide production-ready containers and deployment tools for operating OpenStack clouds.
  • Kolla Image means containerized images of openstack components
  • Related projects are Openstack Helm and Kolla-ansible
  • Link : https://docs.openstack.org/kolla/latest/


How to build image

Before build!

  • There are two ways to build kolla images. One is from binary and the other is from source. Default value setting is binary.
  • binary build images by using remote binary component file. source build images from source codes.
  • Below scenario introduce build from source and build only nova component.
  • For using source, we need each components source code files.(We will clone it from git repository)
  • Below scenario is tested on both Mac and CentOS-7.6
  • When developing Kolla it can be useful to build images using files located in a local copy of Kolla. Use the tools/build.py script instead of kolla-build command in all below instructions.


0. Prerequisites

CentOS

MacOS


1. Clone kolla repository

  • Clone kolla repository and switch to stable/rocky branch
$ git clone https://github.com/openstack/kolla.git
$ cd kolla/
$ git checkout stable/rocky


2. Install needed packages

# In kolla directory path
$ cd ..
$ pip install kolla/
$ pip install tox


3. Generate kolla-build.conf

$ pip install tox
$ cd kolla/
$ tox -e genconfig
...
genconfig: commands succeeded
congratulations :)

Issue Solving

  • Install packages if there are errors like below in CentOS
...
configure: error: no acceptable C compiler found in $PATH
...
_posixsubprocess.c:16:20: fatal error: Python.h: No such file or directory
...
  • Install python-devel and gcc
$ sudo yum install python-devel gcc -y


4. Clone nova repository

  • Clone nova repository and switch to stable/rocky branch
  • Remember the path of nova directory
# In kolla directory path
$ cd ..
$ git clone https://github.com/openstack/nova.git
$ cd nova/
$ git checkout stable/rocky
$ pwd
/root/nova


5. Modify kolla-build.conf

  • Modify [nova-base] part
  • location value must be your nova directory path on your local computer
# In nova directory path
$ cd ..
$ cd kolla
$ vi etc/kolla/kolla-build.conf # File is in kolla repo path

[nova-base]
type = local
# Below value should be your local computer nova directory path
location = /root/nova


6. Build

  • Build nova from source code in kolla directory
# In kolla directory path
$ kolla-build -t source nova
  • Build all components using binary
# In kolla directory path
$ kolla-build
  • Build specific component
# In kolla directory path
$ kolla-build keystone


Image build result

$ docker images
REPOSITORY                                 TAG                 IMAGE ID            CREATED              SIZE
kolla/centos-source-nova-compute           7.0.4               694d85ecaa62        About a minute ago   1.81GB
kolla/centos-source-novajoin-notifier      7.0.4               c116e353b02b        4 minutes ago        1.2GB
kolla/centos-source-novajoin-server        7.0.4               9541f2052b73        4 minutes ago        1.2GB
kolla/centos-source-novajoin-base          7.0.4               125d2a2e8b9a        4 minutes ago        1.2GB
kolla/centos-source-nova-placement-api     7.0.4               655930338019        7 minutes ago        1.34GB
kolla/centos-source-nova-api               7.0.4               d9521fa18d3d        7 minutes ago        1.34GB
kolla/centos-source-nova-spicehtml5proxy   7.0.4               6395db08d1df        8 minutes ago        1.33GB
kolla/centos-source-nova-ssh               7.0.4               b395c526352e        8 minutes ago        1.31GB
kolla/centos-source-nova-compute-ironic    7.0.4               dd0a8457063f        8 minutes ago        1.29GB
kolla/centos-source-nova-novncproxy        7.0.4               c407eee656a3        9 minutes ago        1.29GB
kolla/centos-source-nova-serialproxy       7.0.4               b854ffc79ded        11 minutes ago       1.26GB
kolla/centos-source-nova-consoleauth       7.0.4               1abeb9649aea        11 minutes ago       1.26GB
kolla/centos-source-nova-scheduler         7.0.4               0675166ec124        11 minutes ago       1.26GB
kolla/centos-source-nova-conductor         7.0.4               701da269a6d8        11 minutes ago       1.26GB
kolla/centos-source-nova-mksproxy          7.0.4               7aca763eadc8        11 minutes ago       1.26GB
kolla/centos-source-nova-base              7.0.4               7334dc66fc18        11 minutes ago       1.26GB
kolla/centos-source-nova-libvirt           7.0.4               2f9b6a373655        13 minutes ago       972MB
kolla/centos-source-openstack-base         7.0.4               a0d75d6d1f88        15 minutes ago       1.01GB
kolla/centos-source-base                   7.0.4               0c78c4431ab3        25 minutes ago       416MB
centos                                     7                   9f38484d220f        3 months ago         202MB
hello-world                                latest              fce289e99eb9        5 months ago         1.84kB

Reference

[Linux] 쉘 스크립트에서 멀티프로세스(혹은 스레드) 기능 사용하기

> 백그라운드로 명령어를 실행해서 병렬적으로 실행되는 멀티 프로세스 환경을 만들어보자.## 환경- Linux 기반 시스템- Bash shell(/bin/bash)## 멀티프로세스? 병렬처리? 멀티스레드? 백그라운드 프로세스?- 여기서 진행할 방식...… Continue reading