Openstack installation : Compute Service – Controller Node

Had followed steps given in https://docs.openstack.org – Content mostly from openstack.org – This is just a compilation on steps followed by me.  Minor changes may be observed as I had installed on Debian 9.6.

Previous Post : Install Image Service
Next Post     : Compute Service on compute nodes
Recommended reading

Create database for nova and nova_api service on controller, and grant privileges to nova user.

CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '<passwrod>';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '<password>';

As admin user create user account for nova and associate role.

sandeep@controller:~$ . admin-openrc 
sandeep@controller:~$ openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | b34f72d7fd4d4c138786c8ee3d5f80b7 |
| name                | nova                             |
| password_expires_at | None                             |
+---------------------+----------------------------------+
sandeep@controller:~$ openstack role add --project service --user nova admin

Create nova service entity and required end points

sandeep@controller:~$ openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 89d221c04cb0441382ee626128aa6eca |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
sandeep@controller:~$ openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | bb0a2adb69154de79fd3f8ec9820ce27          |
| interface    | public                                    |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 89d221c04cb0441382ee626128aa6eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
sandeep@controller:~$ openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | bfb49aa1282d45188312373107105a6f          |
| interface    | internal                                  |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 89d221c04cb0441382ee626128aa6eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
sandeep@controller:~$ openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 6daf1f882917496abfe69c8afd9f1092          |
| interface    | admin                                     |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 89d221c04cb0441382ee626128aa6eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url | http://controller:8774/v2.1/%(tenant_id)s          |
+--------------+-------------------------------------------+

Install nova packages

sandeep@controller:~$ su
Password: 
root@controller:/home/sandeep# apt install nova-api nova-conductor nova-consoleauth nova-consoleproxy nova-scheduler
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following additional packages will be installed:
bridge-utils libisns0 libjs-swfobject libtidy5 nova-common novnc open-iscsi os-brick-common python-amqplib python-configobj python-feedparser python-libxml2 python-microversion-parse python-nova python-novnc
python-os-brick python-os-vif python-os-win python-oslo.privsep python-oslo.reports python-oslo.rootwrap python-oslo.versionedobjects python-paramiko python-psutil python-pycurl python-utidylib
python-websockify python-wsgi-intercept spice-html5 sudo websockify websockify-common
......Setting up python-os-brick (1.6.1-2) ...
Setting up python-nova (2:14.0.0-4+deb9u1) ...
Setting up nova-common (2:14.0.0-4+deb9u1) ...
Setting up nova-consoleproxy (2:14.0.0-4+deb9u1) ...
Setting up nova-api (2:14.0.0-4+deb9u1) ...
Will not register nova endpoint this time (no user request for it).
Created symlink /etc/systemd/system/multi-user.target.wants/nova-api.service → /lib/systemd/system/nova-api.service.
Setting up nova-conductor (2:14.0.0-4+deb9u1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nova-conductor.service → /lib/systemd/system/nova-conductor.service.
Setting up nova-scheduler (2:14.0.0-4+deb9u1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nova-scheduler.service → /lib/systemd/system/nova-scheduler.service.
Setting up nova-consoleauth (2:14.0.0-4+deb9u1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nova-consoleauth.service → /lib/systemd/system/nova-consoleauth.service.
Processing triggers for systemd (232-25+deb9u6) ...
root@controller:/home/sandeep#

 

Edit nova configuration file /etc/nova/nova.conf and make necessary configurations

In the [api_database] and [database] sections, configure database access:

[api_database]
...
connection = mysql+pymysql://nova:<password>@controller/nova_api

[database]
...
connection = mysql+pymysql://nova:<password>@controller/nova

In the [DEFAULT] section : Configure RabbitMQ message queue access, auth_strategy, service binding ip, enable support for networking

transport_url = rabbit://openstack:<password>@controller
...
auth_strategy = keystone
...
my_ip = 10.0.0.18
...
use_neutron = True

#Disable computes firewall as networking has its own firewall
firewall_driver = nova.virt.firewall.NoopFirewallDriver

In [keystone_authtoken] section add the following and comment out all other configurations

[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = <password>

In the [vnc] section, configure the VNC proxy to use the management interface IP address of the controller node:

[vnc]
...
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip

In the [glance] section, configure the location of the Image service API:

[glance]
...
api_servers = http://controller:9292

Populate nova and nova_api db

root@controller:/home/sandeep# su -s /bin/sh -c "nova-manage api_db sync" nova
2018-12-02 16:36:10.198 26111 INFO migrate.versioning.api [-] 0 -> 1... 
2018-12-02 16:36:10.274 26111 INFO migrate.versioning.api [-] done
...
...
2018-12-02 16:36:12.495 26111 INFO migrate.versioning.api [-] 19 -> 20... 
2018-12-02 16:36:12.614 26111 INFO migrate.versioning.api [-] done

root@controller:/home/sandeep# su -s /bin/sh -c "nova-manage db sync" nova
WARNING: cell0 mapping not found - not syncing cell0.
2018-12-02 16:36:29.678 26187 INFO migrate.versioning.api [req-0f0450a6-6de3-4147-9cb9-9824c8e99425 - - - - -] 215 -> 216... 
/usr/lib/python2.7/dist-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
2018-12-02 16:36:38.468 26187 INFO migrate.versioning.api [req-0f0450a6-6de3-4147-9cb9-9824c8e99425 - - - - -] done
...
...
2018-12-02 16:36:48.039 26187 INFO migrate.versioning.api [req-0f0450a6-6de3-4147-9cb9-9824c8e99425 - - - - -] 333 -> 334... 
2018-12-02 16:36:48.169 26187 INFO migrate.versioning.api [req-0f0450a6-6de3-4147-9cb9-9824c8e99425 - - - - -] done
root@controller:/home/sandeep#

Restart nova services

root@controller:/home/sandeep# service nova-api restart
root@controller:/home/sandeep# service nova-consoleauth restart
root@controller:/home/sandeep# service nova-scheduler restart
root@controller:/home/sandeep# service nova-conductor restart
root@controller:/home/sandeep# service nova-novncproxy restart
root@controller:/home/sandeep#

After rebooting the controller node found that rabbitmq-server.service was failing on startup.  However if started manually it would start properly.

Searching for probable causes noted that network services do come up, but before ip-binding happens rabbitmq-server was failing.

So edited the file /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service and added Wants and After configuration as follows

[Unit]
Description=RabbitMQ Messaging Server
After=network-online.target
Wants=network-online.target

After this change did not observe failure issue on multiple reboots.