openstack nova node配置

安裝ntp:html

# timedatectl set-timezone Asia/Shanghainode

安裝時鐘同步:
# yum -y install chronypython

編輯配置文件指向本身的ntp服務器:
# vim /etc/chrony.conf
server keystone iburstlinux

啓動服務並讓服務自啓動:
# systemctl enable chronyd.service
# systemctl start chronyd.servicesql

驗證時間同步狀況:
# chronyc sources
210 Number of sources = 4
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^- 119.79-161-57.customer.l> 2 8 377 337 +33ms[ +33ms] +/- 300ms
^* time4.aliyun.com 2 9 377 89 +1918us[+1920us] +/- 24ms
^+ 120.25.115.19 2 8 377 213 -2585us[-2580us] +/- 28ms
^- static-5-103-139-163.ip.> 1 9 377 10 +72ms[ +72ms] +/- 209ms
安裝openstack客戶端:數據庫

當使用epel源時最好禁用掉epel更新,避免影響到之後openstack的更新
# yum -y install yum-versionlockvim

安裝Queens release源:
# yum -y install centos-release-openstack-queenscentos

下載並安裝RDO存儲庫RPM以啓用OpenStack存儲庫。
# yum -y install https://rdoproject.org/repos/rdo-release.rpmapi

在全部節點上更新包:
# yum -y upgrade瀏覽器

安裝openstack客戶端
# yum -y install python-openstackclient

安裝自動管理selinux組件:
# yum -y install openstack-selinux

安裝compute包:
# yum install openstack-nova-compute
編輯配置文件:
# vim /etc/nova/nova.conf

一、在 [DEFAULT] 部分, 啓用compute 與metadata APIs:
[DEFAULT]
# …
enabled_apis = osapi_compute,metadata

二、在[DEFAULT] 部分, 配置 RabbitMQ message queue 訪問:
[DEFAULT]
# …
transport_url = rabbit://openstack:RABBIT_PASS@controller
transport_url = rabbit://openstack:cisco@nova

用您在RabbitMQ中爲openstack賬戶選擇的密碼替換RABBIT_PASS。

三、在[api] 與 [keystone_authtoken] 部分, 配置 Identity service 訪問:
[api]
# …
auth_strategy = keystone

[keystone_authtoken]
# …
auth_uri = http://keystone:5000
auth_url = http://keystone:35357
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = cisco
將NOVA_PASS替換爲您在Identity Service中爲nova用戶選擇的密碼。

四、在 [DEFAULT] 部分,配置 my_ip 選項:
[DEFAULT]
# …
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
my_ip = 172.16.1.6
將MANAGEMENT_INTERFACE_IP_ADDRESS替換爲計算節點上管理網絡接口的IP地址

五、 在[DEFAULT]部分, 啓動 Networking service:
[DEFAULT]
# …
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
默認狀況下,Compute使用內部防火牆驅動程序。
因爲網絡服務包含防火牆驅動程序,所以必須使用nova.virt.firewall.NoopFirewallDriver防火牆驅動程序禁用Compute防火牆驅動程序。

六、在 [vnc] 部分, 啓動和配置原創 console 訪問:
[vnc]
# …
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://nova:6080/vnc_auto.html

服務器組件偵聽全部IP地址,而且代理組件只偵聽計算節點的管理接口IP地址。 基本URL指示您可使用Web瀏覽器訪問此計算節點上實例的遠程控制檯的位置。
若是用於訪問遠程控制檯的Web瀏覽器,沒法解析控制器主機名的主機上,則必須用控制器節點的管理接口IP地址替換控制器。

七、在[glance] 部分,配置本地 Image service API:
[glance]
# …
api_servers = http://glance:9292

八、在[oslo_concurrency] 部分, 配置應用鎖:
[oslo_concurrency]
# …
lock_path = /var/lib/nova/tmp

九、在 [placement] 部分, 配置 Placement API:
[placement]
# …
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://keystone:35357/v3
username = placement
password = cisco

將PLACEMENT_PASS替換爲您在Identity Service中爲展現位置用戶選擇的密碼。 在[placement]部分註釋掉任何其餘選項。

查看cpu是否支持虛擬化:
# egrep -c ‘(vmx|svm)’ /proc/cpuinfo
1

啓動並設置爲自啓動服務:
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service

將計算節點添加到cell數據庫:
# openstack compute service list –service nova-compute
+—-+————–+——-+——+———+——-+—————————-+
| ID | Binary | Host | Zone | Status | State | Updated At |
+—-+————–+——-+——+———+——-+—————————-+
| 10 | nova-compute | node1 | nova | enabled | up | 2018-04-07T07:43:14.000000 |
+—-+————–+——-+——+———+——-+—————————-+

發現compute hosts:
# su -s /bin/sh -c 「nova-manage cell_v2 discover_hosts –verbose」 nova
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) [‘use_tpool’] not supported
exception.NotSupportedWarning
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell ‘cell1’: ee4f9603-1770-431f-b356-20a5452aa445
Checking host mapping for compute host ‘node1’: 5d037782-4579-428d-9cf0-4ddec767d47e
Creating host mapping for compute host ‘node1’: 5d037782-4579-428d-9cf0-4ddec767d47e
Found 1 unmapped computes in cell: ee4f9603-1770-431f-b356-20a5452aa445

添加新計算節點時,必須在控制器節點上運行nova-manage cell_v2 discover_hosts以註冊這些新計算節點。 或者,您能夠在/etc/nova/nova.conf中設置適當的時間間隔:

[scheduler] discover_hosts_in_cells_interval = 300