Ubuntu 16.04
Sponsored Link

OpenStack Newton : Configure Nova2016/11/15

 
Install and Configure OpenStack Compute Service (Nova).
[1]
Install KVM HyperVisor like here.
It's unnecessarry to set Bridge networking manually.
[2] Add users and others for Nova in Keystone.
# add nova user (set in service project)

root@dlp ~(keystone)#
openstack user create --domain default --project service --password servicepassword nova

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | e2fed44089aa40dc88f5ae6ed9dfe915 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | d9095af58c874a85915d651d63c21530 |
| name                | nova                             |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# add nova user in admin role

root@dlp ~(keystone)#
openstack role add --project service --user nova admin
# add service entry for nova

root@dlp ~(keystone)#
openstack service create --name nova --description "OpenStack Compute service" compute

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute service        |
| enabled     | True                             |
| id          | ed377d86b12b4ab7b45f8a445f569756 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

# define keystone host

root@dlp ~(keystone)#
export controller=10.0.0.30
# add endpoint for nova (public)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne compute public http://$controller:8774/v2.1/%\(tenant_id\)s

+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | 1f61b3c544ce4ac69d4f5b3b10ca09b2         |
| interface    | public                                   |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | ed377d86b12b4ab7b45f8a445f569756         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+

# add endpoint for nova (internal)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2.1/%\(tenant_id\)s

+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | 21e123b663004b8193cf1ba9f0ad5498         |
| interface    | internal                                 |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | ed377d86b12b4ab7b45f8a445f569756         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+

# add endpoint for nova (admin)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2.1/%\(tenant_id\)s

+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | d605f2d3dac349249856a206c3cfd513         |
| interface    | admin                                    |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | ed377d86b12b4ab7b45f8a445f569756         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.30:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
[2] Install Nova.
root@dlp ~(keystone)#
apt-get -y install nova-api nova-cert nova-conductor nova-consoleauth nova-scheduler nova-novncproxy nova-compute-kvm python-novaclient
[3] Add a User and Database on MariaDB for Nova.
root@dlp ~(keystone)#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

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)]>
create database nova_api;

Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on nova.* to nova@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on nova.* to nova@'%' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on nova_api.* to nova@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on nova_api.* to nova@'%' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
exit

Bye
[4] Configure Nova.
root@dlp ~(keystone)#
mv /etc/nova/nova.conf /etc/nova/nova.conf.org

root@dlp ~(keystone)#
vi /etc/nova/nova.conf
# create new

[DEFAULT]
# define own IP

my_ip = 10.0.0.30
state_path = /var/lib/nova
enabled_apis = osapi_compute,metadata
osapi_compute_listen = 0.0.0.0
osapi_compute_listen_port = 8774
rootwrap_config = /etc/nova/rootwrap.conf
api_paste_config = /etc/nova/api-paste.ini
auth_strategy = keystone
log_dir = /var/log/nova
rpc_backend = rabbit
# enable VNC

[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://10.0.0.30:6080/vnc_auto.html
# specify Glance server connection info

[glance]
api_servers = http://10.0.0.30:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
# specify RabbitMQ server connection info

[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password
# specify MariaDB server connection info

[api_database]
connection = mysql+pymysql://nova:password@10.0.0.30/nova_api
[database]
connection = mysql+pymysql://nova:password@10.0.0.30/nova
# specify Keystone server connection info

[keystone_authtoken]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = servicepassword
root@dlp ~(keystone)#
chmod 640 /etc/nova/nova.conf

root@dlp ~(keystone)#
chgrp nova /etc/nova/nova.conf

[5] Configure Networking. The follows is for the case you use legacy nova-network function.
But if you use Neutron Networking function, Refer to here to configure it.
Anyway, legacy nova-network function is officially not recommended.
root@dlp ~(keystone)#
apt-get -y install nova-network

root@dlp ~(keystone)#
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf

root@dlp ~(keystone)#
sysctl -p

net.ipv4.ip_forward = 1
root@dlp ~(keystone)#
vi /etc/nova/nova.conf
# add follows in [DEFAULT] section

use_neutron = False
dhcpbridge_flagfile = /etc/nova/nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
force_dhcp_release = True
libvirt_use_virtio_for_bridges = True
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
linuxnet_interface_driver = nova.network.linux_net.LinuxBridgeInterfaceDriver
firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
network_manager = nova.network.manager.FlatDHCPManager
network_size = 254
allow_same_net_traffic = False
multi_host = True
send_arp_for_ha = True
share_dhcp_address = True
force_dhcp_release = True
# specify nic for public

public_interface = eth0
# specify any name you like for bridge

flat_network_bridge = br100
# specify nic for flat DHCP bridge

flat_interface = dummy0
root@dlp ~(keystone)#
modprobe dummy

root@dlp ~(keystone)#
echo "alias dummy0 dummy" > /etc/modprobe.d/dummy.conf

root@dlp ~(keystone)#
vi /etc/network/interfaces
# add to the end

auto dummy0
iface dummy0 inet manual
root@dlp ~(keystone)#
ifup dummy0
[6] Start Nova Service.
If you don't use legacy nova-network, exclude the word "network" below.
root@dlp ~(keystone)#
su -s /bin/bash nova -c "nova-manage api_db sync"

root@dlp ~(keystone)#
su -s /bin/bash nova -c "nova-manage db sync"

root@dlp ~(keystone)#
for service in api conductor scheduler cert consoleauth compute novncproxy network; do
systemctl restart nova-$service
done
# show status

root@dlp ~(keystone)#
nova service-list

+----+------------------+---------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host          | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+---------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-consoleauth | dlp.srv.world | internal | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
| 2  | nova-scheduler   | dlp.srv.world | internal | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
| 3  | nova-conductor   | dlp.srv.world | internal | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
| 4  | nova-cert        | dlp.srv.world | internal | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
| 5  | nova-compute     | dlp.srv.world | nova     | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
| 6  | nova-network     | dlp.srv.world | internal | enabled | up    | 2016-11-18T05:00:18.000000 | -               |
+----+------------------+---------------+----------+---------+-------+----------------------------+-----------------+
Matched Content