一、nova介绍

  Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源。OpenStack 作为 IaaS 的云操作系统,虚拟机生命周期管理也就是通过 Nova 来实现的。

用途与功能:

  1) 实例生命周期管理

  2) 管理计算资源

  3) 网络和认证管理

  4) REST 风格的 API

  5) 异步的一致性通信

  6)Hypervisor 透明:支持Xen,XenServer/XCP,KVM, UML, VMware vSphere and Hyper-V

  在上图中可以看到,Nova 处于 Openstak 架构的中心,其他组件都为 Nova 提供支持: Glance 为 VM 提供 image;Cinder 和 Swift 分别为 VM 提供块存储和对象存储;Neutron 为 VM 提供网络连接。

nova架构如下图:

  Nova 的架构比较复杂,包含很多组件。 这些组件以子服务(后台 deamon 进程)的形式运行,可以分为以下几类:

1、API

  nova-api是整个Nova 组件的门户,接收和响应客户的 API 调用。所有对 Nova 的请求都首先由 nova-api 处理。nova-api 向外界暴露若干 HTTP REST API 接口 在 keystone 中我们可以查询 nova-api 的 endponits。

  客户端可以将请求发送到 endponits 指定的地址,向 nova-api 请求操作。 当然,作为最终用户的我们不会直接发送 Rest AP I请求。 OpenStack CLI,Dashboard 和其他需要跟 Nova 交换的组件会使用这些 API。

Nova-api 对接收到的 HTTP API 请求会做如下处理:

  (1)检查客户端传入的参数是否合法有效

  (2)调用 Nova 其他子服务的处理客户端 HTTP 请求

  (3)格式化 Nova 其他子服务返回的结果并返回给客户端

nova-api 接收哪些请求?

  简单的说,只要是跟虚拟机生命周期相关的操作,nova-api 都可以响应。 大部分操作都可以在 Dashboard 上找到。打开Instance管理界面

  除了提供 OpenStack 自己的API,nova-api 还支持 Amazon EC2 API。 也就是说,如果客户以前使用 Amazon EC2,并且用 EC2 的 API 开发了些工具来管理虚机,那么如果现在要换成 OpenStack,这些工具可以无缝迁移到 OpenStack,因为 nova-api 兼容 EC2 API,无需做任何修改。

2、Compute Core

(1)nova-scheduler

  虚机调度服务,负责决定在哪个计算节点上运行虚机。创建 Instance 时,用户会提出资源需求,例如 CPU、内存、磁盘各需要多少。OpenStack 将这些需求定义在 flavor 中,用户只需要指定用哪个 flavor 就可以了。

可用的 flavor 在 System->Flavors 中管理。

  下面介绍 nova-scheduler 是如何实现调度的。在 /etc/nova/nova.conf 中,nova 通过 driver=filter_scheduler 这个参数来配置 nova-scheduler。

  1. driver = filter_scheduler

Filter scheduler

  Filter scheduler 是 nova-scheduler 默认的调度器,调度过程分为两步:

  1) 通过过滤器(filter)选择满足条件的计算节点(运行 nova-compute)

  2) 通过权重计算(weighting)选择在最优(权重值最大)的计算节点上创建 Instance。

  Nova 允许使用第三方 scheduler,配置 scheduler_driver 即可。 这又一次体现了OpenStack的开放性。Scheduler 可以使用多个 filter 依次进行过滤,过滤之后的节点再通过计算权重选出最适合的节点。

上图是调度过程的一个示例:

  1) 最开始有 6 个计算节点 Host1-Host6

  2) 通过多个 filter 层层过滤,Host2 和 Host4 没有通过,被刷掉了

  3) Host1,Host3,Host5,Host6 计算权重,结果 Host5 得分最高,最终入选

  当 Filter scheduler 需要执行调度操作时,会让 filter 对计算节点进行判断,filter 返回 True 或 False。经过前面一堆 filter 的过滤,nova-scheduler 选出了能够部署 instance 的计算节点。

  如果有多个计算节点通过了过滤,那么最终选择哪个节点呢?

  Scheduler 会对每个计算节点打分,得分最高的获胜。 打分的过程就是 weight,翻译过来就是计算权重值,那么 scheduler 是根据什么来计算权重值呢?

  目前 nova-scheduler 的默认实现是根据计算节点空闲的内存量计算权重值: 空闲内存越多,权重越大,instance 将被部署到当前空闲内存最多的计算节点上。

(2)nova-compute:

  nova-compute 是管理虚机的核心服务,在计算节点上运行。通过调用Hypervisor API实现节点上的 instance的生命周期管理。 OpenStack 对 instance 的操作,最后都是交给 nova-compute 来完成的。 nova-compute 与 Hypervisor 一起实现 OpenStack 对 instance 生命周期的管理。

  Openstack中虚机默认的保存路径在:/var/lib/nova/instances

  通过Driver架构支持多种Hypervisor

  Hypervisor是计算节点上跑的虚拟化管理程序,虚机管理最底层的程序。 不同虚拟化技术提供自己的 Hypervisor。 常用的 Hypervisor 有 KVM,Xen, VMWare 等。nova-compute 为这些 Hypervisor 定义了统一的接口,Hypervisor 只需要实现这些接口,就可以 Driver 的形式即插即用到 OpenStack 系统中。 下面是Nova Driver的架构示意图:

(3)nova-conductor:

  nova-compute 经常需要更新数据库,比如更新和获取虚机的状态。 出于安全性和伸缩性的考虑,nova-compute 并不会直接访问数据库,而是将这个任务委托给 nova-conductor。

这样做有两个显著好处:

  1)更高的系统安全性

  2)更好的系统伸缩性

3、Console Interface

openstack-nova-api:nova门户
openstack-nova-conductor:帮助nova-compute访问数据库的
openstack-nova-console:提供多种方式访问虚机的控制台
openstack-nova-novncproxy:是基于web浏览器提供虚机的控制台
openstack-nova-scheduler:负责调度虚机启动到哪一个计算节点
openstack-nova-placement-api:资源使用情况追踪
openstack-nova-spicehtml5proxy: 基于 HTML5 浏览器的 SPICE 访问
openstack-nova-xvpnvncproxy: 基于 Java 客户端的 VNC 访问
openstack-nova-consoleauth: 负责对访问虚机控制台请求提供 Token 认证
openstack-nova-cert: 提供 x509 证书支持

4、Database

  Nova 会有一些数据需要存放到数据库中,一般使用 MySQL。数据库安装在控制节点上。 Nova 使用命名为 “nova” 的数据库。

5、Message Queue

  在前面我们了解到 Nova 包含众多的子服务,这些子服务之间需要相互协调和通信。为解耦各个子服务,Nova 通过 Message Queue 作为子服务的信息中转站。 所以在架构图上我们看到了子服务之间没有直接的连线,是通过 Message Queue 联系的。

  OpenStack 默认是用 RabbitMQ 作为 Message Queue。 MQ 是 OpenStack 的核心基础组件,我们后面也会详细介绍。

二、Nova 组件如何协同工作

Nova 物理部署方案

  前面大家已经看到 Nova 由很多子服务组成,我们也知道 OpenStack 是一个分布式系统,可以部署到若干节点上,那么接下来大家可能就会问:Nova 的这些服务在物理上应该如何部署呢?
对于 Nova,这些服务会部署在两类节点上:计算节点和控制节点。
计算节点上安装了 Hypervisor,上面运行虚拟机。 由此可知:
  1) 只有 nova-compute 需要放在计算节点上。
  2) 其他子服务则是放在控制节点上的。

下面我们可以看看实验环境的具体部署情况。 通过在计算节点和控制节点上运行

ps -elf | grep nova 来查看运行的 nova 子服务

计算节点compute只运行了nova-compute子服务

控制节点controller运行了若干nova-*子服务

  RabbitMQ 和 MySQL 也是放在控制节点上的。可能细心的同学已经发现我们的控制节点上也运行了 nova-compute。 这实际上也就意味着 devstack-controller 既是一个控制节点,同时也是一个计算节点,也可以在上面运行虚机。

  这也向我们展示了 OpenStack 这种分布式架构部署上的灵活性: 可以将所有服务都放在一台物理机上,作为一个 All-in-One 的测试环境; 也可以将服务部署在多台物理机上,获得更好的性能和高可用。

  另外,也可以用 nova service-list 查看 nova-* 子服务都分布在哪些节点上

  从虚机创建流程看 nova-* 子服务如何协同工作                                    
  从学习 Nova 的角度看,虚机创建是一个非常好的场景,涉及的 nova-* 子服务很全,下面是流程图。
  1. 客户(可以是 OpenStack 最终用户,也可以是其他程序)向 API(nova-api)发送请求:“帮我创建一个虚机”

  2. API 对请求做一些必要处理后,向 Messaging(RabbitMQ)发送了一条消息:“让 Scheduler 创建一个虚机”

  3. Scheduler(nova-scheduler)从 Messaging 获取到 API 发给它的消息,然后执行调度算法,从若干计算节点中选出节点 A

  4. Scheduler 向 Messaging 发送了一条消息:“在计算节点 A 上创建这个虚机”

  5. 计算节点 A 的 Compute(nova-compute)从 Messaging 中获取到 Scheduler 发给它的消息,然后在本节点的 Hypervisor 上启动虚机。

  6. 在虚机创建的过程中,Compute 如果需要查询或更新数据库信息,会通过 Messaging 向 Conductor(nova-conductor)发送消息,Conductor 负责数据库访问。

  以上是创建虚机最核心的步骤, 这几个步骤向我们展示了 nova-* 子服务之间的协作的方式,也体现了 OpenStack 整个系统的分布式设计思想,掌握这种思想对我们深入理解 OpenStack 会非常有帮助。

三、nova创建虚拟机详细过程

1、界面或命令行通过RESTful API向keystone获取认证信息。

2、keystone通过用户请求认证信息,并生成auth-token返回给对应的认证请求。

3、界面或命令行通过RESTful API向nova-api发送一个boot instance的请求(携带auth-token)。

4、nova-api接受请求后向keystone发送认证请求,查看token是否为有效用户和token。

5、keystone验证token是否有效,如有效则返回有效的认证和对应的角色(注:有些操作需要有角色权限才能操作)。

6、通过认证后nova-api和数据库通讯。

7、初始化新建虚拟机的数据库记录。

8、nova-api通过rpc.call向nova-scheduler请求是否有创建虚拟机的资源(Host ID)。

9、nova-scheduler进程侦听消息队列,获取nova-api的请求。

10、nova-scheduler通过查询nova数据库中计算资源的情况,并通过调度算法计算符合虚拟机创建需要的主机。

11、对于有符合虚拟机创建的主机,nova-scheduler更新数据库中虚拟机对应的物理主机信息。

12、nova-scheduler通过rpc.cast向nova-compute发送对应的创建虚拟机请求的消息。

13、nova-compute会从对应的消息队列中获取创建虚拟机请求的消息。

14、nova-compute通过rpc.call向nova-conductor请求获取虚拟机消息。(Flavor)

15、nova-conductor从消息队队列中拿到nova-compute请求消息。

16、nova-conductor根据消息查询虚拟机对应的信息。

17、nova-conductor从数据库中获得虚拟机对应信息。

18、nova-conductor把虚拟机信息通过消息的方式发送到消息队列中。

19、nova-compute从对应的消息队列中获取虚拟机信息消息。

20、nova-compute通过keystone的RESTfull API拿到认证的token,并通过HTTP请求glance-api获取创建虚拟机所需要镜像。

21、glance-api向keystone认证token是否有效,并返回验证结果。

22、token验证通过,nova-compute获得虚拟机镜像信息(URL)。

23、nova-compute通过keystone的RESTfull API拿到认证k的token,并通过HTTP请求neutron-server获取创建虚拟机所需要的网络信息。

24、neutron-server向keystone认证token是否有效,并返回验证结果。

25、token验证通过,nova-compute获得虚拟机网络信息。

26、nova-compute通过keystone的RESTfull API拿到认证的token,并通过HTTP请求cinder-api获取创建虚拟机所需要的持久化存储信息。

27、cinder-api向keystone认证token是否有效,并返回验证结果。

28、token验证通过,nova-compute获得虚拟机持久化存储信息。

29、nova-compute根据instance的信息调用配置的虚拟化驱动来创建虚拟机。

四、彻底删除nova-compute节点

1、控制节点上操作查看计算节点,删除node1

  1. openstack host list
  2. nova service-list

2、将node1上的计算服务设置为down,然后disabled

  1. systemctl stop openstack-nova-compute
  2. nova service-list

  1. nova service-disable node1 nova-compute
  2. nova service-list

3、在数据库里清理(nova库)

(1)查看现在数据库状态

  1. [root@node1 ~]# mysql -u root -p
  2. Enter password:
  3. Welcome to the MariaDB monitor. Commands end with ; or \g.
  4. Your MariaDB connection id is 90
  5. Server version: 10.1.20-MariaDB MariaDB Server
  6.  
  7. Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
  8.  
  9. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  10.  
  11. MariaDB [(none)]> use nova;
  12. Reading table information for completion of table and column names
  13. You can turn off this feature to get a quicker startup with -A
  14.  
  15. Database changed
  16. MariaDB [nova]> select host from nova.services;
  17. +---------+
  18. | host |
  19. +---------+
  20. | 0.0.0.0 |
  21. | 0.0.0.0 |
  22. | node1 |
  23. | node1 |
  24. | node1 |
  25. | node1 |
  26. | node2 |
  27. +---------+
  28. 7 rows in set (0.00 sec)
  29.  
  30. MariaDB [nova]> select hypervisor_hostname from compute_nodes;
  31. +---------------------+
  32. | hypervisor_hostname |
  33. +---------------------+
  34. | node1 |
  35. | node2 |
  36. +---------------------+
  37. 2 rows in set (0.00 sec)

(2)删除数据库中的node1节点信息

  1. MariaDB [nova]> delete from nova.services where host="node1";
  2. Query OK, 4 rows affected (0.01 sec)
  3.  
  4. MariaDB [nova]> delete from compute_nodes where hypervisor_hostname="node1";
  5. Query OK, 1 row affected (0.00 sec)
  6.  
  7. MariaDB [nova]>
  8. MariaDB [nova]>
  9. MariaDB [nova]>
  10. MariaDB [nova]> select host from nova.services;
  11. +---------+
  12. | host |
  13. +---------+
  14. | 0.0.0.0 |
  15. | 0.0.0.0 |
  16. | node2 |
  17. +---------+
  18. 3 rows in set (0.00 sec)
  19.  
  20. MariaDB [nova]> select hypervisor_hostname from compute_nodes;
  21. +---------------------+
  22. | hypervisor_hostname |
  23. +---------------------+
  24. | node2 |
  25. +---------------------+
  26. 1 row in set (0.00 sec)

五、安装和配置nova计算服务

(一)安装和配置控制节点(ren3)

https://docs.openstack.org/ocata/install-guide-rdo/nova-controller-install.html#install-and-configure-components

1、在数据库中创建nova计算服务的数据库,用户及授予权限

(1)使用root用户登录数据库:

  1. [root@ren3 ~]# mysql -u root -proot

(2)创建nova_api、nova和nova_cell0数据库:

  1. MariaDB [(none)]> CREATE DATABASE nova_api;
  2. Query OK, 1 row affected (0.00 sec)
  3.  
  4. MariaDB [(none)]> CREATE DATABASE nova;
  5. Query OK, 1 row affected (0.00 sec)
  6.  
  7. MariaDB [(none)]> CREATE DATABASE nova_cell0;
  8. Query OK, 1 row affected (0.00 sec)
  9. MariaDB [(none)]> show databases;
  10. +--------------------+
  11. | Database |
  12. +--------------------+
  13. | glance |
  14. | information_schema |
  15. | keystone |
  16. | mysql |
  17. | nova |
  18. | nova_api |
  19. | nova_cell0 |
  20. | performance_schema |
  21. +--------------------+
  22. 8 rows in set (0.01 sec)

(3)授予适当的数据库使用权限:

  1. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
  2. IDENTIFIED BY 'NOVA_DBPASS';
  3. Query OK, 0 rows affected (0.05 sec)
  4.  
  5. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
  6. IDENTIFIED BY 'NOVA_DBPASS';
  7. Query OK, 0 rows affected (0.00 sec)
  8.  
  9. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
  10. IDENTIFIED BY 'NOVA_DBPASS';
  11. Query OK, 0 rows affected (0.00 sec)
  12.  
  13. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
  14. IDENTIFIED BY 'NOVA_DBPASS';
  15. Query OK, 0 rows affected (0.00 sec)
  16.  
  17. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
  18. IDENTIFIED BY 'NOVA_DBPASS';
  19. Query OK, 0 rows affected (0.00 sec)
  20.  
  21. MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
  22. IDENTIFIED BY 'NOVA_DBPASS';
  23. Query OK, 0 rows affected (0.00 sec)
  1. MariaDB [(none)]> select user,password,host from mysql.user;+----------+-------------------------------------------+-----------+
  2. | user | password | host |
  3. +----------+-------------------------------------------+-----------+
  4. | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost |
  5. | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 127.0.0.1 |
  6. | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | ::1 |
  7. | glance | *C0CE56F2C0C7234791F36D89700B02691C1CAB8E | localhost |
  8. | keystone | *442DFE587A8B6BE1E9538855E8187C1EFB863A73 | localhost |
  9. | keystone | *442DFE587A8B6BE1E9538855E8187C1EFB863A73 | % |
  10. | glance | *C0CE56F2C0C7234791F36D89700B02691C1CAB8E | % |
  11. | nova | *B79B482785488AB91D97EAFCAD7BA8839EF65AD3 | localhost |
  12. | nova | *B79B482785488AB91D97EAFCAD7BA8839EF65AD3 | % |
  13. +----------+-------------------------------------------+-----------+
  14. 9 rows in set (0.00 sec)

退出数据库

2、加载系统变量

  1. [root@ren3 ~]# cat openrc
  2. export OS_USERNAME=admin
  3. export OS_PASSWORD=admin
  4. export OS_PROJECT_NAME=admin
  5. export OS_USER_DOMAIN_NAME=Default
  6. export OS_PROJECT_DOMAIN_NAME=Default
  7. export OS_AUTH_URL=http://ren3:35357/v3
  8. export OS_IDENTITY_API_VERSION=3
  9. [root@ren3 ~]# source openrc

3、创建计算服务凭证

(1)创建nova用户

  1. [root@ren3 ~]# openstack user create --domain default --password=nova nova
  2. +---------------------+----------------------------------+
  3. | Field | Value |
  4. +---------------------+----------------------------------+
  5. | domain_id | default |
  6. | enabled | True |
  7. | id | fb741e18c1f242cebc6a512c679a07a7 |
  8. | name | nova |
  9. | options | {} |
  10. | password_expires_at | None |
  11. +---------------------+----------------------------------+

(2)向nova用户添加管理角色:

  1. [root@ren3 ~]# openstack role add --project service --user nova admin

(3)创建nova服务:

  1. [root@ren3 ~]# openstack service create --name nova --description "OpenStack Compute" compute
  2. +-------------+----------------------------------+
  3. | Field | Value |
  4. +-------------+----------------------------------+
  5. | description | OpenStack Compute |
  6. | enabled | True |
  7. | id | 207e39b4617e4ac2ad6ec90e055342e3 |
  8. | name | nova |
  9. | type | compute |
  10. +-------------+----------------------------------+
  11. [root@ren3 ~]# openstack service list
  12. +----------------------------------+----------+----------+
  13. | ID | Name | Type |
  14. +----------------------------------+----------+----------+
  15. | 207e39b4617e4ac2ad6ec90e055342e3 | nova | compute |
  16. | a7cf08799d4b4b509530ae6c21453b08 | glance | image |
  17. | ab70227ae28c4fb7a774ed4808489e76 | keystone | identity |
  18. +----------------------------------+----------+----------+

4、创建计算API服务端点:

  1. [root@ren3 ~]# openstack endpoint create --region RegionOne \
  2. compute public http://ren3:8774/v2.1
  3. +--------------+----------------------------------+
  4. | Field | Value |
  5. +--------------+----------------------------------+
  6. | enabled | True |
  7. | id | a10ffd61f7a0467682325e930b384222 |
  8. | interface | public |
  9. | region | RegionOne |
  10. | region_id | RegionOne |
  11. | service_id | 207e39b4617e4ac2ad6ec90e055342e3 |
  12. | service_name | nova |
  13. | service_type | compute |
  14. | url | http://ren3:8774/v2.1 |
  15. +--------------+----------------------------------+
  16. [root@ren3 ~]# openstack endpoint create --region RegionOne \
  17. compute internal http://ren3:8774/v2.1
  18. +--------------+----------------------------------+
  19. | Field | Value |
  20. +--------------+----------------------------------+
  21. | enabled | True |
  22. | id | 79cf3dc0d9784eaf83fec84a74dd468d |
  23. | interface | internal |
  24. | region | RegionOne |
  25. | region_id | RegionOne |
  26. | service_id | 207e39b4617e4ac2ad6ec90e055342e3 |
  27. | service_name | nova |
  28. | service_type | compute |
  29. | url | http://ren3:8774/v2.1 |
  30. +--------------+----------------------------------+
  31. [root@ren3 ~]# openstack endpoint create --region RegionOne \
  32. compute admin http://ren3:8774/v2.1
  33. +--------------+----------------------------------+
  34. | Field | Value |
  35. +--------------+----------------------------------+
  36. | enabled | True |
  37. | id | d413124d690d44b8853f6c5b1dce9af1 |
  38. | interface | admin |
  39. | region | RegionOne |
  40. | region_id | RegionOne |
  41. | service_id | 207e39b4617e4ac2ad6ec90e055342e3 |
  42. | service_name | nova |
  43. | service_type | compute |
  44. | url | http://ren3:8774/v2.1 |
  45. +--------------+----------------------------------+

5、创建placement用户

  1. [root@ren3 ~]# openstack user create --domain default --password=placement placement
  2. +---------------------+----------------------------------+
  3. | Field | Value |
  4. +---------------------+----------------------------------+
  5. | domain_id | default |
  6. | enabled | True |
  7. | id | 53e13c535c8648f58abcae149a44d816 |
  8. | name | placement |
  9. | options | {} |
  10. | password_expires_at | None |
  11. +---------------------+----------------------------------+

6、添加placement用户到service项目,并给它admin角色

  1. [root@ren3 ~]# openstack role add --project service --user placement admin

7、创建placement服务

  1. [root@ren3 ~]# openstack service create --name placement --description "Placement API" placement
  2. +-------------+----------------------------------+
  3. | Field | Value |
  4. +-------------+----------------------------------+
  5. | description | Placement API |
  6. | enabled | True |
  7. | id | d421cabebb114dab9b5f1cd63900b910 |
  8. | name | placement |
  9. | type | placement |
  10. +-------------+----------------------------------+
  11. [root@ren3 ~]# openstack service list |grep placement
  12. | d421cabebb114dab9b5f1cd63900b910 | placement | placement |

8、创建placement api端点:

  1. [root@ren3 ~]# openstack endpoint create --region RegionOne placement public http://ren3:8778
  2. +--------------+----------------------------------+
  3. | Field | Value |
  4. +--------------+----------------------------------+
  5. | enabled | True |
  6. | id | bbf36665cd90488e9269a12bea3b839c |
  7. | interface | public |
  8. | region | RegionOne |
  9. | region_id | RegionOne |
  10. | service_id | d421cabebb114dab9b5f1cd63900b910 |
  11. | service_name | placement |
  12. | service_type | placement |
  13. | url | http://ren3:8778 |
  14. +--------------+----------------------------------+
  15. [root@ren3 ~]# openstack endpoint create --region RegionOne placement internal http://ren3:8778
  16. +--------------+----------------------------------+
  17. | Field | Value |
  18. +--------------+----------------------------------+
  19. | enabled | True |
  20. | id | b50f00b3e45c4741856f300dce012dc2 |
  21. | interface | internal |
  22. | region | RegionOne |
  23. | region_id | RegionOne |
  24. | service_id | d421cabebb114dab9b5f1cd63900b910 |
  25. | service_name | placement |
  26. | service_type | placement |
  27. | url | http://ren3:8778 |
  28. +--------------+----------------------------------+
  29. [root@ren3 ~]# openstack endpoint create --region RegionOne placement admin http://ren3:8778
  30. +--------------+----------------------------------+
  31. | Field | Value |
  32. +--------------+----------------------------------+
  33. | enabled | True |
  34. | id | 6e64d3f4f9cd4bfbaea80c975e92d03a |
  35. | interface | admin |
  36. | region | RegionOne |
  37. | region_id | RegionOne |
  38. | service_id | d421cabebb114dab9b5f1cd63900b910 |
  39. | service_name | placement |
  40. | service_type | placement |
  41. | url | http://ren3:8778 |
  42. +--------------+----------------------------------+
  43. [root@ren3 ~]# openstack endpoint list | grep placement
  44. | 6e64d3f4f9cd4bfbaea80c975e92d03a | RegionOne | placement | placement | True | admin | http://ren3:8778 |
  45. | b50f00b3e45c4741856f300dce012dc2 | RegionOne | placement | placement | True | internal | http://ren3:8778 |
  46. | bbf36665cd90488e9269a12bea3b839c | RegionOne | placement | placement | True | public | http://ren3:8778 |

9、安装nova软件包

  1. [root@ren3 ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y

10、编辑/etc/nova/nova.conf文件

(1)在[DEFAULT]部分,启用计算和元数据api:

  1. [DEFAULT]
  2. # ...
  3. enabled_apis = osapi_compute,metadata

(2)在[api_database]和[database]部分,配置数据库访问:

  1. [api_database]
  2. # ...
  3. connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
  4.  
  5. [database]
  6. # ...
  7. connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova

(3)在[DEFAULT]部分,配置RabbitMQ消息队列访问:

  1. [DEFAULT]
  2. # ...
  3. transport_url = rabbit://openstack:RABBIT_PASS@controller

(4)在[api]和[keystone_authtoken]部分,配置身份服务访问:

  1. [api]
  2. # ...
  3. auth_strategy = keystone
  4.  
  5. [keystone_authtoken]
  6. # ...
  7. auth_uri = http://controller:5000
  8. auth_url = http://controller:35357
  9. memcached_servers = controller:11211
  10. auth_type = password
  11. project_domain_name = default
  12. user_domain_name = default
  13. project_name = service
  14. username = nova
  15. password = NOVA_PASS

(5)在[DEFAULT]部分,配置my_ip选项来使用控制器节点的管理接口IP地址:

  1. [DEFAULT]
  2. # ...
  3. my_ip = 10.0.0.11

(6)在[DEFAULT]部分,启用对网络服务的支持:

  1. [DEFAULT]
  2. # ...
  3. use_neutron = True
  4. firewall_driver = nova.virt.firewall.NoopFirewallDriver

(7)在[vnc]部分,配置vnc代理以使用控制节点的管理接口IP地址:

  1. [vnc]
  2. enabled = true
  3. # ...
  4. vncserver_listen = $my_ip
  5. vncserver_proxyclient_address = $my_ip

(8)在[glance]部分,配置图像服务API的位置:

  1. [glance]
  2. # ...
  3. api_servers = http://controller:9292

(9)在[oslo_concurrency]部分,配置锁路径:

  1. [oslo_concurrency]
  2. # ...
  3. lock_path = /var/lib/nova/tmp

(10)在[placement]部分,配置放置API:

  1. [placement]
  2. # ...
  3. os_region_name = RegionOne
  4. project_domain_name = Default
  5. project_name = service
  6. auth_type = password
  7. user_domain_name = Default
  8. auth_url = http://controller:35357/v3
  9. username = placement
  10. password = PLACEMENT_PASS

修改后的配置文件:

  1. [root@ren3 ~]# cd /etc/nova/
  2. [root@ren3 nova]# ls
  3. api-paste.ini nova.conf policy.json release rootwrap.conf
  4. [root@ren3 nova]# cp nova.conf nova.conf.bak
  5. [root@ren3 nova]# vim nova.conf
  1. [DEFAULT]
  2. my_ip = 192.168.11.3
  3. use_neutron = True
  4. firewall_driver = nova.virt.firewall.NoopFirewallDriver
  5. enabled_apis=osapi_compute,metadata
  6. transport_url = rabbit://openstack:admin@ren3
  7.  
  8. [api]
  9. auth_strategy = keystone
  10.  
  11. [api_database]
  12. connection = mysql+pymysql://nova:NOVA_DBPASS@ren3/nova_api
  13.  
  14. [barbican]
  15.  
  16. [cache]
  17.  
  18. [cells]
  19.  
  20. [cinder]
  21. #os_region_name = RegionOne
  22.  
  23. [cloudpipe]
  24.  
  25. [conductor]
  26.  
  27. [console]
  28.  
  29. [consoleauth]
  30.  
  31. [cors]
  32.  
  33. [cors.subdomain]
  34.  
  35. [crypto]
  36.  
  37. [database]
  38. connection = mysql+pymysql://nova:NOVA_DBPASS@ren3/nova
  39.  
  40. [ephemeral_storage_encryption]
  41.  
  42. [filter_scheduler]
  43.  
  44. [glance]
  45. api_servers = http://ren3:9292
  46.  
  47. [guestfs]
  48.  
  49. [healthcheck]
  50.  
  51. [hyperv]
  52.  
  53. [image_file_url]
  54.  
  55. [ironic]
  56.  
  57. [key_manager]
  58.  
  59. [keystone_authtoken]
  60. auth_uri = http://ren3:5000
  61. auth_url = http://ren3:35357
  62. memcached_servers = ren3:11211
  63. auth_type = password
  64. project_domain_name = default
  65. user_domain_name = default
  66. project_name = service
  67. username = nova
  68. password = nova
  69.  
  70. [libvirt]
  71. #virt_type = qemu
  72.  
  73. [matchmaker_redis]
  74.  
  75. [metrics]
  76.  
  77. [mks]
  78.  
  79. [neutron]
  80. #url = http://ren3:9696
  81. #auth_url = http://ren3:35357
  82. #auth_type = password
  83. #project_domain_name = default
  84. #user_domain_name = default
  85. #region_name = RegionOne
  86. #project_name = service
  87. #username = neutron
  88. #password = neutron
  89. #service_metadata_proxy = true
  90. #metadata_proxy_shared_secret = METADATA_SECRET
  91.  
  92. [notifications]
  93.  
  94. [osapi_v21]
  95.  
  96. [oslo_concurrency]
  97. lock_path = /var/lib/nova/tmp
  98.  
  99. [oslo_messaging_amqp]
  100.  
  101. [oslo_messaging_kafka]
  102.  
  103. [oslo_messaging_notifications]
  104.  
  105. [oslo_messaging_rabbit]
  106.  
  107. [oslo_messaging_zmq]
  108.  
  109. [oslo_middleware]
  110.  
  111. [oslo_policy]
  112.  
  113. [pci]
  114.  
  115. [placement]
  116. os_region_name = RegionOne
  117. auth_type = password
  118. auth_url = http://ren3:35357/v3
  119. project_name = service
  120. project_domain_name = Default
  121. username = placement
  122. password = placement
  123. user_domain_name = Default
  124.  
  125. [quota]
  126.  
  127. [rdp]
  128.  
  129. [remote_debug]
  130.  
  131. [scheduler]
  132.  
  133. [serial_console]
  134.  
  135. [service_user]
  136.  
  137. [spice]
  138.  
  139. [ssl]
  140.  
  141. [trusted_computing]
  142.  
  143. [upgrade_levels]
  144.  
  145. [vendordata_dynamic_auth]
  146.  
  147. [vmware]
  148.  
  149. [vnc]
  150. enabled = true
  151. vncserver_listen = $my_ip
  152. vncserver_proxyclient_address = $my_ip
  153. #novncproxy_base_url = http://192.168.11.3:6080/vnc_auto.html
  154.  
  155. [workarounds]
  156.  
  157. [wsgi]
  158.  
  159. [xenserver]
  160.  
  161. [xvp]

11、由于打包错误必须通过将以下配置添加到/etc/httpd/conf.d/00-nova- placi - API .conf来启用对放置API的访问:

  1. [root@ren3 ~]# vim /etc/httpd/conf.d/00-nova-placement-api.conf
  1. <Directory /usr/bin>
  2. <IfVersion >= 2.4>
  3. Require all granted
  4. </IfVersion>
  5. <IfVersion < 2.4>
  6. Order allow,deny
  7. Allow from all
  8. </IfVersion>
  9. </Directory>

重启httpd服务

  1. [root@ren3 ~]# systemctl restart httpd

12、同步数据库数据(nova、nova-api、nova-cell0)

  1. [root@ren3 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
  2. [root@ren3 ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
  3. [root@ren3 ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
  4. e02ac651-4481-48ce-aed3-ff4dfc75b026
  5. [root@ren3 ~]# su -s /bin/sh -c "nova-manage db sync" nova

13、验证nova cell0和cell1注册正确:

  1. [root@ren3 ~]# nova-manage cell_v2 list_cells
  2. +-------+--------------------------------------+
  3. | Name | UUID |
  4. +-------+--------------------------------------+
  5. | cell0 | 00000000-0000-0000-0000-000000000000 |
  6. | cell1 | e02ac651-4481-48ce-aed3-ff4dfc75b026 |
  7. +-------+--------------------------------------+
  1. [root@ren3 ~]# mysql -u nova -pNOVA_DBPASS
  2.  
  3. MariaDB [(none)]> show databases;
  4. +--------------------+
  5. | Database |
  6. +--------------------+
  7. | information_schema |
  8. | nova |
  9. | nova_api |
  10. | nova_cell0 |
  11. +--------------------+
  12. 4 rows in set (0.00 sec)
  13. MariaDB [nova]> show tables;
  14. +--------------------------------------------+
  15. | Tables_in_nova |
  16. +--------------------------------------------+
  17. | agent_builds |
  18. | aggregate_hosts |
  19. | aggregate_metadata |
  20. | aggregates |
  21. | allocations |
  22. | block_device_mapping |
  23. | bw_usage_cache |
  24. | cells |
  25. | certificates |
  26. | compute_nodes |
  27. | console_auth_tokens |
  28. | console_pools |
  29. | consoles |
  30. | dns_domains |
  31. | fixed_ips |
  32. | floating_ips |
  33. | instance_actions |
  34. | instance_actions_events |
  35. | instance_extra |
  36. | instance_faults |
  37. | instance_group_member |
  38. | instance_group_policy |
  39. | instance_groups |
  40. | instance_id_mappings |
  41. | instance_info_caches |
  42. | instance_metadata |
  43. | instance_system_metadata |
  44. | instance_type_extra_specs |
  45. | instance_type_projects |
  46. | instance_types |
  47. | instances |
  48. | inventories |
  49. | key_pairs |
  50. | migrate_version |
  51. | migrations |
  52. | networks |
  53. | pci_devices |
  54. | project_user_quotas |
  55. | provider_fw_rules |
  56. | quota_classes |
  57. | quota_usages |
  58. | quotas |
  59. | reservations |
  60. | resource_provider_aggregates |
  61. | resource_providers |
  62. | s3_images |
  63. | security_group_default_rules |
  64. | security_group_instance_association |
  65. | security_group_rules |
  66. | security_groups |
  67. | services |
  68. | shadow_agent_builds |
  69. | shadow_aggregate_hosts |
  70. | shadow_aggregate_metadata |
  71. | shadow_aggregates |
  72. | shadow_block_device_mapping |
  73. | shadow_bw_usage_cache |
  74. | shadow_cells |
  75. | shadow_certificates |
  76. | shadow_compute_nodes |
  77. | shadow_console_pools |
  78. | shadow_consoles |
  79. | shadow_dns_domains |
  80. | shadow_fixed_ips |
  81. | shadow_floating_ips |
  82. | shadow_instance_actions |
  83. | shadow_instance_actions_events |
  84. | shadow_instance_extra |
  85. | shadow_instance_faults |
  86. | shadow_instance_group_member |
  87. | shadow_instance_group_policy |
  88. | shadow_instance_groups |
  89. | shadow_instance_id_mappings |
  90. | shadow_instance_info_caches |
  91. | shadow_instance_metadata |
  92. | shadow_instance_system_metadata |
  93. | shadow_instance_type_extra_specs |
  94. | shadow_instance_type_projects |
  95. | shadow_instance_types |
  96. | shadow_instances |
  97. | shadow_key_pairs |
  98. | shadow_migrate_version |
  99. | shadow_migrations |
  100. | shadow_networks |
  101. | shadow_pci_devices |
  102. | shadow_project_user_quotas |
  103. | shadow_provider_fw_rules |
  104. | shadow_quota_classes |
  105. | shadow_quota_usages |
  106. | shadow_quotas |
  107. | shadow_reservations |
  108. | shadow_s3_images |
  109. | shadow_security_group_default_rules |
  110. | shadow_security_group_instance_association |
  111. | shadow_security_group_rules |
  112. | shadow_security_groups |
  113. | shadow_services |
  114. | shadow_snapshot_id_mappings |
  115. | shadow_snapshots |
  116. | shadow_task_log |
  117. | shadow_virtual_interfaces |
  118. | shadow_volume_id_mappings |
  119. | shadow_volume_usage_cache |
  120. | snapshot_id_mappings |
  121. | snapshots |
  122. | tags |
  123. | task_log |
  124. | virtual_interfaces |
  125. | volume_id_mappings |
  126. | volume_usage_cache |
  127. +--------------------------------------------+
  128. 110 rows in set (0.00 sec)
  129.  
  130. MariaDB [nova]> use nova_api
  131.  
  132. MariaDB [nova_api]> show tables;
  133. +------------------------------+
  134. | Tables_in_nova_api |
  135. +------------------------------+
  136. | aggregate_hosts |
  137. | aggregate_metadata |
  138. | aggregates |
  139. | allocations |
  140. | build_requests |
  141. | cell_mappings |
  142. | flavor_extra_specs |
  143. | flavor_projects |
  144. | flavors |
  145. | host_mappings |
  146. | instance_group_member |
  147. | instance_group_policy |
  148. | instance_groups |
  149. | instance_mappings |
  150. | inventories |
  151. | key_pairs |
  152. | migrate_version |
  153. | placement_aggregates |
  154. | project_user_quotas |
  155. | quota_classes |
  156. | quota_usages |
  157. | quotas |
  158. | request_specs |
  159. | reservations |
  160. | resource_classes |
  161. | resource_provider_aggregates |
  162. | resource_providers |
  163. +------------------------------+
  164. 27 rows in set (0.00 sec)
  165.  
  166. MariaDB [nova_api]> use nova_cell0
  167.  
  168. MariaDB [nova_cell0]> show tables;
  169. +--------------------------------------------+
  170. | Tables_in_nova_cell0 |
  171. +--------------------------------------------+
  172. | agent_builds |
  173. | aggregate_hosts |
  174. | aggregate_metadata |
  175. | aggregates |
  176. | allocations |
  177. | block_device_mapping |
  178. | bw_usage_cache |
  179. | cells |
  180. | certificates |
  181. | compute_nodes |
  182. | console_auth_tokens |
  183. | console_pools |
  184. | consoles |
  185. | dns_domains |
  186. | fixed_ips |
  187. | floating_ips |
  188. | instance_actions |
  189. | instance_actions_events |
  190. | instance_extra |
  191. | instance_faults |
  192. | instance_group_member |
  193. | instance_group_policy |
  194. | instance_groups |
  195. | instance_id_mappings |
  196. | instance_info_caches |
  197. | instance_metadata |
  198. | instance_system_metadata |
  199. | instance_type_extra_specs |
  200. | instance_type_projects |
  201. | instance_types |
  202. | instances |
  203. | inventories |
  204. | key_pairs |
  205. | migrate_version |
  206. | migrations |
  207. | networks |
  208. | pci_devices |
  209. | project_user_quotas |
  210. | provider_fw_rules |
  211. | quota_classes |
  212. | quota_usages |
  213. | quotas |
  214. | reservations |
  215. | resource_provider_aggregates |
  216. | resource_providers |
  217. | s3_images |
  218. | security_group_default_rules |
  219. | security_group_instance_association |
  220. | security_group_rules |
  221. | security_groups |
  222. | services |
  223. | shadow_agent_builds |
  224. | shadow_aggregate_hosts |
  225. | shadow_aggregate_metadata |
  226. | shadow_aggregates |
  227. | shadow_block_device_mapping |
  228. | shadow_bw_usage_cache |
  229. | shadow_cells |
  230. | shadow_certificates |
  231. | shadow_compute_nodes |
  232. | shadow_console_pools |
  233. | shadow_consoles |
  234. | shadow_dns_domains |
  235. | shadow_fixed_ips |
  236. | shadow_floating_ips |
  237. | shadow_instance_actions |
  238. | shadow_instance_actions_events |
  239. | shadow_instance_extra |
  240. | shadow_instance_faults |
  241. | shadow_instance_group_member |
  242. | shadow_instance_group_policy |
  243. | shadow_instance_groups |
  244. | shadow_instance_id_mappings |
  245. | shadow_instance_info_caches |
  246. | shadow_instance_metadata |
  247. | shadow_instance_system_metadata |
  248. | shadow_instance_type_extra_specs |
  249. | shadow_instance_type_projects |
  250. | shadow_instance_types |
  251. | shadow_instances |
  252. | shadow_key_pairs |
  253. | shadow_migrate_version |
  254. | shadow_migrations |
  255. | shadow_networks |
  256. | shadow_pci_devices |
  257. | shadow_project_user_quotas |
  258. | shadow_provider_fw_rules |
  259. | shadow_quota_classes |
  260. | shadow_quota_usages |
  261. | shadow_quotas |
  262. | shadow_reservations |
  263. | shadow_s3_images |
  264. | shadow_security_group_default_rules |
  265. | shadow_security_group_instance_association |
  266. | shadow_security_group_rules |
  267. | shadow_security_groups |
  268. | shadow_services |
  269. | shadow_snapshot_id_mappings |
  270. | shadow_snapshots |
  271. | shadow_task_log |
  272. | shadow_virtual_interfaces |
  273. | shadow_volume_id_mappings |
  274. | shadow_volume_usage_cache |
  275. | snapshot_id_mappings |
  276. | snapshots |
  277. | tags |
  278. | task_log |
  279. | virtual_interfaces |
  280. | volume_id_mappings |
  281. | volume_usage_cache |
  282. +--------------------------------------------+
  283. 110 rows in set (0.00 sec)

14、启动nova服务

  1. [root@ren3 ~]# systemctl enable openstack-nova-api.service \
  2. openstack-nova-consoleauth.service openstack-nova-scheduler.service \
  3. openstack-nova-conductor.service openstack-nova-novncproxy.service
  4.  
  5. [root@ren3 ~]# systemctl start openstack-nova-api.service \
  6. openstack-nova-consoleauth.service openstack-nova-scheduler.service \
  7. openstack-nova-conductor.service openstack-nova-novncproxy.service
  8. [root@ren3 ~]# systemctl status openstack-nova-api.service \
  9. openstack-nova-consoleauth.service openstack-nova-scheduler.service \
  10. openstack-nova-conductor.service openstack-nova-novncproxy.service |grep active |wc -l
  11. 5
  1. [root@ren3 ~]# firewall-cmd --list-ports
  2. 4369/tcp 5672/tcp 15672/tcp 25672/tcp 3306/tcp 11211/tcp 80/tcp 35357/tcp 5000/tcp 9292/tcp 9191/tcp
  3. [root@ren3 ~]# ss -tnl
  4. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  5. LISTEN 0 128 *:8775 *:*
  6. LISTEN 0 128 *:9191 *:*
  7. LISTEN 0 128 192.168.11.3:5672 *:*
  8. LISTEN 0 128 *:25672 *:*
  9. LISTEN 0 128 192.168.11.3:3306 *:*
  10. LISTEN 0 128 192.168.11.3:11211 *:*
  11. LISTEN 0 128 127.0.0.1:11211 *:*
  12. LISTEN 0 128 *:9292 *:*
  13. LISTEN 0 128 *:4369 *:*
  14. LISTEN 0 128 *:22 *:*
  15. LISTEN 0 128 *:15672 *:*
  16. LISTEN 0 100 127.0.0.1:25 *:*
  17. LISTEN 0 100 *:6080 *:*
  18. LISTEN 0 128 *:8774 *:*
  19. LISTEN 0 128 :::5000 :::*
  20. LISTEN 0 128 :::8778 :::*
  21. LISTEN 0 128 ::1:11211 :::*
  22. LISTEN 0 128 :::80 :::*
  23. LISTEN 0 128 :::22 :::*
  24. LISTEN 0 100 ::1:25 :::*
  25. LISTEN 0 128 :::35357 :::*
  26. [root@ren3 ~]# netstat -anp |grep 8775
  27. tcp 0 0 0.0.0.0:8775 0.0.0.0:* LISTEN 18175/python2
  28. [root@ren3 ~]# netstat -anp |grep 6080
  29. tcp 0 0 0.0.0.0:6080 0.0.0.0:* LISTEN 18179/python2
  30. [root@ren3 ~]# firewall-cmd --add-port=8774/tcp --permanent
  31. success
  32. [root@ren3 ~]# firewall-cmd --add-port=8775/tcp --permanent
  33. success
  34. [root@ren3 ~]# firewall-cmd --add-port=8778/tcp --permanent
  35. success
  36. [root@ren3 ~]# firewall-cmd --add-port=6080/tcp --permanent
  37. success
  38. [root@ren3 ~]# firewall-cmd --reload
  39. success

(二)安装和配置计算节点(ren4)

1、安装nova软件包

第一次安装失败,需要解决依赖关系

  1. 在控制节点操作:
    [root@ren3 ~]# ls
  2. anaconda-ks.cfg openrc openstack-ocata
  3. --description openstack_app.tar.gz yum-repo.sh
  4. [root@ren3 ~]# cd openstack-ocata/
  5. [root@ren3 openstack-ocata]# ls
  6. cirros-0.3.3-x86_64-disk.img openstack-compute-yilai
  7. [root@ren3 openstack-ocata]# scp -r openstack-compute-yilai/ ren4:/root/
  8. qemu-img-ev-2.9.0-16.el7_4.8.1.x86_64 100% 2276KB 50.4MB/s 00:00
  9. qemu-kvm-common-ev-2.9.0-16.el7_4.8.1 100% 913KB 28.2MB/s 00:00
  10. qemu-kvm-ev-2.9.0-16.el7_4.8.1.x86_64 100% 2914KB 39.2MB/s 00:00
  1. 在计算节点操作:
    [root@ren4 ~]# ls
  2. anaconda-ks.cfg openstack-compute-yilai yum-repo.sh
  3. [root@ren4 ~]# cd openstack-compute-yilai/
  4. [root@ren4 openstack-compute-yilai]# ls
  5. qemu-img-ev-2.9.0-16.el7_4.8.1.x86_64.rpm
  6. qemu-kvm-common-ev-2.9.0-16.el7_4.8.1.x86_64.rpm
  7. qemu-kvm-ev-2.9.0-16.el7_4.8.1.x86_64.rpm
  8. [root@ren4 openstack-compute-yilai]# yum localinstall ./* -y
  1. [root@ren4 ~]# yum install openstack-nova-compute -y

2、编辑/etc/nova/nova.conf文件

(1)[DEFAULT]部分,启用计算和元数据api:

  1. [DEFAULT]
  2. # ...
  3. enabled_apis = osapi_compute,metadata

(2)在[DEFAULT]部分,配置RabbitMQ消息队列访问:

  1. [DEFAULT]
  2. # ...
  3. transport_url = rabbit://openstack:RABBIT_PASS@controller

(3)在[api]和[keystone_authtoken]部分,配置身份服务访问:

  1. [api]
  2. # ...
  3. auth_strategy = keystone
  4.  
  5. [keystone_authtoken]
  6. # ...
  7. auth_uri = http://controller:5000
  8. auth_url = http://controller:35357
  9. memcached_servers = controller:11211
  10. auth_type = password
  11. project_domain_name = default
  12. user_domain_name = default
  13. project_name = service
  14. username = nova
  15. password = NOVA_PASS

(4)在[DEFAULT]部分,配置my_ip选项:

  1. [DEFAULT]
  2. # ...
  3. my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS

(5)在[DEFAULT]部分,启用对网络服务的支持:

  1. [DEFAULT]
  2. # ...
  3. use_neutron = True
  4. firewall_driver = nova.virt.firewall.NoopFirewallDriver

(6)在[vnc]部分,启用和配置远程控制台访问:

  1. [vnc]
  2. # ...
  3. enabled = True
  4. vncserver_listen = 0.0.0.0
  5. vncserver_proxyclient_address = $my_ip
  6. novncproxy_base_url = http://controller:6080/vnc_auto.html

(7)在[glance]部分,配置图像服务API的位置:

  1. [glance]
  2. # ...
  3. api_servers = http://controller:9292

(8)在[oslo_concurrency]部分,配置锁路径:

  1. [oslo_concurrency]
  2. # ...
  3. lock_path = /var/lib/nova/tmp

(9)在[placement]部分,配置放置API:

  1. [placement]
  2. # ...
  3. os_region_name = RegionOne
  4. project_domain_name = Default
  5. project_name = service
  6. auth_type = password
  7. user_domain_name = Default
  8. auth_url = http://controller:35357/v3
  9. username = placement
  10. password = PLACEMENT_PASS

(10)配置[libvirt]部分来使用QEMU

  1. [libvirt]
  2. # ...
  3. virt_type = qemu

修改后的配置文件:

  1. [root@ren4 ~]# cd /etc/nova/
  2. [root@ren4 nova]# ls
  3. api-paste.ini nova.conf policy.json release rootwrap.conf
  4. [root@ren4 nova]# cp nova.conf nova.conf.bak
  5. [root@ren4 nova]# vim nova.conf
  1. [DEFAULT]
  2. my_ip = 192.168.11.4
  3. use_neutron = True
  4. firewall_driver = nova.virt.firewall.NoopFirewallDriver
  5. enabled_apis=osapi_compute,metadata
  6. transport_url = rabbit://openstack:admin@ren3
  7.  
  8. [api]
  9. auth_strategy = keystone
  10.  
  11. [api_database]
  12. #connection = mysql+pymysql://nova:NOVA_DBPASS@ren3/nova_api
  13.  
  14. [barbican]
  15.  
  16. [cache]
  17.  
  18. [cells]
  19.  
  20. [cinder]
  21. #os_region_name = RegionOne
  22.  
  23. [cloudpipe]
  24.  
  25. [conductor]
  26.  
  27. [console]
  28.  
  29. [consoleauth]
  30.  
  31. [cors]
  32.  
  33. [cors.subdomain]
  34.  
  35. [crypto]
  36.  
  37. [database]
  38. #connection = mysql+pymysql://nova:NOVA_DBPASS@ren3/nova
  39.  
  40. [ephemeral_storage_encryption]
  41.  
  42. [filter_scheduler]
  43.  
  44. [glance]
  45. api_servers = http://ren3:9292
  46.  
  47. [guestfs]
  48.  
  49. [healthcheck]
  50.  
  51. [hyperv]
  52.  
  53. [image_file_url]
  54.  
  55. [ironic]
  56.  
  57. [key_manager]
  58.  
  59. [keystone_authtoken]
  60. auth_uri = http://ren3:5000
  61. auth_url = http://ren3:35357
  62. memcached_servers = ren3:11211
  63. auth_type = password
  64. project_domain_name = default
  65. user_domain_name = default
  66. project_name = service
  67. username = nova
  68. password = nova
  69.  
  70. [libvirt]
  71. virt_type = qemu
  72.  
  73. [matchmaker_redis]
  74.  
  75. [metrics]
  76.  
  77. [mks]
  78.  
  79. [neutron]
  80. #url = http://ren3:9696
  81. #auth_url = http://ren3:35357
  82. #auth_type = password
  83. #project_domain_name = default
  84. #user_domain_name = default
  85. #region_name = RegionOne
  86. #project_name = service
  87. #username = neutron
  88. #password = neutron
  89. #service_metadata_proxy = true
  90. #metadata_proxy_shared_secret = METADATA_SECRET
  91.  
  92. [notifications]
  93.  
  94. [osapi_v21]
  95.  
  96. [oslo_concurrency]
  97. lock_path = /var/lib/nova/tmp
  98.  
  99. [oslo_messaging_amqp]
  100.  
  101. [oslo_messaging_kafka]
  102.  
  103. [oslo_messaging_notifications]
  104.  
  105. [oslo_messaging_rabbit]
  106.  
  107. [oslo_messaging_zmq]
  108.  
  109. [oslo_middleware]
  110.  
  111. [oslo_policy]
  112.  
  113. [pci]
  114.  
  115. [placement]
  116. os_region_name = RegionOne
  117. auth_type = password
  118. auth_url = http://ren3:35357/v3
  119. project_name = service
  120. project_domain_name = Default
  121. username = placement
  122. password = placement
  123. user_domain_name = Default
  124.  
  125. [quota]
  126.  
  127. [rdp]
  128.  
  129. [remote_debug]
  130.  
  131. [scheduler]
  132.  
  133. [serial_console]
  134.  
  135. [service_user]
  136.  
  137. [spice]
  138.  
  139. [ssl]
  140.  
  141. [trusted_computing]
  142.  
  143. [upgrade_levels]
  144.  
  145. [vendordata_dynamic_auth]
  146.  
  147. [vmware]
  148.  
  149. [vnc]
  150. enabled = True
  151. vncserver_listen = 0.0.0.0
  152. vncserver_proxyclient_address = $my_ip
  153. novncproxy_base_url = http://192.168.11.3:6080/vnc_auto.html
  154.  
  155. [workarounds]
  156.  
  157. [wsgi]
  158.  
  159. [xenserver]
  160.  
  161. [xvp]

3、启动服务

  1. [root@ren4 ~]# systemctl enable libvirtd.service openstack-nova-compute.service
  2. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
  3. [root@ren4 ~]# systemctl start libvirtd.service openstack-nova-compute.service
  4. [root@ren4 ~]# ss -tnl
  5. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  6. LISTEN 0 128 *:111 *:*
  7. LISTEN 0 128 *:22 *:*
  8. LISTEN 0 100 127.0.0.1:25 *:*
  9. LISTEN 0 128 :::111 :::*
  10. LISTEN 0 128 :::22 :::*
  11. LISTEN 0 100 ::1:25 :::*
  12. [root@ren4 ~]# systemctl status libvirtd.service openstack-nova-compute.service |grep active |wc -l
  13. 2
  1. [root@ren4 ~]# firewall-cmd --add-port=111/tcp
  2. success
  3. [root@ren4 ~]# firewall-cmd --add-port=111/tcp --permanent
  4. success

4、将计算节点添加到cell数据库(在控制节点上运行)

(1)加载系统环境变量,并确认

  1. [root@ren3 ~]# . openrc
  2. [root@ren3 ~]# openstack hypervisor list
  3. +----+---------------------+-----------------+--------------+-------+
  4. | ID | Hypervisor Hostname | Hypervisor Type | Host IP | State |
  5. +----+---------------------+-----------------+--------------+-------+
  6. | 1 | ren4 | QEMU | 192.168.11.4 | up |
  7. +----+---------------------+-----------------+--------------+-------+

(2)发现计算主机:

  1. [root@ren3 ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
  2. Found 2 cell mappings.
  3. Skipping cell0 since it does not contain hosts.
  4. Getting compute nodes from cell 'cell1': e02ac651-4481-48ce-aed3-ff4dfc75b026
  5. Found 1 computes in cell: e02ac651-4481-48ce-aed3-ff4dfc75b026
  6. Checking host mapping for compute host 'ren4': 84f6b8ad-b130-41e3-bcf1-1b25cfad1d77
  7. Creating host mapping for compute host 'ren4': 84f6b8ad-b130-41e3-bcf1-1b25cfad1d77

  当添加新的计算节点时,必须在控制节点上运行 nova-manage cell_v2 discover_hosts 来注册这些新的计算节点。或者,可以在/etc/nova/nova.conf中设置一个适当的间隔:

  1. [scheduler]
  2. discover_hosts_in_cells_interval = 300

5、验证计算服务

(1)验证服务组件的启动

  1. [root@ren3 ~]# openstack compute service list
  2. +----+------------+------+----------+---------+-------+--------------+
  3. | ID | Binary | Host | Zone | Status | State | Updated At |
  4. +----+------------+------+----------+---------+-------+--------------+
  5. | 1 | nova-conso | ren3 | internal | enabled | up | 2019-10-12T1 |
  6. | | leauth | | | | | 1:42:35.0000 |
  7. | | | | | | | 00 |
  8. | 2 | nova- | ren3 | internal | enabled | up | 2019-10-12T1 |
  9. | | conductor | | | | | 1:42:34.0000 |
  10. | | | | | | | 00 |
  11. | 3 | nova- | ren3 | internal | enabled | up | 2019-10-12T1 |
  12. | | scheduler | | | | | 1:42:35.0000 |
  13. | | | | | | | 00 |
  14. | 6 | nova- | ren4 | nova | enabled | up | 2019-10-12T1 |
  15. | | compute | | | | | 1:42:29.0000 |
  16. | | | | | | | 00 |
  17. +----+------------+------+----------+---------+-------+--------------+
  1. [root@ren3 ~]# nova service-list
  2. +----+------------------+------+----------+---------+-------+----------------------------+-----------------+
  3. | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
  4. +----+------------------+------+----------+---------+-------+----------------------------+-----------------+
  5. | 1 | nova-consoleauth | ren3 | internal | enabled | up | 2019-10-14T02:10:33.000000 | - |
  6. | 2 | nova-conductor | ren3 | internal | enabled | up | 2019-10-14T02:10:42.000000 | - |
  7. | 3 | nova-scheduler | ren3 | internal | enabled | up | 2019-10-14T02:10:33.000000 | - |
  8. | 6 | nova-compute | ren4 | nova | enabled | up | 2019-10-14T02:10:40.000000 | - |
  9. +----+------------------+------+----------+---------+-------+----------------------------+-----------------+

这个输出应该表明在控制节点上启用了三个服务组件,在计算节点上启用了一个服务组件。

(2)列出身份服务中的API端点,以验证与身份服务的连接性:

  1. [root@ren3 ~]# openstack catalog list
  2. +-----------+-----------+-----------------------------------+
  3. | Name | Type | Endpoints |
  4. +-----------+-----------+-----------------------------------+
  5. | nova | compute | RegionOne |
  6. | | | internal: http://ren3:8774/v2.1 |
  7. | | | RegionOne |
  8. | | | public: http://ren3:8774/v2.1 |
  9. | | | RegionOne |
  10. | | | admin: http://ren3:8774/v2.1 |
  11. | | | |
  12. | glance | image | RegionOne |
  13. | | | internal: http://ren3:9292 |
  14. | | | RegionOne |
  15. | | | admin: http://ren3:9292 |
  16. | | | RegionOne |
  17. | | | public: http://ren3:9292 |
  18. | | | |
  19. | keystone | identity | RegionOne |
  20. | | | public: http://ren3:5000/v3/ |
  21. | | | RegionOne |
  22. | | | internal: http://ren3:5000/v3/ |
  23. | | | RegionOne |
  24. | | | admin: http://ren3:35357/v3/ |
  25. | | | |
  26. | placement | placement | RegionOne |
  27. | | | admin: http://ren3:8778 |
  28. | | | RegionOne |
  29. | | | internal: http://ren3:8778 |
  30. | | | RegionOne |
  31. | | | public: http://ren3:8778 |
  32. | | | |
  33. +-----------+-----------+-----------------------------------+

(3)验证镜像服务的镜像

  1. [root@ren3 ~]# glance image-list
  2. +--------------------------------------+--------+
  3. | ID | Name |
  4. +--------------------------------------+--------+
  5. | d8e9a113-edef-41a6-9778-622edf76de39 | cirros |
  6. +--------------------------------------+--------+
  1. [root@ren3 ~]# openstack image list
  2. +--------------------------------------+--------+--------+
  3. | ID | Name | Status |
  4. +--------------------------------------+--------+--------+
  5. | d8e9a113-edef-41a6-9778-622edf76de39 | cirros | active |
  6. +--------------------------------------+--------+--------+

(4)检查cells和placement API是否正常工作:

  1. [root@ren3 ~]# nova-status upgrade check
  2. +---------------------------+
  3. | Upgrade Check Results |
  4. +---------------------------+
  5. | Check: Cells v2 |
  6. | Result: 成功 |
  7. | Details: None |
  8. +---------------------------+
  9. | Check: Placement API |
  10. | Result: 成功 |
  11. | Details: None |
  12. +---------------------------+
  13. | Check: Resource Providers |
  14. | Result: 成功 |
  15. | Details: None |
  16. +---------------------------+

云计算OpenStack核心组件---nova计算服务(7)的更多相关文章

  1. 云计算openstack核心组件——nova计算服务(7)

    一.nova介绍:       Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源.OpenStack 作为 IaaS 的云操作系统,虚拟机生命周期管理也就是通过 Nova ...

  2. openstack核心组件——nova计算服务(7)

    云计算openstack核心组件——nova计算服务(7)   一.nova介绍:       Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源.OpenStack 作为 ...

  3. OpenStack核心组件-nova计算服务

    1. nova介绍 Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源.OpenStack 作为 IaaS 的云操作系统,虚拟机生命周期管理也就是通过 Nova 来实现的. ...

  4. openstack核心组件--nova计算服务(3)

    一.nova介绍:       Nova 是 OpenStack 最核心的服务,负责维护和管理云环境的计算资源.OpenStack 作为 IaaS 的云操作系统,虚拟机生命周期管理也就是通过 Nova ...

  5. 云计算OpenStack核心组件---neutron网络服务(8)*****

    一.neutron介绍 1.Neutron概述 传统的网络管理方式很大程度上依赖于管理员手工配置和维护各种网络硬件设备:而云环境下的网络已经变得非常复杂,特别是在多租户场景里,用户随时都可能需要创建. ...

  6. 云计算openstack核心组件——neutron网络服务(9)

    一.虚拟机获取 ip: 用 namspace 隔离 DHCP 服务   Neutron 通过 dnsmasq 提供 DHCP 服务,而 dnsmasq 通过 Linux Network Namespa ...

  7. 云计算openstack核心组件——neutron网络服务(8)

    一.neutron 介绍:   Neutron 概述 传统的网络管理方式很大程度上依赖于管理员手工配置和维护各种网络硬件设备:而云环境下的网络已经变得非常复杂,特别是在多租户场景里,用户随时都可能需要 ...

  8. 云计算openstack核心组件——cinder存储服务(11)

    一.cinder 介绍:   理解 Block Storage 操作系统获得存储空间的方式一般有两种: 通过某种协议(SAS,SCSI,SAN,iSCSI 等)挂接裸硬盘,然后分区.格式化.创建文件系 ...

  9. 云计算OpenStack核心组件---cinder存储服务(10)

    一.cinder介绍 1.Block Storage 操作系统获得存储空间的方式一般有两种: (1)通过某种协议(SAS,SCSI,SAN,iSCSI 等)挂接裸硬盘,然后分区.格式化.创建文件系统: ...

随机推荐

  1. PAT A1032 Sharing

    题意:给出两条链表的首地址以及若干节点的地址,数据,下一个节点的地址,求两条链表的首个共用节点的地址.如果两条链表没有共用节点,则输出-1.思路步骤1:由于地址的范围很小,因此可以直接用静态链表,但是 ...

  2. 《剑指offer》刷题笔记

    简介 此笔记为我在 leetcode 上的<剑指offer>专题刷题时的笔记整理. 在刷题时我尝试了 leetcode 上热门题解中的多种方法,这些不同方法的实现都列在了笔记中. leet ...

  3. 命令行运行py文件报错

    起因 今天用ubuntu 终端运行py文件报了个错,找不到模块? 我切换回pycharm中运行,运行一切正常 解决 在报错模块中,插入绝对路径 import sys sys.path.append(' ...

  4. 利用宝塔面板搭建 Laravel 5.5 环境

    1.更新系统 yum install epel-release #rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest- ...

  5. hdu4415 不错的想法题

    题意: 一个人他有一定的血,有一些怪物,他去杀怪物,有的怪物杀死他后还可以在不费自己血的情况下任意杀死一些怪物,问你他最多杀死多少怪物,在最多杀怪前提下最好用多少血,(大体题意是这样). 思路: 首先 ...

  6. hdu1501 记忆化搜索

    题意:       给你三个字符串,问你前两个能不能拼成第三个串. 思路:       直接记忆化神搜就行,思路水,看下代码就知道了.这个题目我感觉最大公共子序列dp的作法是错的,虽然有人ac了,随便 ...

  7. LA3602DNA序列

    题意:      给你一个一些DNA序列(只有ACGT)然后让你构造一个序列,使得所有的序列到他的Hamming距离最小,所有的序列包括构造的序列长度都是N,Hamming表示两个序列的不同字符位置个 ...

  8. Win64 驱动内核编程-18.SSDT

    SSDT 学习资料:http://blog.csdn.net/zfdyq0/article/details/26515019 学习资料:WIN64内核编程基础 胡文亮 SSDT(系统服务描述表),刚开 ...

  9. Windows PE变形练手2-开发一套自己的PE嵌入模板

    PE嵌入模板 编写一段代码,生成一个已经处理过重定位信息,同时所有的内容都在代码段里,并且没有导入表的PE程序,把这个程序嵌入到其他PE的相关位置,能够独立的运行,接下来是整理了2个模板,一个是Hel ...

  10. visual studio 将他人的 vtk 程序在本机生成

    在网上下载了一些关于vtk的资源,在本机使用visual studio 打开后,生成时出现类似与以下的错误 无法打开包括文件:"vtkStructuredPointsToPolyDataFi ...