shuangmu668

 

部署glance服务

部署glance服务

1.1简介

身份认证服务部署完毕之后,部署glance映像服务,映像服务可以帮助⽤户发现、注册、检索虚拟机映像,就是说启动实例的镜 像是放在这⾥的。默认情况下,该⽬录为/var/lib/glance/images/。
OpenStack映像服务对于基础架构即服务(IaaS)⾄关重要。它接受来⾃磁盘或服务器映像的API请求,以及来⾃终⽤户或 OpenStack Compute组件的元数据定义。它还⽀持在各种存储库类型(包括OpenStack对象存储)上存储磁盘或服务器映像。
简单来说就是glance映像服务,他可以帮助⽤户发现、注册、检索虚机的映像,就像是我们虚拟机的镜像⽂件都是放在这⾥的。
glance映像服务组件:glance-api ,通过访问api来发现、检索、存储镜像; glance-registry ,存储glance中上传镜像的元数据; PS: 什么是元数据?就是你上传的镜像是什么操作系统啊?镜像有多⼤啊?是什么模式啊?(raw/qcow2),Database 元数据,映 像元数据信息是存储在数据库中的,就是在我们的mariadb中; Storage repository for image files 元数据存储库,元数据存储的时候还会有⼀个库,⽀持各种存储库类型,包括普通⽂件系统 Metadata definition service 元数据定义符,映像的元数据,定义那个⼚商、卷、特点等数据;

1.2安装glance

安装glance软件包。只在控制节点进行操作。
[root@controller ~]# yum install -y openstack-glance
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                               | 3.6 kB  00:00:00     
Not using downloaded base/repomd.xml because it is older than what we have:
  Current   : Tue Mar  1 00:02:19 2022
  Downloaded: Fri Oct 30 04:03:00 2020
extras                                                             | 2.9 kB  00:00:00     
train                                                              | 2.9 kB  00:00:00     
updates                                                            | 2.9 kB  00:00:00     
virt        
......
  urw-base35-gothic-fonts.noarch 0:20170801-10.el7                                        
  urw-base35-nimbus-mono-ps-fonts.noarch 0:20170801-10.el7                                
  urw-base35-nimbus-roman-fonts.noarch 0:20170801-10.el7                                  
  urw-base35-nimbus-sans-fonts.noarch 0:20170801-10.el7                                   
  urw-base35-p052-fonts.noarch 0:20170801-10.el7                                          
  urw-base35-standard-symbols-ps-fonts.noarch 0:20170801-10.el7                           
  urw-base35-z003-fonts.noarch 0:20170801-10.el7                                          
  xdg-utils.noarch 0:1.1.0-0.17.20120809git.el7                                           
  xorg-x11-font-utils.x86_64 1:7.5-21.el7                                                 
  xorg-x11-server-utils.x86_64 0:7.7-20.el7                                               

Complete!
# 安装后会自动生成glance用户和用户组
[root@controller ~]# cat /etc/passwd | grep glance
glance:x:161:161:OpenStack Glance Daemons:/var/lib/glance:/sbin/nologin
[root@controller ~]# cat /etc/group | grep glance
glance:x:161:
# 创建glance数据库并授权
# 连接数据库
[root@controller ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 新建glance数据库
MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.000 sec)
# 为新数据库授权本地和远程登录glance用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'qwerty';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'qwerty'; 
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> quit;
Bye
1.3配置glance
glance的配置文件是/etc/glance/glance-api.conf,修改它可以实现glance与数据库及keystone的连接。
# 1.备份配置文件
[root@controller ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
# 2.去掉配置文件注释和空行
# grep:查找文件中符合条件的字符串。 -E:采用正则表达式;-v:匹配所有不满足正则的条件(反选)
# ^:以什么开头; $:匹配字符结尾;|:匹配|左或|右的字符
[root@controller ~]# grep -Ev '^$|#' /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
# 3.编辑配置文件
# default_store = file:默认存储系统为本地系统
# filesystem_store_datadir = /var/lib/glance/images/ : 镜像文件实际存储的目录
[root@controller glance]# vi glance-api.conf
[database]
connection = mysql+pymysql://glance:000000@controller/glance

[glance_store]
stores = file
default_store = file                                  
filesystem_store_datadir = /var/lib/glance/images/

[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
username = glance
password = qwerty
project_name = project
user_domain_name = Default
project_domain_name = Default

[paste_deploy]
flavor = keystone
# 4.初始化数据库
# 同步数据库:将安装文件中的数据库表信息填入数据库中
[root@controller glance]# su glance -s /bin/sh -c "glance-manage db_sync"
# 检查数据库
[root@controller glance]# mysql -uroot -p000000
MariaDB [(none)]> use glance
MariaDB [glance]> show tables;
+----------------------------------+
| Tables_in_glance                 |
+----------------------------------+
| alembic_version                  |
| image_locations                  |
| image_members                    |
| image_properties                 |
| image_tags                       |
| images                           |
.....
1.4Glance组件初始化
Glance安装配置成功之后,需要给glance初始化用户、密码并分配角色、初始化服务和服务端点6.

1.4.1创建Glance用户并分配角色

# 导入环境变量模拟登录
[root@controller ~]# source admin-login 
# 在default域创建名为glance,密码为000000的用户
[root@controller ~]# openstack user create --domain default --password 000000 glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 0b425e2bb340446387615dd5967a9695 |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
# 查看当前已有的项目
[root@controller ~]# openstack project list
+----------------------------------+---------+
| ID                               | Name    |
+----------------------------------+---------+
| 011fb8f2db554f9193f95c1b6b64d4e7 | project |
| 18196711d4294cf7be4729aac1f947f2 | admin   |
+----------------------------------+---------+
# 查看已有的用户
[root@controller ~]# openstack user list
+----------------------------------+--------+
| ID                               | Name   |
+----------------------------------+--------+
| 93a47b4afdc3448e876d1d2032f8fcba | admin  |
| 0b425e2bb340446387615dd5967a9695 | glance |
+----------------------------------+--------+
# 授予glance用户操作project项目时的admin角色权限
[root@controller ~]# openstack role add --project project --user glance admin
# 查看glance用户详情
[root@controller ~]# openstack user show glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 0b425e2bb340446387615dd5967a9695 |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
1.4.2创建glance服务及服务端点
# 1.创建服务
# 创建名为glance,类型为image的服务
 [root@controller ~]# openstack service create --name glance image
+---------+----------------------------------+
| Field   | Value                            |
+---------+----------------------------------+
| enabled | True                             |
| id      | 608e818b4b864b639fd20def9f2e76dd |
| name    | glance                           |
| type    | image                            |
+---------+----------------------------------+

# 2.创建镜像服务端点
# 服务端点有三种:公共用户(public)、内部组件(internal)、Admin用户(admin)服务的地址。
# 创建公共用户访问服务端点
[root@controller ~]# openstack endpoint create --region RegionOne glance public http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b8baf2edb7b2422e8b6a7455928c8bb0 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 608e818b4b864b639fd20def9f2e76dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
# 创建内部组件访问服务端点
[root@controller ~]# openstack endpoint create --region RegionOne glance internal http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 6cba0f466bba42a9894c93bdbe0b04eb |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 608e818b4b864b639fd20def9f2e76dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
# 创建Admin用户访问服务端点
[root@controller ~]# openstack endpoint create --region RegionOne glance admin http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0b4374eeb8b640b7bd6ba540c49a94ad |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 608e818b4b864b639fd20def9f2e76dd |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
# 查克服务端点
[root@controller ~]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                       |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| 0b4374eeb8b640b7bd6ba540c49a94ad | RegionOne | glance       | image        | True    | admin     | http://controller:9292    |
| 3dc3554208da4f9581f1aa9b315ce065 | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3 |
| 6cba0f466bba42a9894c93bdbe0b04eb | RegionOne | glance       | image        | True    | internal  | http://controller:9292    |
| 7917542dbe9a4be98ce09266408e90d4 | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3 |
| b8baf2edb7b2422e8b6a7455928c8bb0 | RegionOne | glance       | image        | True    | public    | http://controller:9292    |
| d1c62f12e0cd4a389a1ff8c645c8640e | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+

1.4.3启动glance服务
# 开机启动glance服务
[root@controller ~]# systemctl enable openstack-glance-api
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
# 启动glance服务
[root@controller ~]# systemctl start openstack-glance-api

1.5.验证Glance服务

检查glance服务是否正常。
# 方法一:查看端口占用情况(9292是否被占用)
[root@controller ~]# systemctl start openstack-glance-api
[root@controller ~]# netstat -tnlup | grep 9292
tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN      3478/python2        
# 方法二:查看服务运行状态(active (running)说明服务正在运行)
[root@controller ~]# systemctl status openstack-glance-api
● openstack-glance-api.service - OpenStack Image Service (code-named Glance) API server
   Loaded: loaded (/usr/lib/systemd/system/openstack-glance-api.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-04-19 11:22:46 CST; 22s ago
 Main PID: 3478 (glance-api)
   CGroup: /system.slice/openstack-glance-api.service
           ├─3478 /usr/bin/python2 /usr/bin/glance-api
           ├─3490 /usr/bin/python2 /usr/bin/glance-api
           └─3491 /usr/bin/python2 /usr/bin/glance-api

Apr 19 11:22:46 controller systemd[1]: Started OpenStack Image Service (code-named Glance...er.
Apr 19 11:22:47 controller glance-api[3478]: /usr/lib/python2.7/site-packages/paste/deploy...y.
Apr 19 11:22:47 controller glance-api[3478]: return pkg_resources.EntryPoint.parse("x=" + ...e)
Hint: Some lines were ellipsized, use -l to show in full.

2.放置服务(Placement)部署

从Openstack(Stein)版本开始,将系统资源的监控功能从NOVA中独立出来,成为一个独立的组件————Placement。

2.1安装Placement软件包

# 安装placement软件包
# 安装好会自动生成placement用户和用户组
[root@controller ~]# yum install -y openstack-placement-api
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                              | 3.6 kB  00:00:00     
Not using downloaded base/repomd.xml because it is older than what we have:
  Current   : Tue Mar  1 00:02:19 2022
  Downloaded: Fri Oct 30 04:03:00 2020
extras                                                            | 2.9 kB  00:00:00     
train                                                             | 2.9 kB  00:00:00     
updates                                                           | 2.9 kB  00:00:00     
virt                                                              | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package openstack-placement-api.noarch 0:2.0.1-1.el7 will be installed
--> Processing Dependency: openstack-placement-common = 2.0.1-1.el7 for package: openstack-placement-api-2.0.1-1.el7.noarch
--> Running transaction check
---> Package openstack-placement-common.noarch 0:2.0.1-1.el7 will be installed
--> Processing Dependency: python2-placement = 2.0.1-1.el7 for package: openstack-placement-common-2.0.1-1.el7.noarch
--> Running transaction check
---> Package python2-placement.noarch 0:2.0.1-1.el7 will be installed
--> Processing Dependency: python2-os-traits >= 0.16.0 for package: python2-placement-2.0.1-1.el7.noarch
--> Processing Dependency: python2-os-resource-classes >= 0.5.0 for package: python2-placement-2.0.1-1.el7.noarch
--> Processing Dependency: python2-microversion-parse >= 0.2.1 for package: python2-placement-2.0.1-1.el7.noarch
--> Running transaction check
---> Package python2-microversion-parse.noarch 0:0.2.1-1.el7 will be installed
---> Package python2-os-resource-classes.noarch 0:0.5.0-1.el7 will be installed
---> Package python2-os-traits.noarch 0:0.16.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
 Package                            Arch          Version             Repository    Size
=========================================================================================
Installing:
 openstack-placement-api            noarch        2.0.1-1.el7         train        8.5 k
Installing for dependencies:
 openstack-placement-common         noarch        2.0.1-1.el7         train         21 k
 python2-microversion-parse         noarch        0.2.1-1.el7         train         27 k
 python2-os-resource-classes        noarch        0.5.0-1.el7         train         13 k
 python2-os-traits                  noarch        0.16.0-1.el7        train         34 k
 python2-placement                  noarch        2.0.1-1.el7         train        245 k

Transaction Summary
=========================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 349 k
Installed size: 1.2 M
Downloading packages:
-----------------------------------------------------------------------------------------
Total                                                        16 MB/s | 349 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-os-traits-0.16.0-1.el7.noarch                                 1/6 
  Installing : python2-os-resource-classes-0.5.0-1.el7.noarch                        2/6 
  Installing : python2-microversion-parse-0.2.1-1.el7.noarch                         3/6 
  Installing : python2-placement-2.0.1-1.el7.noarch                                  4/6 
  Installing : openstack-placement-common-2.0.1-1.el7.noarch                         5/6 
  Installing : openstack-placement-api-2.0.1-1.el7.noarch                            6/6 
  Verifying  : python2-microversion-parse-0.2.1-1.el7.noarch                         1/6 
  Verifying  : python2-placement-2.0.1-1.el7.noarch                                  2/6 
  Verifying  : openstack-placement-api-2.0.1-1.el7.noarch                            3/6 
  Verifying  : python2-os-resource-classes-0.5.0-1.el7.noarch                        4/6 
  Verifying  : openstack-placement-common-2.0.1-1.el7.noarch                         5/6 
  Verifying  : python2-os-traits-0.16.0-1.el7.noarch                                 6/6 

Installed:
  openstack-placement-api.noarch 0:2.0.1-1.el7                                           

Dependency Installed:
  openstack-placement-common.noarch 0:2.0.1-1.el7                                        
  python2-microversion-parse.noarch 0:0.2.1-1.el7                                        
  python2-os-resource-classes.noarch 0:0.5.0-1.el7                                       
  python2-os-traits.noarch 0:0.16.0-1.el7                                                
  python2-placement.noarch 0:2.0.1-1.el7                                                 

Complete!
# 查看确认用户和用户组已经创建
[root@controller etc]# cat /etc/passwd | grep placement
placement:x:993:990:OpenStack Placement:/:/bin/bash
[root@controller etc]# cat /etc/group | grep placement
placement:x:990:
# 登录数据库
[root@controller etc]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 创建placement数据库
MariaDB [(none)]> create database placement;
Query OK, 1 row affected (0.000 sec)
# 数据库授权
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> quit
Bye

2.2配置placement服务

# 备份配置文件
[root@controller etc]# cp /etc/placement/placement.conf 
[root@controller etc]# ls /etc/placement/
placement.conf  placement.conf.bak  policy.json
# 去掉配置文件注释和空行
[root@controller etc]# grep -Ev '^$|#' /etc/placement/placement.conf.bak  > /etc/placement/placement.conf

# 编辑配置文件
[root@controller etc]# vi /etc/placement/placement.conf
[DEFAULT]
[api]
auth_strategy = keystone

[cors]
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = project
username = placement
password = 000000

[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:000000@controller/placement

[profiler]
# 编辑修改apache配置文件
# 在"VirtualHost"节点加入如下 Directory内容
[root@controller etc]# cat /etc/httpd/conf.d/00-placement-api.conf
Listen 8778

<VirtualHost *:8778>
  WSGIProcessGroup placement-api

    ......#添加

  <Directory /usr/bin>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>
</VirtualHost>
# 查看Apache版本号
[root@controller etc]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Jan 25 2022 14:08:43
# 同步数据库,将数据库的表信息填充进数据库
[root@controller etc]# su placement -s /bin/sh -c "placement-manage db sync"
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1280, u"Name 'alembic_version_pkc' ignored for PRIMARY key.")
  result = self._query(query)
    
# 检查数据库同步  
[root@controller etc]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use placement;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [placement]> show tables;
+------------------------------+
| Tables_in_placement          |
+------------------------------+
| alembic_version              |
| allocations                  |
| consumers                    |
| inventories                  |
| placement_aggregates         |
| projects                     |
| resource_classes             |
| resource_provider_aggregates |
| resource_provider_traits     |
| resource_providers           |
| traits                       |
| users                        |
+------------------------------+
12 rows in set (0.000 sec)

MariaDB [placement]> quit
Bye

2.3Placement组件初始化

# 导入环境变量模拟登录
[root@controller etc]# source admin-login
# 创建placement用户
[root@controller etc]# openstack user create --domain default --password 000000 placement+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | d2c660e396f34bd7a2f2d4d29b263d5c |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
# 给placement用户分配admin角色
[root@controller etc]# openstack role add --project project --user placement admin
# 创建placement服务
[root@controller etc]# openstack service create --name placement placement
+---------+----------------------------------+
| Field   | Value                            |
+---------+----------------------------------+
| enabled | True                             |
| id      | 2ebbc61a43904150bc00238955cf3030 |
| name    | placement                        |
| type    | placement                        |
+---------+----------------------------------+
# 查看当前已经创建的服务列表
[root@controller etc]# openstack service list
+----------------------------------+-----------+-----------+
| ID                               | Name      | Type      |
+----------------------------------+-----------+-----------+
| 2ebbc61a43904150bc00238955cf3030 | placement | placement |
| 5791882ed1124a329682a431fc800cae | keystone  | identity  |
| 608e818b4b864b639fd20def9f2e76dd | glance    | image     |
+----------------------------------+-----------+-----------+
# 创建服务端点
# placement服务端点有三个:公众用户、内部组件、Admin用户(admin)服务。
[root@controller etc]#  openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | bda21fcfcdd64eb29161d96dc6edbab9 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2ebbc61a43904150bc00238955cf3030 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
[root@controller etc]#  openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c186ba28b09d451c834237c8f277467d |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2ebbc61a43904150bc00238955cf3030 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
[root@controller etc]# openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | def670167ed943f48ed855b1339b589d |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 2ebbc61a43904150bc00238955cf3030 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
# 查看检查
[root@controller etc]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                       |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| 0b4374eeb8b640b7bd6ba540c49a94ad | RegionOne | glance       | image        | True    | admin     | http://controller:9292    |
| 3dc3554208da4f9581f1aa9b315ce065 | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3 |
| 6cba0f466bba42a9894c93bdbe0b04eb | RegionOne | glance       | image        | True    | internal  | http://controller:9292    |
| 7917542dbe9a4be98ce09266408e90d4 | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3 |
| b8baf2edb7b2422e8b6a7455928c8bb0 | RegionOne | glance       | image        | True    | public    | http://controller:9292    |
| bda21fcfcdd64eb29161d96dc6edbab9 | RegionOne | placement    | placement    | True    | public    | http://controller:8778    |
| c186ba28b09d451c834237c8f277467d | RegionOne | placement    | placement    | True    | internal  | http://controller:8778    |
| d1c62f12e0cd4a389a1ff8c645c8640e | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3 |
| def670167ed943f48ed855b1339b589d | RegionOne | placement    | placement    | True    | admin     | http://controller:8778    |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+

2.4Placement组件检测

检测Placement组件的运行状态的两种方法
# 方法一:查看端口占用情况(8778是否被占用)
[root@controller etc]# netstat -tnlup | grep 8778
tcp6       0      0 :::8778                 :::*                    LISTEN      1018/httpd 

# 方法二:查看服务端点通信
[root@controller etc]# curl http://controller:8778
{"versions": [{"status": "CURRENT", "min_version": "1.0", "max_version": "1.36", "id": "v1.0", "links": [{"href": "", "rel": "self"}]}]}
是否创建placement数据库
[root@controller etc]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
| placement          |
+--------------------+
6 rows in set (0.001 sec)
# 查看placement用户对数据库的权限
MariaDB [(none)]>  show grants for placement@'%';
+----------------------------------------------------------------------------------------------------------+
| Grants for placement@%                                                                                   |
+----------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'placement'@'%' IDENTIFIED BY PASSWORD '*032197AE5731D4664921A6CCAC7CFCE6A0698693' |
| GRANT ALL PRIVILEGES ON `placement`.* TO 'placement'@'%'                                                 |
+----------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

MariaDB [(none)]> show grants for placement@'localhost';
+------------------------------------------------------------------------------------------------------------------+
| Grants for placement@localhost                                                                                   |
+------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'placement'@'localhost' IDENTIFIED BY PASSWORD '*032197AE5731D4664921A6CCAC7CFCE6A0698693' |
| GRANT ALL PRIVILEGES ON `placement`.* TO 'placement'@'localhost'                                                 |
+------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
# 查看placement数据表列表
MariaDB [(none)]> use placement;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [placement]> show tables;
+------------------------------+
| Tables_in_placement          |
+------------------------------+
| alembic_version              |
| allocations                  |
| consumers                    |
| inventories                  |
| placement_aggregates         |
| projects                     |
| resource_classes             |
| resource_provider_aggregates |
| resource_provider_traits     |
| resource_providers           |
| traits                       |
| users                        |
+------------------------------+
12 rows in set (0.000 sec)
#查看placement用户是否创建
[root@controller etc]# openstack user list
+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 93a47b4afdc3448e876d1d2032f8fcba | admin     |
| 0b425e2bb340446387615dd5967a9695 | glance    |
| d2c660e396f34bd7a2f2d4d29b263d5c | placement |
+----------------------------------+-----------+
# placement服务是否创建
[root@controller etc]# openstack service list
+----------------------------------+-----------+-----------+
| ID                               | Name      | Type      |
+----------------------------------+-----------+-----------+
| 2ebbc61a43904150bc00238955cf3030 | placement | placement |
| 5791882ed1124a329682a431fc800cae | keystone  | identity  |
| 608e818b4b864b639fd20def9f2e76dd | glance    | image     |
+----------------------------------+-----------+-----------+
# 检测placement服务端点
[root@controller etc]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                       |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+
| 0b4374eeb8b640b7bd6ba540c49a94ad | RegionOne | glance       | image        | True    | admin     | http://controller:9292    |
| 3dc3554208da4f9581f1aa9b315ce065 | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3 |
| 6cba0f466bba42a9894c93bdbe0b04eb | RegionOne | glance       | image        | True    | internal  | http://controller:9292    |
| 7917542dbe9a4be98ce09266408e90d4 | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3 |
| b8baf2edb7b2422e8b6a7455928c8bb0 | RegionOne | glance       | image        | True    | public    | http://controller:9292    |
| bda21fcfcdd64eb29161d96dc6edbab9 | RegionOne | placement    | placement    | True    | public    | http://controller:8778    |
| c186ba28b09d451c834237c8f277467d | RegionOne | placement    | placement    | True    | internal  | http://controller:8778    |
| d1c62f12e0cd4a389a1ff8c645c8640e | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3 |
| def670167ed943f48ed855b1339b589d | RegionOne | placement    | placement    | True    | admin     | http://controller:8778    |
+----------------------------------+-----------+--------------+--------------+---------+-----------+---------------------------+

3.计算服务(Nova)部署

Nova负责云主机实例的创建、删除、启动、停止等。

3.1.安装配置控制节点Nova服务

3.1.1安装nova软件包

控制节点上需安装Nova的四个软件包:

openstack-nova-api:Nova与外部的接口模块
openstack-nova-conductor:Nova传导服务模块,提供数据库访问
openstack-nova-scheduler:Nova调度服务模块,选择某台主机创建云主机
openstack-nova-novncproxy:Nova虚拟网络控制台代理模块,支持用户通过vnc访问云主机。

# 安装nova相关软件包
[root@controller etc]# yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-scheduler openstack-nova-novncproxy
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
......
  python2-zake.noarch 0:0.2.2-2.el7                                                      
  unbound-libs.x86_64 0:1.6.6-5.el7_8                                                    

Complete!
#查看nova用户和用户组
[root@controller etc]# cat /etc/passwd | grep nova
nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/sbin/nologin
[root@controller etc]#  cat /etc/group | grep nova
nobody:x:99:nova
nova:x:162:nova
3.1.2创建Nova数据库并授权
支持nova组件的数据库有三个:nova_api、nova_celll0、nova。
# 登录数据库
[root@controller etc]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, 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.000 sec)

MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| placement          |
+--------------------+
9 rows in set (0.000 sec)
# 为数据库授权本地和远程管理权限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> quit
Bye
3.1.3修改Nova配置文件

Nova配置文件:/etc/nova/nova.conf。修改这个文件可实现Nova与数据库、Keystone和其他组件的连接。

  • api_databas:配置与数据库nova_api连接。

  • database:配置与数据库nova连接。

  • api、keystone_authtoken:配置与keystone交互。

  • placement:配置与Placement组件交互。

  • glance:配置与glance组件交互。

  • oslo_concurrency:配置锁路径。为openstack中的代码块提供线程及进程锁。lock_path配置给这个模块指定了锁路径。

  • DEFAULT:配置使用消息队列和防火墙等信息。

  • vnc:配置vnc连接模式。

  • 配置文件中的 $ 表示取变量值。

    # 备份配置文件
    [root@controller etc]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
    # 去除配置文件中的注释和空行
    [root@controller etc]# grep -Ev '^$|#' /etc/nova/nova.conf.bak > /etc/nova/nova.conf
    # 修改配置文件
    [root@controller etc]#  vi /etc/nova/nova.conf
    
    [DEFAULT]
    enable_apis = osapi_compute,metadata
    transport_url = rabbit://rabbitmq:000000@controller:5672
    my_ip = 192.168.10.10
    use_neutron = true
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    
    [api]
    auth_strategy = keystone
    
    [cinder]
    [compute]
    [conductor]
    [console]
    [consoleauth]
    [cors]
    [database]
    connection = mysql+pymysql://nova:000000@controller/nova
    
    [devices]
    [ephemeral_storage_encryption]
    [filter_scheduler]
    [glance]
    api_servers = http://controller:9292
    
    
    [guestfs]
    [healthcheck]
    [hyperv]
    [ironic]
    project_domain_name = Default
    user_domain_name = Default
    project_name = project
    username = nova
    password = 000000
    
    [libvirt]
    [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_middleware]
    [oslo_policy]
    [pci]
    [placement]
    auth_url = http://controller:5000
    auth_type = password
    project_domain_name = Default
    user_domain_name = Default
    project_name = project
    username = placement
    password = 000000
    region_name = RegionOne
    
    [powervm]
    [privsep]
    [profiler]
    [quota]
    [rdp]
    [remote_debug]
    [scheduler]
    [serial_console]
    [service_user]
    [spice]
    [upgrade_levels]
    [vault]
    [vendordata_dynamic_auth]
    [vmware]
    [vnc]
    enabled = true
    server_listen = $my_ip
    server_proxyclient_address = $my_ip
    
    3.1.4初始化数据库
    将安装文件中的数据库表信息填入数据库中。
    # 初始化 nova_api数据库
    [root@controller etc]# su nova -s /bin/sh -c "nova-manage api_db sync"
    
    # 创建‘cell1’单元,该单元使用nova数据库
    [root@controller etc]#  su nova -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1"
    
    # 映射nova 到cell0数据库,使cell0的表结构与nova表结构一致
    [root@controller etc]# su nova -s /bin/sh -c "nova-manage cell_v2 map_cell0"
    
    # 初始化nova数据库,因为映射,cell0会同步创建相同数据库(有warning先忽略)
    [root@controller etc]# su nova -s /bin/sh -c "nova-manage db sync"
    /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: 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:170: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release')
      result = self._query(query)
    
    3.1.5验证单元是否都正确注册

    存在 cell0cell1 两个单元则正常。
    cell0:系统管理
    cell1:云主机管理,每增加一个计算节点则增加一个和cell1功能相同的单元。

    [root@controller etc]# nova-manage cell_v2 list_cells
    +-------+--------------------------------------+----------------------------------------+-------------------------------------------------+----------+
    |  Name |                 UUID                 |             Transport URL              |               Database Connection               | Disabled |
    +-------+--------------------------------------+----------------------------------------+-------------------------------------------------+----------+
    | cell0 | 00000000-0000-0000-0000-000000000000 |                 none:/                 | mysql+pymysql://nova:****@controller/nova_cell0 |  False   |
    | cell1 | 246e7b58-8c48-448d-8cde-fe173a03d816 | rabbit://rabbitmq:****@controller:5672 |    mysql+pymysql://nova:****@controller/nova    |  False   |
    +-------+--------------------------------------+----------------------------------------+-------------------------------------------------+----------+
    
    

3.2Nova组件初始化及检测

3.2.1Nova组件初始化
# 导入环境变量模拟登录
[root@controller etc]# source admin-login
# 在default域创建名为nova的用户
[root@controller etc]# openstack user create --domain default --password 000000 nova
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 2dd58fef03684eff8e182f71aeb04d23 |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
# 为nova用户分配admin角色
[root@controller etc]# openstack role add --project project --user nova admin

# 创建compute类型的nova服务
[root@controller etc]# openstack service create --name nova compute
+---------+----------------------------------+
| Field   | Value                            |
+---------+----------------------------------+
| enabled | True                             |
| id      | d60e3de44f9046088cf73f585556686f |
| name    | nova                             |
| type    | compute                          |
+---------+----------------------------------+
# 创建服务端点
[root@controller etc]# openstack endpoint create --region RegionOne nova public http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 34bb893e67b44b67aa4d9524813fdec7 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d60e3de44f9046088cf73f585556686f |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+
[root@controller etc]#  openstack endpoint create --region RegionOne nova internal http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 73362f005c3b464bb950181748808a34 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d60e3de44f9046088cf73f585556686f |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+
[root@controller etc]#  openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7ad44bf96c0047a7ad2bb9c0e4e7993d |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d60e3de44f9046088cf73f585556686f |
| service_name | nova                             |
| service_type | compute                          |
| url          | http://controller:8774/v2.1      |
+--------------+----------------------------------+
# 开机启动控制节点的nova服务
[root@controller etc]# systemctl enable openstack-nova-api openstack-nova-scheduler openstack-nova-conductor openstack-nova-novncproxy
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-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.
# 启动nova服务
[root@controller etc]# systemctl start openstack-nova-api openstack-nova-scheduler openstack-nova-conductor openstack-nova-novncproxy
3.2.2检测控制节点nova服务
Nova服务会占用8774和9775端口,查看端口是否启动,可判断Nova服务是否已经运行。
nova-conductornova-scheduler两个服务在控制节点的模块均处于开启(UP)状态,则服务正常。
# 方法一:查看端口占用
[root@controller etc]# netstat -nutpl | grep 877
tcp        0      0 0.0.0.0:8774            0.0.0.0:*               LISTEN      18021/python2       
tcp        0      0 0.0.0.0:8775            0.0.0.0:*               LISTEN      18021/python2       
# 方法二:查看计算服务列表
[root@controller etc]# openstack compute service list
+----+----------------+------------+----------+---------+-------+----------------------------+
| ID | Binary         | Host       | Zone     | Status  | State | Updated At                 |
+----+----------------+------------+----------+---------+-------+----------------------------+
|  4 | nova-conductor | controller | internal | enabled | up    | 2023-04-20T08:49:45.000000 |
|  5 | nova-scheduler | controller | internal | enabled | down  | None                       |
+----+----------------+------------+----------+---------+-------+----------------------------+
3.2.3验证Nova服务
# 方法一:查看计算服务列表
[root@controller ~]# openstack compute service list
+----+----------------+------------+----------+---------+-------+----------------------------+
| ID | Binary         | Host       | Zone     | Status  | State | Updated At                 |
+----+----------------+------------+----------+---------+-------+----------------------------+
|  4 | nova-conductor | controller | internal | enabled | up    | 2023-04-21T13:11:59.000000 |
|  5 | nova-scheduler | controller | internal | enabled | up    | 2023-04-21T13:11:58.000000 |
|  6 | nova-compute   | compute    | nova     | enabled | up    | 2023-04-21T13:11:57.000000 |
+----+----------------+------------+----------+---------+-------+----------------------------+
# 方法二:查看Openstack服务及端点列表
[root@controller ~]# openstack catalog list
+-----------+-----------+-----------------------------------------+
| Name      | Type      | Endpoints                               |
+-----------+-----------+-----------------------------------------+
| placement | placement | RegionOne                               |
|           |           |   public: http://controller:8778        |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:8778      |
|           |           | RegionOne                               |
|           |           |   admin: http://controller:8778         |
|           |           |                                         |
| keystone  | identity  | RegionOne                               |
|           |           |   admin: http://controller:5000/v3      |
|           |           | RegionOne                               |
|           |           |   public: http://controller:5000/v3     |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:5000/v3   |
|           |           |                                         |
| glance    | image     | RegionOne                               |
|           |           |   admin: http://controller:9292         |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:9292      |
|           |           | RegionOne                               |
|           |           |   public: http://controller:9292        |
|           |           |                                         |
| nova      | compute   | RegionOne                               |
|           |           |   public: http://controller:8774/v2.1   |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:8774/v2.1 |
|           |           | RegionOne                               |
|           |           |   admin: http://controller:8774/v2.1    |
|           |           |                                         |
+-----------+-----------+-----------------------------------------+
# 方法三:使用Nova状态检测工具进行检查
[root@controller ~]# nova-status upgrade check
+--------------------------------+
| Upgrade Check Results          |
+--------------------------------+
| Check: Cells v2                |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Placement API           |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Cinder API              |
| Result: Success                |
| Details: None                  |
+--------------------------------+

3.2.4安装完成情况检测
# 1.检查控制节点nova用户和用户组
[root@controller ~]# cat /etc/passwd | grep nova
nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/sbin/nologin
[root@controller ~]# cat /etc/group | grep nova
nobody:x:99:nova
nova:x:162:nova
# 2.检查计算节点nova用户和用户组
[root@compute mnesia]# cat /etc/passwd | grep nova
nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/sbin/nologin
[root@compute mnesia]# cat /etc/group | grep nova
nobody:x:99:nova
qemu:x:107:nova
libvirt:x:987:nova
nova:x:162:nova
# 3.查看控制节点数据库
[root@controller ~]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| nova               |
| nova_api           |
| nova_cell0         |
| performance_schema |
| placement          |
+--------------------+
9 rows in set (0.017 sec)
# 4.查看nova用户对数据库的权限
MariaDB [(none)]> show grants for nova@'%';
+-----------------------------------------------------------------------------------------------------+
| Grants for nova@%                                                                                   |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'nova'@'%' IDENTIFIED BY PASSWORD '*032197AE5731D4664921A6CCAC7CFCE6A0698693' |
| GRANT ALL PRIVILEGES ON `nova`.* TO 'nova'@'%'                                                      |
| GRANT ALL PRIVILEGES ON `nova_api`.* TO 'nova'@'%'                                                  |
| GRANT ALL PRIVILEGES ON `nova_cell0`.* TO 'nova'@'%'                                                |
+-----------------------------------------------------------------------------------------------------+
4 rows in set (0.001 sec)

MariaDB [(none)]> quit
Bye
# 5.nova\nova_api\nova_cell0数据库表同步
[root@controller ~]# mysql -uroot -pqwerty
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use nova
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [nova]> show tables;
+--------------------------------------------+
| Tables_in_nova                             |
+--------------------------------------------+
| agent_builds                               |
| aggregate_hosts                            |
| aggregate_metadata                         |
| aggregates                                 |
| allocations                                |
| block_device_mapping                       |
| bw_usage_cache                             |
| cells                                      |
| certificates                               |
| compute_nodes                              |
| console_auth_tokens                        |
| console_pools                              |
| consoles                                   |
| dns_domains                                |
| fixed_ips                                  |
| floating_ips                               |
| instance_actions                           |
| instance_actions_events                    |
| instance_extra                             |
| instance_faults                            |
| instance_group_member                      |
| instance_group_policy                      |
| instance_groups                            |
| instance_id_mappings                       |
| instance_info_caches                       |
| instance_metadata                          |
| instance_system_metadata                   |
| instance_type_extra_specs                  |
| instance_type_projects                     |
| instance_types                             |
| instances                                  |
| inventories                                |
| key_pairs                                  |
| migrate_version                            |
| migrations                                 |
| networks                                   |
| pci_devices                                |
| project_user_quotas                        |
| provider_fw_rules                          |
| quota_classes                              |
| quota_usages                               |
| quotas                                     |
| reservations                               |
| resource_provider_aggregates               |
| resource_providers                         |
| s3_images                                  |
| security_group_default_rules               |
| security_group_instance_association        |
| security_group_rules                       |
| security_groups                            |
| services                                   |
| shadow_agent_builds                        |
| shadow_aggregate_hosts                     |
| shadow_aggregate_metadata                  |
| shadow_aggregates                          |
| shadow_block_device_mapping                |
| shadow_bw_usage_cache                      |
| shadow_cells                               |
| shadow_certificates                        |
| shadow_compute_nodes                       |
| shadow_console_pools                       |
| shadow_consoles                            |
| shadow_dns_domains                         |
| shadow_fixed_ips                           |
| shadow_floating_ips                        |
| shadow_instance_actions                    |
| shadow_instance_actions_events             |
| shadow_instance_extra                      |
| shadow_instance_faults                     |
| shadow_instance_group_member               |
| shadow_instance_group_policy               |
| shadow_instance_groups                     |
| shadow_instance_id_mappings                |
| shadow_instance_info_caches                |
| shadow_instance_metadata                   |
| shadow_instance_system_metadata            |
| shadow_instance_type_extra_specs           |
| shadow_instance_type_projects              |
| shadow_instance_types                      |
| shadow_instances                           |
| shadow_key_pairs                           |
| shadow_migrate_version                     |
| shadow_migrations                          |
| shadow_networks                            |
| shadow_pci_devices                         |
| shadow_project_user_quotas                 |
| shadow_provider_fw_rules                   |
| shadow_quota_classes                       |
| shadow_quota_usages                        |
| shadow_quotas                              |
| shadow_reservations                        |
| shadow_s3_images                           |
| shadow_security_group_default_rules        |
| shadow_security_group_instance_association |
| shadow_security_group_rules                |
| shadow_security_groups                     |
| shadow_services                            |
| shadow_snapshot_id_mappings                |
| shadow_snapshots                           |
| shadow_task_log                            |
| shadow_virtual_interfaces                  |
| shadow_volume_id_mappings                  |
| shadow_volume_usage_cache                  |
| snapshot_id_mappings                       |
| snapshots                                  |
| tags                                       |
| task_log                                   |
| virtual_interfaces                         |
| volume_id_mappings                         |
| volume_usage_cache                         |
+--------------------------------------------+
110 rows in set (0.001 sec)

MariaDB [nova]> quit
Bye

# 6.检查nova用户是否存在
[root@controller ~]# openstack user list
+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 93a47b4afdc3448e876d1d2032f8fcba | admin     |
| 0b425e2bb340446387615dd5967a9695 | glance    |
| d2c660e396f34bd7a2f2d4d29b263d5c | placement |
| 2dd58fef03684eff8e182f71aeb04d23 | nova      |
+----------------------------------+-----------+

# 7.检查nova用户是否有admin权限
[root@controller ~]# openstack role list
+----------------------------------+--------+
| ID                               | Name   |
+----------------------------------+--------+
| 9ad04dbac2014659ac6f0a316fe90353 | member |
| c713dbd8ef9f4ef39faf7d669c02fda6 | user   |
| ca19b8ef64d3455f97d98b44097bfb86 | reader |
| e63ef7f4a345451fb7db49a7ca255c08 | admin  |
+----------------------------------+--------+
[root@controller ~]# openstack role assignment list
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| Role                             | User                             | Group | Project                          | Domain | System | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| e63ef7f4a345451fb7db49a7ca255c08 | 0b425e2bb340446387615dd5967a9695 |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 2dd58fef03684eff8e182f71aeb04d23 |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 93a47b4afdc3448e876d1d2032f8fcba |       | 18196711d4294cf7be4729aac1f947f2 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | d2c660e396f34bd7a2f2d4d29b263d5c |       | 011fb8f2db554f9193f95c1b6b64d4e7 |        |        | False     |
| e63ef7f4a345451fb7db49a7ca255c08 | 93a47b4afdc3448e876d1d2032f8fcba |       |                                  |        | all    | False     |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+

# 8.检查是否创建看了服务实体nova
[root@controller ~]# openstack service list
+----------------------------------+-----------+-----------+
| ID                               | Name      | Type      |
+----------------------------------+-----------+-----------+
| 2ebbc61a43904150bc00238955cf3030 | placement | placement |
| 5791882ed1124a329682a431fc800cae | keystone  | identity  |
| 608e818b4b864b639fd20def9f2e76dd | glance    | image     |
| d60e3de44f9046088cf73f585556686f | nova      | compute   |
+----------------------------------+-----------+-----------+

# 9.检查nova服务端点
[root@controller ~]# openstack endpoint list | grep nova
| 34bb893e67b44b67aa4d9524813fdec7 | RegionOne | nova         | compute      | True    | public    | http://controller:8774/v2.1 |
| 73362f005c3b464bb950181748808a34 | RegionOne | nova         | compute      | True    | internal  | http://controller:8774/v2.1 |
| 7ad44bf96c0047a7ad2bb9c0e4e7993d | RegionOne | nova         | compute      | True    | admin     | http://controller:8774/v2.1 |

# 10.nova服务是否正常运行
[root@controller ~]#  nova-status upgrade check
+--------------------------------+
| Upgrade Check Results          |
+--------------------------------+
| Check: Cells v2                |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Placement API           |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success                |
| Details: None                  |
+--------------------------------+
| Check: Cinder API              |
| Result: Success                |
| Details: None                  |
+--------------------------------+

posted on 2023-07-06 18:47  shuangmu668  阅读(251)  评论(0)    收藏  举报

导航