Nova
概述
Use OpenStack Compute to host and manage cloud computing systems. OpenStack Compute is a major part of an Infrastructure-as-a-Service (IaaS) system. The main modules are implemented in Python.
OpenStack Compute interacts with OpenStack Identity for authentication; OpenStack Image service for disk and server images; and OpenStack Dashboard for the user and administrative interface. Image access is limited by projects, and by users; quotas are limited per project (the number of instances, for example). OpenStack Compute can scale horizontally on standard hardware, and download images to launch instances.
OpenStack Compute consists of the following areas and their components:
nova-api service
Accepts and responds to end user compute API calls. The service supports the OpenStack Compute API, the Amazon EC2 API, and a special Admin API for privileged users to perform administrative actions. It enforces some policies and initiates most orchestration activities, such as running an instance.
nova-api-metadata service
Accepts metadata requests from instances. The nova-api-metadata service is generally used when you run in multi-host mode with nova-network installations. For details, see Metadata service in the Compute Administrator Guide.
nova-compute service
A worker daemon that creates and terminates virtual machine instances through hypervisor APIs. For example:XenAPI for XenServer/XCPlibvirt for KVM or QEMUVMwareAPI for VMwareProcessing is fairly complex. Basically, the daemon accepts actions from the queue and performs a series of system commands such as launching a KVM instance and updating its state in the database.
nova-placement-api service
Tracks the inventory and usage of each provider. For details, see Placement API.
nova-scheduler service
Takes a virtual machine instance request from the queue and determines on which compute server host it runs.
nova-conductor module
Mediates interactions between the nova-compute service and the database. It eliminates direct accesses to the cloud database made by the nova-compute service. The nova-conductor module scales horizontally. However, do not deploy it on nodes where the nova-compute service runs. For more information, see the conductor section in the Configuration Options.
nova-consoleauth daemon
Authorizes tokens for users that console proxies provide. See nova-novncproxy and nova-xvpvncproxy. This service must be running for console proxies to work. You can run proxies of either type against a single nova-consoleauth service in a cluster configuration. For information, see About nova-consoleauth.
nova-novncproxy daemon
Provides a proxy for accessing running instances through a VNC connection. Supports browser-based novnc clients.
nova-spicehtml5proxy daemon
Provides a proxy for accessing running instances through a SPICE connection. Supports browser-based HTML5 client.
nova-xvpvncproxy daemon
Provides a proxy for accessing running instances through a VNC connection. Supports an OpenStack-specific Java client.
The queue
A central hub for passing messages between daemons. Usually implemented with RabbitMQ, also can be implemented with another AMQP message queue, such as ZeroMQ.
SQL database
Stores most build-time and run-time states for a cloud infrastructure, including:
-
Available instance types
-
Instances in use
-
Available networks
-
Projects
Theoretically, OpenStack Compute can support any database that SQLAlchemy supports. Common databases are SQLite3 for test and development work, MySQL, MariaDB, and PostgreSQL.
安装和配置 控制节点
前置条件
1、创建数据库并授权
- 使用 root 用户登录数据库
mysql -u root -p000000
- 创建 nova_api、nova 和 nova_cell0 数据库
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
- 对 nova用户 授权
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
IDENTIFIED BY '000000';
2、获取 admin 凭证
. admin-openrc
3、创建 计算服务凭证
- 创建 nova用户
openstack user create --domain default --password 000000 nova
- 将 service项目 中 nova用户,设置为 admin角色
openstack role add --project service --user nova admin
- 创建 nova服务实体
openstack service create --name nova --description "OpenStack Compute" compute
4、创建 计算服务 API 端点
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
5、创建 placement 凭证
- 创建 placement 用户
openstack user create --domain default --password 000000 placement
- 将 service项目 中 placement 用户,设置为 admin角色
openstack role add --project service --user placement admin
- 创建 nova服务实体
openstack service create --name placement --description "Placement API" placement
6、创建 placement API端点
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
{collapse-item label="查看执行过程"}
前置条件
[root@controller ~]# mysql -u root -p000000
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.1.20-MariaDB MariaDB Server
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_api;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> CREATE DATABASE nova;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> CREATE DATABASE nova_cell0;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack user create --domain default --password 000000 nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8d9a97f85a7845deb20d54bc468bb549 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user nova admin
[root@controller ~]# openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 4fce66abb9794a1796874dd4a5d8bf34 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 938784c1725e497b933016403c535c10 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4fce66abb9794a1796874dd4a5d8bf34 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 9d357f7717134d228e51c484837104ac |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4fce66abb9794a1796874dd4a5d8bf34 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 08ba2de0acfd45d3bd4892f1d3f17287 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4fce66abb9794a1796874dd4a5d8bf34 |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1 |
+--------------+----------------------------------+
[root@controller ~]# openstack user create --domain default --password 000000 placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 458722588d03402eb1ceab933c9d4045 |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user placement admin
[root@controller ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Placement API |
| enabled | True |
| id | 3aa8d5df8bff4099831826e202972ab6 |
| name | placement |
| type | placement |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 2f9f6ac1ad5f4bd38eb1ac2607cb0b80 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3aa8d5df8bff4099831826e202972ab6 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 58613208c94d41c89787783d25812098 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3aa8d5df8bff4099831826e202972ab6 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 009e3cc34fb342e3bdde0e5c8d3d8c80 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 3aa8d5df8bff4099831826e202972ab6 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
{/collapse-item}
安装和配置组件
1、安装软件包
yum install -y openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api
2、配置 nova.conf
sed -i.bak '/^#/d;/^$/d' /etc/nova/nova.conf
vim /etc/nova/nova.conf
[DEFAULT]
# 仅启用计算和元数据API
enabled_apis = osapi_compute,metadata
# 配置RabbitMQ消息队列访问
transport_url = rabbit://openstack:000000@controller
# 控制器节点的管理IP
my_ip = 178.120.2.10
# 启用对网络服务的支持
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
# 配置数据库访问
connection = mysql+pymysql://nova:000000@controller/nova_api
[database]
# 配置数据库访问
connection = mysql+pymysql://nova:000000@controller/nova
[api]
# 配置身份服务访问
auth_strategy = keystone
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
[vnc]
enabled = true
# VNC代理配置为 使用控制器节点的管理接口IP地址
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
# 配置图像服务API的位置
api_servers = http://controller:9292
[oslo_concurrency]
# 配置锁定路径
lock_path = /var/lib/nova/tmp
[placement]
# 配置 Placement API
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000
3、配置 00-nova-placement-api.conf
vim /etc/httpd/conf.d/00-nova-placement-api.conf
# 启用对 Placement API 的访问
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
4、同步 nova 数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
5、数据库同步
- 注册 cell0 数据库
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
- 创建 cell1 单元格
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
- 同步 nova 数据库
su -s /bin/sh -c "nova-manage db sync" nova
5、验证 nova、cell0 和 cell1 成功注册
nova-manage cell_v2 list_cells
{collapse-item label="查看执行过程"}
安装和配置组件
[root@controller ~]# yum install -y openstack-nova-api openstack-nova-conductor \
> openstack-nova-console openstack-nova-novncproxy \
> openstack-nova-scheduler openstack-nova-placement-api
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package openstack-nova-api.noarch 1:16.1.6-1.el7 will be installed
--> Processing Dependency: openstack-nova-common = 1:16.1.6-1.el7 for package: 1:openstack-nova-api-16.1.6-1.el7.noarch
---> Package openstack-nova-conductor.noarch 1:16.1.6-1.el7 will be installed
---> Package openstack-nova-console.noarch 1:16.1.6-1.el7 will be installed
--> Processing Dependency: python-websockify >= 0.8.0 for package: 1:openstack-nova-console-16.1.6-1.el7.noarch
---> Package openstack-nova-novncproxy.noarch 1:16.1.6-1.el7 will be installed
--> Processing Dependency: novnc for package: 1:openstack-nova-novncproxy-16.1.6-1.el7.noarch
---> Package openstack-nova-placement-api.noarch 1:16.1.6-1.el7 will be installed
---> Package openstack-nova-scheduler.noarch 1:16.1.6-1.el7 will be installed
--> Running transaction check
---> Package novnc.noarch 0:0.5.1-2.el7 will be installed
---> Package openstack-nova-common.noarch 1:16.1.6-1.el7 will be installed
--> Processing Dependency: python-nova = 1:16.1.6-1.el7 for package: 1:openstack-nova-common-16.1.6-1.el7.noarch
---> Package python-websockify.noarch 0:0.8.0-1.el7 will be installed
--> Running transaction check
---> Package python-nova.noarch 1:16.1.6-1.el7 will be installed
--> Processing Dependency: python-tooz >= 1.58.0 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-paramiko >= 2.0 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-oslo-versionedobjects >= 1.17.0 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-oslo-reports >= 0.6.0 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-os-vif >= 1.7.0 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-microversion-parse >= 0.1.2 for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-psutil for package: 1:python-nova-16.1.6-1.el7.noarch
--> Processing Dependency: python-os-traits for package: 1:python-nova-16.1.6-1.el7.noarch
--> Running transaction check
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
---> Package python-tooz.noarch 0:1.58.0-1.el7 will be installed
--> Processing Dependency: python-voluptuous >= 0.8.9 for package: python-tooz-1.58.0-1.el7.noarch
--> Processing Dependency: python-zake for package: python-tooz-1.58.0-1.el7.noarch
--> Processing Dependency: python-redis for package: python-tooz-1.58.0-1.el7.noarch
---> Package python2-microversion-parse.noarch 0:0.1.4-2.el7 will be installed
---> Package python2-os-traits.noarch 0:0.3.3-1.el7 will be installed
---> Package python2-os-vif.noarch 0:1.7.0-1.el7 will be installed
---> Package python2-oslo-reports.noarch 0:1.22.1-1.el7 will be installed
---> Package python2-oslo-versionedobjects.noarch 0:1.26.2-1.el7 will be installed
--> Processing Dependency: python-oslo-versionedobjects-lang = 1.26.2-1.el7 for package: python2-oslo-versionedobjects-1.26.2-1.el7.noarch
--> Processing Dependency: python-mock for package: python2-oslo-versionedobjects-1.26.2-1.el7.noarch
---> Package python2-psutil.x86_64 0:5.2.2-2.el7 will be installed
--> Running transaction check
---> Package python-oslo-versionedobjects-lang.noarch 0:1.26.2-1.el7 will be installed
---> Package python-redis.noarch 0:2.10.3-1.el7 will be installed
---> Package python-voluptuous.noarch 0:0.8.9-1.el7 will be installed
---> Package python2-mock.noarch 0:2.0.0-1.el7 will be installed
---> Package python2-zake.noarch 0:0.2.2-2.el7 will be installed
--> Processing Dependency: python-kazoo for package: python2-zake-0.2.2-2.el7.noarch
--> Running transaction check
---> Package python-kazoo.noarch 0:2.2.1-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================
Package Arch Version Repository Size
================================================================================================
Installing:
openstack-nova-api noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 8.2 k
openstack-nova-conductor noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 5.8 k
openstack-nova-console noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 6.8 k
openstack-nova-novncproxy noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 6.2 k
openstack-nova-placement-api noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 6.0 k
openstack-nova-scheduler noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 5.8 k
Installing for dependencies:
novnc noarch 0.5.1-2.el7 OpenStack-Pike-tuna 176 k
openstack-nova-common noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 371 k
python-kazoo noarch 2.2.1-1.el7 OpenStack-Pike-tuna 130 k
python-nova noarch 1:16.1.6-1.el7 OpenStack-Pike-tuna 3.3 M
python-oslo-versionedobjects-lang noarch 1.26.2-1.el7 OpenStack-Pike-tuna 8.0 k
python-paramiko noarch 2.1.1-9.el7 base 269 k
python-redis noarch 2.10.3-1.el7 OpenStack-Pike-tuna 94 k
python-tooz noarch 1.58.0-1.el7 OpenStack-Pike-tuna 94 k
python-voluptuous noarch 0.8.9-1.el7 OpenStack-Pike-tuna 36 k
python-websockify noarch 0.8.0-1.el7 OpenStack-Pike-tuna 69 k
python2-microversion-parse noarch 0.1.4-2.el7 OpenStack-Pike-tuna 16 k
python2-mock noarch 2.0.0-1.el7 OpenStack-Pike-tuna 120 k
python2-os-traits noarch 0.3.3-1.el7 OpenStack-Pike-tuna 22 k
python2-os-vif noarch 1.7.0-1.el7 OpenStack-Pike-tuna 59 k
python2-oslo-reports noarch 1.22.1-1.el7 OpenStack-Pike-tuna 53 k
python2-oslo-versionedobjects noarch 1.26.2-1.el7 OpenStack-Pike-tuna 72 k
python2-psutil x86_64 5.2.2-2.el7 OpenStack-Pike-tuna 310 k
python2-zake noarch 0.2.2-2.el7 OpenStack-Pike-tuna 39 k
Transaction Summary
================================================================================================
Install 6 Packages (+18 Dependent packages)
Total download size: 5.2 M
Installed size: 23 M
Downloading packages:
(1/24): openstack-nova-api-16.1.6-1.el7.noarch.rpm | 8.2 kB 00:00:01
(2/24): novnc-0.5.1-2.el7.noarch.rpm | 176 kB 00:00:01
(3/24): openstack-nova-common-16.1.6-1.el7.noarch.rpm | 371 kB 00:00:00
(4/24): openstack-nova-console-16.1.6-1.el7.noarch.rpm | 6.8 kB 00:00:00
(5/24): openstack-nova-conductor-16.1.6-1.el7.noarch.rpm | 5.8 kB 00:00:00
(6/24): openstack-nova-novncproxy-16.1.6-1.el7.noarch.rpm | 6.2 kB 00:00:00
(7/24): openstack-nova-placement-api-16.1.6-1.el7.noarch.rpm | 6.0 kB 00:00:00
(8/24): openstack-nova-scheduler-16.1.6-1.el7.noarch.rpm | 5.8 kB 00:00:00
(9/24): python-kazoo-2.2.1-1.el7.noarch.rpm | 130 kB 00:00:00
(10/24): python-oslo-versionedobjects-lang-1.26.2-1.el7.noarch.rpm | 8.0 kB 00:00:00
(11/24): python-redis-2.10.3-1.el7.noarch.rpm | 94 kB 00:00:00
(12/24): python-paramiko-2.1.1-9.el7.noarch.rpm | 269 kB 00:00:00
(13/24): python-tooz-1.58.0-1.el7.noarch.rpm | 94 kB 00:00:00
(14/24): python-voluptuous-0.8.9-1.el7.noarch.rpm | 36 kB 00:00:00
(15/24): python-websockify-0.8.0-1.el7.noarch.rpm | 69 kB 00:00:01
(16/24): python2-microversion-parse-0.1.4-2.el7.noarch.rpm | 16 kB 00:00:00
(17/24): python2-mock-2.0.0-1.el7.noarch.rpm | 120 kB 00:00:00
(18/24): python-nova-16.1.6-1.el7.noarch.rpm | 3.3 MB 00:00:03
(19/24): python2-os-traits-0.3.3-1.el7.noarch.rpm | 22 kB 00:00:00
(20/24): python2-os-vif-1.7.0-1.el7.noarch.rpm | 59 kB 00:00:00
(21/24): python2-oslo-reports-1.22.1-1.el7.noarch.rpm | 53 kB 00:00:00
(22/24): python2-oslo-versionedobjects-1.26.2-1.el7.noarch.rpm | 72 kB 00:00:00
(23/24): python2-zake-0.2.2-2.el7.noarch.rpm | 39 kB 00:00:00
(24/24): python2-psutil-5.2.2-2.el7.x86_64.rpm | 310 kB 00:00:00
------------------------------------------------------------------------------------------------
Total 738 kB/s | 5.2 MB 00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-websockify-0.8.0-1.el7.noarch 1/24
Installing : python2-psutil-5.2.2-2.el7.x86_64 2/24
Installing : python2-oslo-reports-1.22.1-1.el7.noarch 3/24
Installing : novnc-0.5.1-2.el7.noarch 4/24
Installing : python2-os-traits-0.3.3-1.el7.noarch 5/24
Installing : python-voluptuous-0.8.9-1.el7.noarch 6/24
Installing : python2-mock-2.0.0-1.el7.noarch 7/24
Installing : python-paramiko-2.1.1-9.el7.noarch 8/24
Installing : python-kazoo-2.2.1-1.el7.noarch 9/24
Installing : python2-zake-0.2.2-2.el7.noarch 10/24
Installing : python2-microversion-parse-0.1.4-2.el7.noarch 11/24
Installing : python-redis-2.10.3-1.el7.noarch 12/24
Installing : python-tooz-1.58.0-1.el7.noarch 13/24
Installing : python-oslo-versionedobjects-lang-1.26.2-1.el7.noarch 14/24
Installing : python2-oslo-versionedobjects-1.26.2-1.el7.noarch 15/24
Installing : python2-os-vif-1.7.0-1.el7.noarch 16/24
Installing : 1:python-nova-16.1.6-1.el7.noarch 17/24
Installing : 1:openstack-nova-common-16.1.6-1.el7.noarch 18/24
Installing : 1:openstack-nova-conductor-16.1.6-1.el7.noarch 19/24
Installing : 1:openstack-nova-console-16.1.6-1.el7.noarch 20/24
Installing : 1:openstack-nova-scheduler-16.1.6-1.el7.noarch 21/24
Installing : 1:openstack-nova-api-16.1.6-1.el7.noarch 22/24
Installing : 1:openstack-nova-placement-api-16.1.6-1.el7.noarch 23/24
Installing : 1:openstack-nova-novncproxy-16.1.6-1.el7.noarch 24/24
Verifying : 1:openstack-nova-conductor-16.1.6-1.el7.noarch 1/24
Verifying : python2-zake-0.2.2-2.el7.noarch 2/24
Verifying : python2-oslo-reports-1.22.1-1.el7.noarch 3/24
Verifying : 1:openstack-nova-console-16.1.6-1.el7.noarch 4/24
Verifying : 1:openstack-nova-scheduler-16.1.6-1.el7.noarch 5/24
Verifying : 1:openstack-nova-common-16.1.6-1.el7.noarch 6/24
Verifying : python-oslo-versionedobjects-lang-1.26.2-1.el7.noarch 7/24
Verifying : 1:python-nova-16.1.6-1.el7.noarch 8/24
Verifying : python-redis-2.10.3-1.el7.noarch 9/24
Verifying : python2-microversion-parse-0.1.4-2.el7.noarch 10/24
Verifying : python2-oslo-versionedobjects-1.26.2-1.el7.noarch 11/24
Verifying : python-kazoo-2.2.1-1.el7.noarch 12/24
Verifying : python-paramiko-2.1.1-9.el7.noarch 13/24
Verifying : python2-mock-2.0.0-1.el7.noarch 14/24
Verifying : python-tooz-1.58.0-1.el7.noarch 15/24
Verifying : python-voluptuous-0.8.9-1.el7.noarch 16/24
Verifying : novnc-0.5.1-2.el7.noarch 17/24
Verifying : 1:openstack-nova-api-16.1.6-1.el7.noarch 18/24
Verifying : python2-psutil-5.2.2-2.el7.x86_64 19/24
Verifying : 1:openstack-nova-placement-api-16.1.6-1.el7.noarch 20/24
Verifying : python2-os-vif-1.7.0-1.el7.noarch 21/24
Verifying : python2-os-traits-0.3.3-1.el7.noarch 22/24
Verifying : python-websockify-0.8.0-1.el7.noarch 23/24
Verifying : 1:openstack-nova-novncproxy-16.1.6-1.el7.noarch 24/24
Installed:
openstack-nova-api.noarch 1:16.1.6-1.el7
openstack-nova-conductor.noarch 1:16.1.6-1.el7
openstack-nova-console.noarch 1:16.1.6-1.el7
openstack-nova-novncproxy.noarch 1:16.1.6-1.el7
openstack-nova-placement-api.noarch 1:16.1.6-1.el7
openstack-nova-scheduler.noarch 1:16.1.6-1.el7
Dependency Installed:
novnc.noarch 0:0.5.1-2.el7
openstack-nova-common.noarch 1:16.1.6-1.el7
python-kazoo.noarch 0:2.2.1-1.el7
python-nova.noarch 1:16.1.6-1.el7
python-oslo-versionedobjects-lang.noarch 0:1.26.2-1.el7
python-paramiko.noarch 0:2.1.1-9.el7
python-redis.noarch 0:2.10.3-1.el7
python-tooz.noarch 0:1.58.0-1.el7
python-voluptuous.noarch 0:0.8.9-1.el7
python-websockify.noarch 0:0.8.0-1.el7
python2-microversion-parse.noarch 0:0.1.4-2.el7
python2-mock.noarch 0:2.0.0-1.el7
python2-os-traits.noarch 0:0.3.3-1.el7
python2-os-vif.noarch 0:1.7.0-1.el7
python2-oslo-reports.noarch 0:1.22.1-1.el7
python2-oslo-versionedobjects.noarch 0:1.26.2-1.el7
python2-psutil.x86_64 0:5.2.2-2.el7
python2-zake.noarch 0:0.2.2-2.el7
Complete!
[root@controller ~]# sed -i.bak '/^#/d;/^$/d' /etc/nova/nova.conf
[root@controller ~]# vim /etc/nova/nova.conf
[root@controller ~]# cat /etc/nova/nova.conf
[DEFAULT]
# 仅启用计算和元数据API
enabled_apis = osapi_compute,metadata
# 配置RabbitMQ消息队列访问
transport_url = rabbit://openstack:000000@controller
# 控制器节点的管理IP
my_ip = 178.120.2.10
# 启用对网络服务的支持
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
# 配置身份服务访问
auth_strategy = keystone
[api_database]
# 配置数据库访问
connection = mysql+pymysql://nova:000000@controller/nova_api
[barbican]
[cache]
[cells]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[crypto]
[database]
# 配置数据库访问
connection = mysql+pymysql://nova:000000@controller/nova
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
# 配置图像服务API的位置
api_servers = http://controller:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
[libvirt]
[matchmaker_redis]
[metrics]
[mks]
[neutron]
[notifications]
[osapi_v21]
[oslo_concurrency]
# 配置锁定路径
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
slo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
# 配置 Placement API
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[trusted_computing]
[upgrade_levels]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
# VNC代理配置为 使用控制器节点的管理接口IP地址
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[workarounds]
[wsgi]
[xenserver]
[xvp]
[root@controller ~]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
[root@controller ~]# cat /etc/httpd/conf.d/00-nova-placement-api.confListen 8778
<VirtualHost *:8778>
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
WSGIScriptAlias / /usr/bin/nova-placement-api
<IfVersion >= 2.4>
ErrorLogFormat "%M"
</IfVersion>
ErrorLog /var/log/nova/nova-placement-api.log
#SSLEngine On
#SSLCertificateFile ...
#SSLCertificateKeyFile ...
</VirtualHost>
Alias /nova-placement-api /usr/bin/nova-placement-api
<Location /nova-placement-api>
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
</Location>
# 启用对 Placement API 的访问
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
21614893-248b-41df-9668-73d056ddda1e
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
result = self._query(query)
[root@controller ~]# nova-manage cell_v2 list_cells
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
| Name | UUID | Transport URL | Database Connection |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller/nova_cell0 |
| cell1 | 21614893-248b-41df-9668-73d056ddda1e | rabbit://openstack:****@controller | mysql+pymysql://nova:****@controller/nova |
+-------+--------------------------------------+------------------------------------+-------------------------------------------------+
{/collapse-item}
安装完成
启动计算服务并设置开机自启
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
{collapse-item label="查看执行过程"}
安装完成
[root@controller ~]# systemctl enable openstack-nova-api.service \
> openstack-nova-consoleauth.service openstack-nova-scheduler.service \
> openstack-nova-conductor.service openstack-nova-novncproxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[root@controller ~]# systemctl start openstack-nova-api.service \
> openstack-nova-consoleauth.service openstack-nova-scheduler.service \
> openstack-nova-conductor.service openstack-nova-novncproxy.service
{/collapse-item}
安装和配置 计算节点
安装和配置组件
1、安装软件包
yum install -y openstack-nova-compute
> Tip:
> Error: Package: 1:openstack-nova-compute-16.1.6-1.el7.noarch (OpenStack-Pike-tuna)
rpm -ivh http://mirrors.163.com/centos/7/extras/x86_64/Packages/centos-release-virt-common-1-1.el7.centos.noarch.rpm --replacepkgs
rpm -ivh http://mirrors.163.com/centos/7/extras/x86_64/Packages/centos-release-qemu-ev-1.0-4.el7.centos.noarch.rpm --replacepkgs
2、配置 nova.conf
sed -i.bak '/^#/d;/^$/d' /etc/nova/nova.conf
vim /etc/nova/nova.conf
[DEFAULT]
# 启用 计算 和 元数据API
enabled_apis = osapi_compute,metadata
# 配置 RabbitMQ消息队列 访问
transport_url = rabbit://openstack:000000@controller
# 计算节点上管理网络 IP地址
my_ip = 178.120.2.20
# 启用对网络服务的支持
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
# 配置 身份服务访问
auth_strategy = keystone
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
[vnc]
# 启用 和 配置远程控制台访问
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://178.120.2.10:6080/vnc_auto.html
[glance]
# 配置图像服务 API的位置
api_servers = http://controller:9292
[oslo_concurrency]
# 配置锁定路径
lock_path = /var/lib/nova/tmp
[placement]
# 配置 Placement API
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000
完成安装
1、确认计算节点是否支持虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo
vim /etc/nova/nova.conf
[libvirt]
# 虚拟化选项(默认kvm)
virt_type = qemu
2、启动计算服务并设置开机自启
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
{collapse-item label="查看执行过程"}
安装和配置组件
[root@compute nova]# vim nova.conf
[root@compute nova]# cat nova.conf
[DEFAULT]
# 启用 计算 和 元数据API
enabled_apis = osapi_compute,metadata
# 配置 RabbitMQ消息队列 访问
transport_url = rabbit://openstack:000000@controller
# 计算节点上管理网络 IP地址
my_ip = 178.120.2.20
# 启用对网络服务的支持
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
# 配置 身份服务访问
auth_strategy = keystone
[api_database]
[barbican]
[cache]
[cells]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[crypto]
[database]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
# 配置图像服务 API的位置
api_servers = http://controller:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
# 配置身份服务访问
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 000000
[libvirt]
virt_type = qemu
[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]
# 配置 Placement API
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 000000
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[trusted_computing]
[upgrade_levels]
[vendordata_dynamic_auth]
[vmware]
[vnc]
# 启用 和 配置远程控制台访问
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://178.120.2.10:6080/vnc_auto.html
[workarounds]
[wsgi]
[xenserver]
[xvp]
[root@compute nova]# egrep -c '(vmx|svm)' /proc/cpuinfo
8
[root@compute nova]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
systemctl start libvirtd.service openstack-nova-compute.service
[root@compute nova]# systemctl start libvirtd.service openstack-nova-compute.service
{/collapse-item}
添加计算节点
控制节点执行
1、检查数据库中有该计算节点
. admin-openrc
openstack compute service list --service nova-compute
2、注册 计算节点
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
自动注册(可选)
[scheduler]
# 自动注册主机时间
discover_hosts_in_cells_interval = 300
{collapse-item label="查看执行过程"}
添加计算节点
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack compute service list --service nova-compute
+----+--------------+---------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+--------------+---------+------+---------+-------+----------------------------+
| 7 | nova-compute | compute | nova | enabled | up | 2022-07-13T07:02:24.000000 |
+----+--------------+---------+------+---------+-------+----------------------------+
[root@controller ~]# 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': 21614893-248b-41df-9668-73d056ddda1e
Checking host mapping for compute host 'compute': 6e85d3a5-24a5-417b-8735-5edb7859ad03
Creating host mapping for compute host 'compute': 6e85d3a5-24a5-417b-8735-5edb7859ad03
Found 1 unmapped computes in cell: 21614893-248b-41df-9668-73d056ddda1e
{/collapse-item}
验证
1、获取 admin 凭证
. admin-openrc
2、查询 计算服务组件列表
openstack compute service list
3、查询 Keytone 中API端点 列表
openstack catalog list
4、 查询 placement API 和 Cell 是否工作
nova-status upgrade check
{collapse-item label="查看执行过程"}
验证
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller | internal | enabled | up | 2022-07-13T07:10:56.000000 |
| 2 | nova-conductor | controller | internal | enabled | up | 2022-07-13T07:10:55.000000 |
| 6 | nova-scheduler | controller | internal | enabled | up | 2022-07-13T07:10:56.000000 |
| 7 | nova-compute | compute | nova | enabled | up | 2022-07-13T07:10:55.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
[root@controller ~]# openstack catalog list
+-----------+-----------+-----------------------------------------+
| Name | Type | Endpoints |
+-----------+-----------+-----------------------------------------+
| keystone | identity | RegionOne |
| | | internal: http://controller:5000/v3/ |
| | | RegionOne |
| | | public: http://controller:5000/v3/ |
| | | RegionOne |
| | | admin: http://controller:35357/v3/ |
| | | |
| glance | image | RegionOne |
| | | admin: http://controller:9292 |
| | | RegionOne |
| | | public: http://controller:9292 |
| | | RegionOne |
| | | internal: http://controller:9292 |
| | | |
| placement | placement | RegionOne |
| | | admin: http://controller:8778 |
| | | RegionOne |
| | | public: http://controller:8778 |
| | | RegionOne |
| | | internal: http://controller:8778 |
| | | |
| nova | compute | RegionOne |
| | | admin: http://controller:8774/v2.1 |
| | | RegionOne |
| | | public: http://controller:8774/v2.1 |
| | | RegionOne |
| | | internal: http://controller:8774/v2.1 |
| | | |
+-----------+-----------+-----------------------------------------+
[root@controller ~]# nova-status upgrade check
+---------------------------+
| Upgrade Check Results |
+---------------------------+
| Check: Cells v2 |
| Result: Success |
| Details: None |
+---------------------------+
| Check: Placement API |
| Result: Success |
| Details: None |
+---------------------------+
| Check: Resource Providers |
| Result: Success |
| Details: None |
+---------------------------+
{/collapse-item}
评论