(Last Updated On: May 5, 2019)

In our fourth sequel, we are going to install Openstack Nova on the controll node.
Nova is the OpenStack project that provides a way to provision compute instances (aka virtual servers). Nova supports creating virtual machines, baremetal servers (through the use of ironic), and has limited support for system containers. Nova runs as a set of daemons on top of existing Linux servers to provide that service.

“Let the beauty of what you love be what you do. “
–Rumi

Add Nova and placement users to Keystore, make them admin roles and add the various endpoints as shown below

[[email protected] ~(keystone)]# openstack user create --domain default --project service --password pepe123 nova 
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | d13375a7f48b4642abc74ad68d6ffe4b |
| domain_id | default |
| enabled | True |
| id | 419b4fec4c4341a9beda6ef603048dc4 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+

Make the role of the nova user as an admin

[[email protected] ~(keystone)]# openstack role add --project service --user nova admin

Add placement user

[[email protected] ~(keystone)]# openstack user create --domain default --project service --password pepe1234 placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | d13375a7f48b4642abc74ad68d6ffe4b |
| domain_id | default |
| enabled | True |
| id | 24913e6816fb434ab181c01aa1f852c9 |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+

Make the role of the placement user as an admin

[[email protected] ~(keystone)]# openstack role add --project service --user placement admin

A service entry for nova needs to be added as shown below:

[[email protected] ~(keystone)]# openstack service create --name nova --description "Compute service" compute 
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Compute service |
| enabled | True |
| id | b4a6bacd6e134df19ab64e5a0ef9bca8 |
| name | nova |
| type | compute |
+-------------+----------------------------------+

Do the same for placement

[[email protected] ~(keystone)]#  openstack service create --name placement --description "Compute Placement service" placement
+-------------+-------------------------------------+
| Field | Value |
+-------------+-------------------------------------+
| description | Compute Placement service |
| enabled | True |
| id | 4220a2e7b9f147ed9ec171ee2dc99560 |
| name | placement |
| type | placement |
+-------------+-------------------------------------+
[[email protected] ~(keystone)]# export controller=192.168.122.130

Add a public entry point for nova

[[email protected] ~(keystone)]#  openstack endpoint create --region RegionOne compute public http://$controller:8774/v2.1/%(tenant_id)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
| id | 2f6fd5d7097643cea46927b056e0d5a4 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b4a6bacd6e134df19ab64e5a0ef9bca8 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.122.130:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------+

Add an internal entry point for nova

[[email protected] ~(keystone)]# openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2.1/%(tenant_id)s
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
| id | bb1a286c178f47fea4db2d121ef8ec24 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b4a6bacd6e134df19ab64e5a0ef9bca8 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.122.130:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------+

Add an internal entry point for nova admin

[[email protected] ~(keystone)]# openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2.1/%(tenant_id)s 
+--------------+----------------------------------------------+
| Field | Value |
+--------------+----------------------------------------------+
| enabled | True |
| id | 5f7c180c8ab54a458fc9ac2a1784bf19 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | b4a6bacd6e134df19ab64e5a0ef9bca8 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.122.130:8774/v2.1/%(tenant_id)s |
+--------------+----------------------------------------------+

Now we repeat the same for placement(public, internal and admin) respectively

[[email protected] ~(keystone)]# openstack endpoint create --region RegionOne placement public http://$controller:8778 
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 311de9bb91a946588038d84d747bf4fa |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4220a2e7b9f147ed9ec171ee2dc99560 |
| service_name | placement |
| service_type | placement |
| url | http://192.168.122.130:8778 |
+--------------+----------------------------------+
[[email protected] ~(keystone)]# openstack endpoint create --region RegionOne placement internal http://$controller:8778 
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 172452325ff14e97aed310e2004300a0 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4220a2e7b9f147ed9ec171ee2dc99560 |
| service_name | placement |
| service_type | placement |
| url | http://192.168.122.130:8778 |
+--------------+----------------------------------+
[[email protected] ~(keystone)]# openstack endpoint create --region RegionOne placement admin http://$controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | b33013b300964e93b61899bfbbc0723f |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4220a2e7b9f147ed9ec171ee2dc99560 |
| service_name | placement |
| service_type | placement |
| url | http://192.168.122.130:8778 |
+--------------+----------------------------------+

Then as you might guess, we have to add a nova database and nova user like the rest of the services. Let us go on

[[email protected] ~(keystone)]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 288
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'localhost' identified by 'nova123'; ##Use own password
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'%' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to [email protected]'localhost' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to [email protected]'%' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database nova_placement;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_placement.* to [email protected]'localhost' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_placement.* to [email protected]'%' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to [email protected]'localhost' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to [email protected]'%' identified by 'nova123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit;
Bye

Phew, let us now install the Nova API services

[[email protected] ~(keystone)]# yum --enablerepo=centos-openstack-queens,epel -y install openstack-nova
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base: mirror.ucu.ac.ug
centos-qemu-ev: mirror.ucu.ac.ug
extras: mirror.ucu.ac.ug
updates: mirror.ucu.ac.ug
Resolving Dependencies
--> Running transaction check

Let us Configure Nova

[[email protected] ~(keystone)]# mv /etc/nova/nova.conf /etc/nova/nova.conf.bak [[email protected] ~(keystone)]# vim /etc/nova/nova.conf 
#Just create a new file
[DEFAULT]
# define the IP of the server
my_ip = 192.168.122.130
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
log_dir = /var/log/nova
RabbitMQ connection info
transport_url = rabbit://openstack:[email protected]
[api]
auth_strategy = keystone
Glance connection info
[glance]
api_servers = http://192.168.122.130:9292
[oslo_concurrency]
lock_path = $state_path/tmp
MariaDB connection info
[api_database]
# replace all instances of nova123 with the password you set when creating nova database
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
Keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://192.168.122.130:5000
auth_url = http://192.168.122.130:5000
memcached_servers = 192.168.122.130:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
# password when setting nova service
password = pepe123
[placement]
auth_url = http://192.168.122.130:5000
os_region_name = RegionOne
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = placement
# password when setting placement service
password = pepe1234
[placement_database]
connection = mysql+pymysql://nova:[email protected]/nova_placement
[wsgi]
api_paste_config = /etc/nova/api-paste.ini
[[email protected] ~(keystone)]#  chmod 640 /etc/nova/nova.conf 
[[email protected] ~(keystone)]# chgrp nova /etc/nova/nova.conf
[[email protected] ~(keystone)]# vim /etc/httpd/conf.d/00-nova-placement-api.conf

# At about line 16, below a line like # SSLCertificateKeyFile …
##ADD THIS PART
<Directory /usr/bin>
Require all granted
</Director>

Edit the following file as shown. The numbers are for guidelines only

[[email protected] ~(keystone)]# vim /etc/httpd/conf.d/00-nova-placement-api.conf

[[email protected] ~(keystone)]# firewall-cmd --add-port={6080/tcp,6081/tcp,6082/tcp,8774/tcp,8775/tcp,8778/tcp} --permanent
success
[[email protected] ~(keystone)]# firewall-cmd --reload
success

At this point, let us proceed to add Data into the created databases and start Nova services.

[[email protected] ~(keystone)]# su -s /bin/bash nova -c "nova-manage api_db sync"
[[email protected] ~(keystone)]# su -s /bin/bash nova -c "nova-manage cell_v2 map_cell0"
[[email protected] ~(keystone)]# su -s /bin/bash nova -c "nova-manage db sync"
[[email protected] ~(keystone)]# su -s /bin/bash nova -c "nova-manage cell_v2 create_cell --name cell1"
[[email protected] ~(keystone)]# systemctl restart httpd
[[email protected] ~(keystone)]# chown nova. /var/log/nova/nova-placement-api.log
[[email protected] ~(keystone)]# for service in api consoleauth conductor scheduler novncproxy; do
systemctl start openstack-nova-$service
systemctl enable openstack-nova-$service
done

Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.

Check the status of everything so far to make sure everything we have done is working well:

[[email protected] ~(keystone)]#  openstack compute service list 
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 3 | nova-consoleauth | controller | internal | enabled | up | 2019-03-07T15:01:20.000000 |
| 4 | nova-conductor | controller | internal | enabled | up | 2019-03-07T15:01:26.000000 |
| 5 | nova-scheduler | controller | internal | enabled | up | 2019-03-07T15:01:23.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+

Thank you for following through in installing this part of the grander project. On our next guide, we shall be installing Nova Compute. Thanks guys. Follow the links below if you missed the first parts of this series

Installation of Openstack three Node Cluster on CentOS 7 Part One

Installation of Three node OpenStack Queens Cluster – Part Two

Installation of Three node OpenStack Queens Cluster – Part Three

Installation of Three node OpenStack Queens Cluster – Part Four

Next Sequel Below

Installation of Three node OpenStack Queens Cluster – Part Five