Nova in OpenStack
What is nova?
Nova is the OpenStack project that provides a way to provision compute instances (aka virtual servers). Nova supports creating virtual machines, bare-metal 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.
- DB: sql database for data storage.
- API: component that receives HTTP requests, converts commands and communicates with other components via the oslo.messaging queue or HTTP.
- Scheduler: decides which host gets each instance.
- Compute: manages communication with hypervisor and virtual machines.
- Conductor: handles requests that need coordination (build/resize), acts as a database proxy, or handles object conversions.
- Placement: tracks resource provider inventories and usages.
1- Create the Compute service credentials:
Create the nova
user:
#openstack user create --domain default --project PROJECTNAME --password-prompt nova
Add the admin
role to the nova
user:
#openstack role add --project PROJECTNAME --user nova admin
Create the nova
service entity:
#openstack service create --name nova \
--description "OpenStack Compute" compute
2-Create the Compute API service endpoints:
#openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1
#openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1
#openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1
Create Database
you must create a database, service credentials, and API endpoints for nova,nova_api,nova_cell0,placement.
# mysql -u root -pMariaDB [(none)]>create database nova;
MariaDB [(none)]>create database nova_api;
MariaDB [(none)]>create database nova_cell0;
MariaDB [(none)]>grant all privileges on nova.* to nova@'%' identified by 'NOVA_DBPASS';
MariaDB [(none)]>grant all privileges on nova.* to nova@'localhost' identified by 'NOVA_DBPASS';
MariaDB [(none)]>grant all privileges on nova_api.* to nova@'%' identified by 'NOVA_DBPASS';
MariaDB [(none)]>grant all privileges on nova_api.* to nova@'localhost' identified by 'NOVA_DBPASS';
MariaDB [(none)]>grant all privileges on nova_cell0.* to nova@'%' identified by 'NOVA_DBPASS';
MariaDB [(none)]>grant all privileges on nova_cell0.* to nova@'localhost' identified by 'NOVA_DBPASS';
Install and configure components
# yum --enablerepo=centos-openstack-train install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
Edit the /etc/nova/nova.conf
file and complete the following actions:
In the [DEFAULT]
section, configure the my_ip
option to use the management interface IP address of the controller node:
my_ip = management ip(controller ip)
set management ip whether for controller or computer.
In production environments, we must have at least two of these IPs.
In the [DEFAULT]
section, enable only the compute and metadata APIs:
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
metadata works between nova and neutron.
The top-level directory for maintaining Nova’s state.
[DEFAULT]
# ...
state_path=/var/lib/nova
In the [oslo_concurrency]
section, configure the lock path:
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
In the [DEFAULT]
section, configure RabbitMQ
message queue access:
[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/
- Replace
RABBIT_PASS
with the password you chose for theopenstack
account inRabbitMQ
.
In the [glance]
section, configure the location of the Image service API:
[glance]
# ...
api_servers = http://controller:9292
In the [api]
and [keystone_authtoken]
sections, configure Identity service access:
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = NOVA_PASS
Replace NOVA_PASS
with the password you chose for the nova
user in the Identity service.
In the [placement]
section, configure access to the Placement service:
[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS
- Replace
PLACEMENT_PASS
with the password you choose for theplacement
service user created when installing Placement. Comment out or remove any other options in the[placement]
section.
In the [api_database]
and [database]
sections, configure database access:
[api_database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
[database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
In the [vnc]
section, configure the VNC proxy to use the management interface IP address of the controller node:
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip
Public address of noVNC VNC console proxy.
[vnc]
novncproxy_base_url=http://controller:6080/vnc_auto.html
Private, internal IP address or hostname of VNC console proxy.
[vnc]
server_proxyclient_address=controller
🌗This option represents a file name for the paste.deploy config for nova-api.
api_paste_config=api-paste.ini
Populate the nova-api
database:
su -s /bin/sh -c "nova-manage api_db sync" nova
Ignore any deprecation messages in this output.
Register the cell0
database:
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
Create the cell1
cell:
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
Populate the nova database:
su -s /bin/sh -c "nova-manage db sync" nova
Verify nova cell0 and cell1 are registered correctly:
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
Start the Compute services and configure them to start when the system boots:
# systemctl enable \
openstack-nova-api.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
# systemctl start \
openstack-nova-api.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
check your compute service list by:
# openstack compute service list
Install and configure Placement
- We also need to do the 1 and 2 items for the user placement.
#openstack user create --domain default --project PROJECTNAME --password-prompt placement#openstack role add --project PROJECTNAME --user placement admin#openstack service create --name placement \
--description "Placement API" placement#openstack endpoint create --region RegionOne \
placement public http://controller:8778
#openstack endpoint create --region RegionOne \
placement internal http://controller:8778
#openstack endpoint create --region RegionOne \
placement admin http://controller:8778
Create Database
Use the database access client to connect to the database server as the root
user:
$ mysql -u root -pMariaDB [(none)]>create database placement;MariaDB [(none)]>grant all privileges on placement.* to placement@'%' identified by 'PLACEMENT_DBPASS';
MariaDB [(none)]>grant all privileges on placement.* to placement@'localhost' identified by 'PLACEMENT_DBPASS';
Replace PLACEMENT_DBPASS
with a suitable password.
Install and configure components
you just need config placement on the controller.
Edit the /etc/placement/placement.conf
file and complete the following actions:
In the [placement_database]
section, configure database access:
[placement_database]
# ...
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement
- Replace
PLACEMENT_DBPASS
with the password you chose for the placement database.
In the [api]
and [keystone_authtoken]
sections, configure Identity service access:
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS
Replace PLACEMENT_PASS
with the password you chose for the placement
user in the Identity service.
Comment out or remove any other options in the [keystone_authtoken]
section.
The value of user_name
, password
, project_domain_name
and user_domain_name
need to be in sync with your keystone config.
Populate the placement
database:
# su -s /bin/sh -c "placement-manage db sync" placement
Restart the httpd service:
# systemctl restart httpd
if you have any problem lets see placement.api.log
compute
OpenStack Compute supports many hypervisors, which might make it difficult for you to choose one.
KVM is configured as the default hypervisor for Compute.
To determine whether the svm or vmx CPU extensions are present, run this command:
grep -E 'svm|vmx' /proc/cpuinfo
To list the loaded kernel modules and verify that the kvm modules are loaded, run this command:
# lsmod | grep kvm
Install KVM
# yum install qemu-kvm libvirt virt-install
The KVM hypervisor supports the following virtual machine image formats:
- Raw
- QEMU Copy-on-write (qcow2)
- QED Qemu Enhanced Disk
- VMware virtual machine disk format (vmdk)
start kvm module in kernel by start libvirtd
# systemctl start libvirtd
# systemctl enable libvirtd
Install and configure a compute node
This section describes how to install and configure the Compute service on a compute node.The service supports several hypervisors to deploy instances or virtual machines (VMs). For simplicity, this configuration uses the Quick EMUlator (QEMU) hypervisor with the kernel-based VM (KVM) extension on compute nodes that support hardware acceleration for virtual machines.
Install and configure components
Install the packages:
# yum --enablerepo=centos-openstack-train install openstack-nova-compute
Edit the /etc/nova/nova.conf
file and complete the following actions:
In the [DEFAULT]
section, enable only the compute and metadata APIs:
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
To enable KVM explicitly, add the following configuration options to the /etc/nova/nova.conf file:
compute_driver = libvirt.LibvirtDriver
[libvirt]
virt_type = kvm
vim /etc/httpd/conf.d/00-placement-api.conf
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
restart compute node with httpd:
#systemctl restart httpd
you can see nova-compute in list
#openstack compute service list
Add the compute node to the cell database
Run the following commands on the controller node.
Discover compute hosts:
# sudo -u nova nova-manage cell_v2 list_hosts# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Start the Compute service including its dependencies and configure them to start automatically when the system boots:
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
The more customized your nova, the better the performance.
congratulation ! nova is ready.
next :
- we will learn about neutron
If you have any questions/comments please comment below so everyone can benefit from the discussion.