IT/Openstack

[Openstack-rocky] Ubuntu에 Openstack 설치 하기(4) - nova(compute) 설치

louky 2019. 8. 16. 12:24
반응형

 

 

code-name 

  •    keystone

  •    glance

  •    nova

  •    neutron 

 

 

 

공통 환경 변수 

controller_name="controller"
controller_ip="10.168.0.101"

 

DB_PW="maria.123"

KEYSTONE_PW="keystone.123"

GLANCE_PW="glance.123"

RABBIT_PW="rabbit.123"

NOVA_PW="nova.123"

PLACEMENT_PW="placement.123"

NEUTRON_PW="neutron.123"

META_PW="meta.123"

 

 

 

Nova install ( All node)

 

 

A. Controller node Install 

A-1.  nova databases 생성 

- DB 생성 전 확인 

root@rocky-osc:~# mysql -uroot -pmaria.123 -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
+--------------------+

 

- DB  생성

root@rocky-osc:~# mysql -uroot -pmaria.123 -e "CREATE DATABASE nova_api;"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "CREATE DATABASE nova"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "CREATE DATABASE nova_cell0;"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "CREATE DATABASE nova_api_cell0;"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "CREATE DATABASE placement;"

 

- DB 생성 후 확인 

root@rocky-osc:~# mysql -uroot -pmaria.123 -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| placement          |
+--------------------+

 

 

A-2.  nova databases 권한 설정

  • nova_api db
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova.123';"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'  IDENTIFIED BY 'nova.123';"
  • nova db
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost'   IDENTIFIED BY 'nova.123';"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'  IDENTIFIED BY 'nova.123';"
  • nova_cell0 db
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost'  IDENTIFIED BY 'nova.123';"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova.123';"
  • nova_api_cell0 db
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_api_cell0.* TO 'nova'@'localhost'  IDENTIFIED BY 'nova.123';"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON nova_api_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova.123';"
  • placement db
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost'  IDENTIFIED BY 'placement.123';"
root@rocky-osc:~# mysql -uroot -pmaria.123 -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%'   IDENTIFIED BY 'placement.123';"

 

A-3. admin환경 변수 loading

환경변수파일 설정 방법 => 2019/08/16 - [IT/Openstack] - [Openstack-rocky] Ubuntu에 Openstack 설치 하기(1) - openstack PKG 설치

root@rocky-osc:~# source /root/admin_openrc

 

A-4. openstack user nova 생성

root@rocky-osc:~# openstack user create --domain default --password nova.123 nova
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 53f047c716da4503912820033b7c472d |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

 

A-5. admin role에 nova 추가  

root@rocky-osc:~# openstack role add --project service --user nova admin

 

A-6. nova service 생성

root@rocky-osc:~# openstack service create --name nova \
  --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 762433d5266f4179b4ac372574c050c8 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+

 

A-7 nova service endpoint  생성

root@rocky-osc:~# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 5104571dc70c48d88f755205ca387f7d |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 762433d5266f4179b4ac372574c050c8 |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+
root@rocky-osc:~#
root@rocky-osc:~# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | e38b1893e35d4786be6b6770ed5d37e7 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 762433d5266f4179b4ac372574c050c8 |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+
root@rocky-osc:~#
root@rocky-osc:~# openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | a956c152c319415db8c8d47ca9633df8 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 762433d5266f4179b4ac372574c050c8 |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+

 

 

#### Placement 

A-8 placement user 생성 

root@rocky-osc:~# openstack user create --domain default --password ${PLACEMENT_PW} placement
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | b258802e135e4033b010af22e55a6b45 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

 

A-9 admin role에 placement 추가 

root@rocky-osc:~# openstack role add --project service --user placement admin

 

A-10 placement service 생성

root@rocky-osc:~# openstack service create --name placement  --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 9cf33f70ba18464892923642182c0fce |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

 

A-11 placement endpoint  생성 

root@rocky-osc:~# openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | ea4dae8f60664cb89e949422de36227d |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9cf33f70ba18464892923642182c0fce |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
root@rocky-osc:~#
root@rocky-osc:~# openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7b8fca8ad70c4472becdf1dca071b364 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9cf33f70ba18464892923642182c0fce |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
root@rocky-osc:~#
root@rocky-osc:~# openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | febca2e2236c44879177960d84684dcc |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9cf33f70ba18464892923642182c0fce |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
root@rocky-osc:~#

 

A-12 nova Install 

A-12-01. PKG install 

root@rocky-osc:~# apt install nova-api nova-conductor nova-consoleauth nova-novncproxy nova-scheduler nova-placement-api -y

 

A-12-02. Config 원본 백업

root@rocky-osc:~# mv -f /etc/nova/nova.conf  /etc/nova/nova.conf.orig

 

A-12-03. Config 수정

root@rocky-osc:~# echo "[DEFAULT]
log_dir = /var/log/nova
lock_path = /var/lock/nova
state_path = /var/lib/nova

transport_url = rabbit://openstack:rabiit.123@controller
my_ip = 10.168.0.101
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

vif_plugging_is_fatal = False
vif_plugging_timeout = 0

## flavor resize config 
allow_resize_to_same_host=true

[api]
auth_strategy = keystone

[api_database]
#connection = sqlite:////var/lib/nova/nova_api.sqlite
connection = mysql+pymysql://nova:nova.123@controller/nova_api

[barbican]

[cache]

[cells]
enable = False

[cinder]

[compute]

[conductor]

[console]

[consoleauth]

[cors]

[database]
#connection = sqlite:////var/lib/nova/nova.sqlite
connection = mysql+pymysql://nova:nova.123@controller/nova_api

[devices]

[ephemeral_storage_encryption]

[filter_scheduler]

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

[guestfs]

[healthcheck]

[hyperv]

[ironic]

[key_manager]

[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 = nova
password = nova.123

[libvirt]

[matchmaker_redis]

[metrics]

[mks]

[neutron]

[notifications]

[osapi_v21]

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[pci]

[placement]
os_region_name = openstack
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.123

[placement_database]
connection = mysql+pymysql://placement:placement.123@controller/placement

[powervm]

[profiler]

[quota]

[rdp]

[remote_debug]

[scheduler]

[serial_console]

[service_user]

[spice]

[upgrade_levels]

[vault]

[vendordata_dynamic_auth]

[vmware]

[vnc]
enabled = true
server_listen = \$my_ip
server_proxyclient_address = \$my_ip

[workarounds]

[wsgi]

[xenserver]

[xvp]

[zvm]
" > /etc/nova/nova.conf

 

A-12-04 Config 파일  Permission 변경

root@rocky-osc:~# chown -R root.nova /etc/nova/nova.conf

 

A-13 nova/placement  databases tables  생성 

  • DB tables 생성 전 확인 

root@rocky-osc:~# mysql -uroot -pmaria.123 nova -e "show tables;"
root@rocky-osc:~# mysql -uroot -pmaria.123 nova_api -e "show tables;"
root@rocky-osc:~# mysql -uroot -pmaria.123 nova_cell0 -e "show tables;"
root@rocky-osc:~# mysql -uroot -pmaria.123 placement -e "show tables;"

 

  • Nova_api / Placement DB tables 생성 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage api_db sync" nova

 

  • Nova_api / Placement DB tables생성 확인

root@rocky-osc:~# mysql -uroot -pmaria.123 nova_api -e "show tables;"
+------------------------------+
| Tables_in_nova_api           |
+------------------------------+
| aggregate_hosts              |
| aggregate_metadata           |
| aggregates                   |
| allocations                  |
| build_requests               |
| cell_mappings                |
| consumers                    |
| flavor_extra_specs           |
| flavor_projects              |
| flavors                      |
| host_mappings                |
| instance_group_member        |
| instance_group_policy        |
| instance_groups              |
| instance_mappings            |
| inventories                  |
| key_pairs                    |
| migrate_version              |
| placement_aggregates         |
| project_user_quotas          |
| projects                     |
| quota_classes                |
| quota_usages                 |
| quotas                       |
| request_specs                |
| reservations                 |
| resource_classes             |
| resource_provider_aggregates |
| resource_provider_traits     |
| resource_providers           |
| traits                       |
| users                        |
+------------------------------+
 
root@rocky-osc:~# mysql -uroot -pmaria.123 placement -e "show tables;"
+------------------------------+
| Tables_in_placement          |
+------------------------------+
| aggregate_hosts              |
| aggregate_metadata           |
| aggregates                   |
| allocations                  |
| build_requests               |
| cell_mappings                |
| consumers                    |
| flavor_extra_specs           |
| flavor_projects              |
| flavors                      |
| host_mappings                |
| instance_group_member        |
| instance_group_policy        |
| instance_groups              |
| instance_mappings            |
| inventories                  |
| key_pairs                    |
| migrate_version              |
| placement_aggregates         |
| project_user_quotas          |
| projects                     |
| quota_classes                |
| quota_usages                 |
| quotas                       |
| request_specs                |
| reservations                 |
| resource_classes             |
| resource_provider_aggregates |
| resource_provider_traits     |
| resource_providers           |
| traits                       |
| users                        |
+------------------------------+
root@rocky-osc:~#

 

 

A-14 nova_cell0  database 등록 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

A-15 Cell1 cell생성 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
12a5c5d5-26b6-46da-9458-5c116e0743d9

 

A-16 nova cell0과 cell1 등록 확인 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+
|  Name |                 UUID                 |           Transport URL            |               Database Connection               | Disabled |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |               none:/               | mysql+pymysql://nova:****@controller/nova_cell0 |  False   |
| cell1 | 12a5c5d5-26b6-46da-9458-5c116e0743d9 | rabbit://openstack:****@controller |    mysql+pymysql://nova:****@controller/nova    |  False   |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+----------+

 

A-17 nova pkg daemon 재시작

root@rocky-osc:~# service nova-api restart
root@rocky-osc:~# service nova-consoleauth restart
root@rocky-osc:~# service nova-scheduler restart
root@rocky-osc:~# service nova-conductor restart
root@rocky-osc:~# service nova-novncproxy restart

 

 

B. Compute node Install 

 

 

B-1 nova-compute pkg install 

root@rocky-nova01:~# apt install nova-compute -y

 

B-2 Config 원본파일 백업

root@rocky-nova01:~# mv -f  /etc/nova/nova.conf    /etc/nova/nova.conf.orig

 

B-3 Config 수정 

echo "[DEFAULT]
log_dir = /var/log/nova
lock_path = /var/lock/nova
state_path = /var/lib/nova


transport_url = rabbit://openstack:rabbit.123@controller
my_ip = 10.168.0.111
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver


[api]
auth_strategy = keystone


[api_database]
connection = sqlite:////var/lib/nova/nova_api.sqlite


[barbican]


[cache]


[cells]
enable = False


[cinder]


[compute]


[conductor]


[console]


[consoleauth]


[cors]


[database]
connection = sqlite:////var/lib/nova/nova.sqlite


[devices]


[ephemeral_storage_encryption]


[filter_scheduler]


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


[guestfs]


[healthcheck]


[hyperv]


[ironic]


[key_manager]


[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 = nova
password = nova.123


[libvirt]


[matchmaker_redis]


[metrics]


[mks]


[neutron]


[notifications]


[osapi_v21]


[oslo_concurrency]


lock_path = /var/lib/nova/tmp


[oslo_messaging_amqp]


[oslo_messaging_kafka]


[oslo_messaging_notifications]


[oslo_messaging_rabbit]


[oslo_messaging_zmq]


[oslo_middleware]


[oslo_policy]


[pci]


[placement]
os_region_name = openstack
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.123


[placement_database]


[powervm]


[profiler]


[quota]


[rdp]


[remote_debug]


[scheduler]


[serial_console]


[service_user]


[spice]


[upgrade_levels]


[vault]


[vendordata_dynamic_auth]


[vmware]


[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html


[workarounds]


[wsgi]


[xenserver]


[xvp]


[zvm]" > /etc/nova/nova.conf

 

B-3-1. CPU 가상화 지원 여부 확인 

root@rocky-nova01:~# egrep -c '(vmx|svm)' /proc/cpuinfo
48

 

결과 값이 0일 경우 아래와 같이 설정한다. 

 

# sed -i "s/virt_type=kvm/\#virt_type=kvm/g" /etc/nova/nova-compute.conf
# echo "virt_type = qemu" >> /etc/nova/nova-compute.conf

B-4. nova pkg 를 재기동한다. 

root@rocky-nova01:~# service nova-compute restart

 

 

C. 확인 

 

C-1. Controller node에서  admin_openrc 환경변수 파일을  loading한다. 

root@rocky-osc:~# source ~/admin_openrc

 

C-2. nova compute 리스트를 확인한다. 

root@rocky-osc:~# openstack compute service list --service nova-compute
+----+--------------+--------------+------+---------+-------+----------------------------+
| ID | Binary       | Host         | Zone | Status  | State | Updated At                 |
+----+--------------+--------------+------+---------+-------+----------------------------+
| 13 | nova-compute | rocky-nova01 | nova | enabled | up    | 2019-03-07T08:56:29.000000 |
+----+--------------+--------------+------+---------+-------+----------------------------+

 

 

C-3. nova 명령어를 이용하여 compute node의  host를 확인한다. 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell 'cell1': 12a5c5d5-26b6-46da-9458-5c116e0743d9
Checking host mapping for compute host 'rocky-nova01': a4868098-f27b-4a75-8488-5942ded945cf
Creating host mapping for compute host 'rocky-nova01': a4868098-f27b-4a75-8488-5942ded945cf
Found 1 unmapped computes in cell: 12a5c5d5-26b6-46da-9458-5c116e0743d9

 

 

새 노드를 추가할때 controller node에서 아래 명령어를 실행해야 한다. 

root@rocky-osc:~# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

또는 /etc/nova/nova.conf 에 등록하여 특정 주기별로 노드를 추가 한다. 

 

root@rocky-osc:~# vi /etc/nova/nova.conf
~ (생략)
[scheduler]
discover_hosts_in_cells_interval = 300
~
(...저장)

 

참고 : https://docs.openstack.org/nova/rocky/install/compute-install-ubuntu.html

반응형