Controller节点: 创建 nova_api, nova,和 nova_cell0 的数据库,授予权限:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ mysql - u root - p MariaDB [(none )]> CREATE DATABASE nova_api; MariaDB [(none )]> CREATE DATABASE nova; MariaDB [(none )]> CREATE DATABASE nova_cell0; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova' @'localhost' IDENTIFIED BY '123456' ; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova' @'%' IDENTIFIED BY '123456' ; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova.* TO 'nova' @'localhost' IDENTIFIED BY '123456' ; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova.* TO 'nova' @'%' IDENTIFIED BY '123456' ; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova' @'localhost' IDENTIFIED BY '123456' ; MariaDB [(none )]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova' @'%' IDENTIFIED BY '123456' ; MariaDB [(none )]> exit;
创建nova用户: $ . admin-openrc
1 2 3 4 5 6 7 8 9 10 11 12 13 $ openstack user create --domain default --password-prompt nova User Password: 123456Repeat User Password: 123456 +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 81f1d5dfad5a42bb806d197ceb9881ce | | name | nova | | options | {} | | password_expires_ at | None |+---------------------+ ----------------------------------+
1 $ openstack role add --project service --user nova admin
创建nova服务实体:
1 2 3 4 5 6 7 8 9 10 $ openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 3e011d345e4442fe8a232ab5ab1f8323 | | name | nova || type | compute | +-------------+----------------------------------+
创建Compute API服务端点:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 343b6a8fc9564623aca0097b2383650d | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 3e011d345e4442fe8a232ab5ab1f8323 | | service_name | nova | | service_ type | compute || url | http://controller:8774/v2.1 | +--------------+----------------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 3458cf55ac8b44d58c949fe88bf9afe3 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 3e011d345e4442fe8a232ab5ab1f8323 | | service_name | nova | | service_ type | compute || url | http://controller:8774/v2.1 | +--------------+----------------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 9f9115389c2a49a2874761b92c849bb0 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 3e011d345e4442fe8a232ab5ab1f8323 | | service_name | nova | | service_ type | compute || url | http://controller:8774/v2.1 | +--------------+----------------------------------+
创建Placement服务相关:
1 2 3 4 5 6 7 8 9 10 11 12 13 $ openstack user create --domain default --password-prompt placement User Password: 123456Repeat User Password: 123456 +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 74870bc86a7c4108869c620099bffc30 | | name | placement | | options | {} | | password_expires_ at | None |+---------------------+ ----------------------------------+
1 $ openstack role add --project service --user placement admin
1 2 3 4 5 6 7 8 9 10 $ openstack service create --name placement --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Placement API | | enabled | True | | id | bbd270a97c3a499fb73765120094e9da | | name | placement || type | placement | +-------------+----------------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne placement public http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | d79b3b62302a4055924762ac676fc9b4 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | bbd270a97c3a499fb73765120094e9da | | service_name | placement | | service_ type | placement || url | http://controller:8778 | +--------------+----------------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne placement internal http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 5424919fbee34a7a92946c607706b38a | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | bbd270a97c3a499fb73765120094e9da | | service_name | placement | | service_ type | placement || url | http://controller:8778 | +--------------+----------------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ openstack endpoint create --region RegionOne placement admin http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | d9d5626cdb5442ac91dff8c1588f4726 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | bbd270a97c3a499fb73765120094e9da | | service_name | placement | | service_ type | placement || url | http://controller:8778 | +--------------+----------------------------------+
安装和配置:
1 # yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 [DEFAULT] my_ip =192.100 .10.160 use_neutron =true firewall_driver =nova.virt.firewall.NoopFirewallDriverenabled_apis =osapi_compute,metadatatransport_url =rabbit://openstack:123456 @controller[api] auth_strategy =keystone[api_database] connection = mysql+pymysql://nova:123456 @controller/nova_api[database] connection = mysql+pymysql://nova:123456 @controller/nova[glance] api_servers = http://controller:9292 [keystone_authtoken] auth_url = http://controller:5000 /v3memcached_servers = controller:11211 auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = 123456 [libvirt] [neutron] url = http://controller:9696 auth_url = http://controller:35357 auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = 123456 service_metadata_proxy = true metadata_proxy_shared_secret = 123456 [oslo_concurrency] lock_path =/var/lib/nova/tmp[placement] os_region_name = RegionOneproject_domain_name = Defaultproject_name = serviceauth_type = passworduser_domain_name = Defaultauth_url = http://controller:5000 /v3username = placementpassword = 123456 [vnc] enabled =true server_listen =$my_ip server_proxyclient_address =$my_ip
1 2 3 4 5 6 7 8 9 10 <Directory /usr/bin> <IfVersion > = 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory>
完成安装:
1 # systemctl restart httpd
1 2 3 4 # su -s /bin/sh -c "nova-manage api_db sync" nova # su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova # su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova # su -s /bin/sh -c "nova-manage db sync" nova
1 2 3 4 5 6 7 # nova-manage cell_v2 list_cells +-------+--------------------------------------+------------------------------------+-------------------------------------------------+ | 名称 | UUID | Transport URL | 数据库连接 | +-------+--------------------------------------+------------------------------------+-------------------------------------------------+ | cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:*** *@controller/nova_cell0 | | cell1 | c795b2eb-4814-4fe7-b9ff-090a1b1b2be5 | rabbit://openstack:****@controller | mysql+pymysql://nova:**** @controller/nova |+-------+ --------------------------------------+------------------------------------+ -------------------------------------------------+
1 2 # systemctl enable openstack-nova-api.service openstack -nova-consoleauth.service openstack -nova-scheduler.service openstack -nova-conductor.service openstack -nova-novncproxy.service # systemctl start openstack-nova-api.service openstack -nova-consoleauth.service openstack -nova-scheduler.service openstack -nova-conductor.service openstack -nova-novncproxy.service
Compute节点: 安装和配置:
1 # yum install openstack-nova-compute
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [DEFAULT] my_ip = 192.100 .10.161 enabled_apis = osapi_compute,metadatause_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDrivertransport_url = rabbit://openstack:123456 @controller[api] auth_strategy = keystone[vnc] enabled = True server_listen = 0.0 .0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080 /vnc_auto.html[glance] api_servers = http://controller:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp[placement] os_region_name = RegionOneproject_domain_name = Defaultproject_name = serviceauth_type = passworduser_domain_name = Defaultauth_url = http://controller:5000 /v3username = placementpassword = 123456 [keystone_authtoken] auth_url = http://controller:5000 /v3memcached_servers = controller:11211 auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = novapassword = 123456
完成安装
1 2 # systemctl enable libvirtd.service openstack-nova-compute.service # systemctl start libvirtd.service openstack-nova-compute.service
Controller节点: 将计算节点添加到cell数据库: $ . admin-openrc
1 2 3 4 5 6 $ openstack compute service list --service nova-compute +----+--------------+-----------------------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+-----------------------+------+---------+-------+----------------------------+ | 9 | nova-compute | localhost.localdomain | nova | enabled | up | 2018-09-13T02:59:06.000000 | +----+--------------+-----------------------+------+---------+-------+----------------------------+
发现计算主机:
1 2 3 4 5 6 7 8 9 10 # 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 .NotSupportedWarningFound 2 cell mappings. Skipping cell0 since it does not contain hosts. Getting computes from cell 'cell1' : c795b2eb-4814 -4 fe7-b9ff-090 a1b1b2be5 Checking host mapping for compute host 'localhost.localdomain' : 58 be78ad-5220 -4869 -ab31-33 c9674ecfd1 Creating host mapping for compute host 'localhost.localdomain' : 58 be78ad-5220 -4869 -ab31-33 c9674ecfd1Found 1 unmapped computes in cell: c795b2eb-4814 -4 fe7-b9ff-090 a1b1b2be5
注意:添加新计算节点时,必须在控制器节点上运行nova-manage cell_v2 discover_hosts以注册这些新计算节点。 或者,您可以在 /etc/nova/nova.conf 中设置适当的间隔:
1 2 [scheduler] discover_hosts_in_cells_interval = 300
验证:$ . admin-openrc
1 2 3 4 5 6 7 8 9 $ openstack compute service list +----+------------------+-----------------------+----------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+------------------+-----------------------+----------+---------+-------+----------------------------+ | 1 | nova-conductor | controller | internal | enabled | up | 2018-09-13T03:00:28.000000 | | 3 | nova-consoleauth | controller | internal | enabled | up | 2018-09-13T03:00:29.000000 | | 4 | nova-scheduler | controller | internal | enabled | up | 2018-09-13T03:00:29.000000 | | 9 | nova-compute | localhost.localdomain | nova | enabled | up | 2018-09-13T03:00:26.000000 | +----+------------------+-----------------------+----------+---------+-------+----------------------------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 $ openstack catalog list +-----------+-----------+-----------------------------------------+ | Name | Type | Endpoints | +-----------+-----------+-----------------------------------------+ | keystone | identity | RegionOne | | | | public: http://controller:5000/v3/ | | | | RegionOne | | | | internal: http://controller:5000/v3/ | | | | RegionOne | | | | admin: http://controller:5000/v3/ | | | | | | nova | compute | RegionOne | | | | public: http://controller:8774/v2.1 | | | | RegionOne | | | | internal: http://controller:8774/v2.1 | | | | RegionOne | | | | admin: http://controller:8774/v2.1 | | | | | | glance | image | RegionOne | | | | internal: http://controller:9292 | | | | RegionOne | | | | admin: http://controller:9292 | | | | RegionOne | | | | public: http://controller:9292 | | | | | | placement | placement | RegionOne | | | | internal: http://controller:8778 | | | | RegionOne | | | | public: http://controller:8778 | | | | RegionOne | | | | admin: http://controller:8778 | | | | | +-----------+-----------+-----------------------------------------+
1 2 3 4 5 6 $ openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | ad7da2d4-cb83-4a41-836f-e58e47e899f5 | cirros | active | +--------------------------------------+--------+--------+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 # nova-status upgrade check /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported exception.NotSupportedWarning Option "os_region_ name" from group "placement" is deprecated. Use option "region-name" from group "placement".+-------------------------------+ | 升级检查结果 | +-------------------------------+ | 检查: Cells v2 | | 结果: 成功 || 详情: None | +-------------------------------+ | 检查: Placement API | | 结果: 成功 || 详情: None | +-------------------------------+ | 检查: Resource Providers | | 结果: 成功 || 详情: None | +-------------------------------+ | 检查: Ironic Flavor Migration | | 结果: 成功 || 详情: None | +-------------------------------+ | 检查: API Service Version | | 结果: 成功 || 详情: None | +-------------------------------+