构建基于openEuler2209的OpenStack云平台(四)

上一篇:构建基于openEuler2209的OpenStack云平台(三)

4 安装和配置Placement服务

OpenStack服务(特别是nova)需要Placement服务,因此它应该在nova服务之前安装,但在Identity(keystone)之后安装。

Placement 服务是一个RESTAPI堆栈和数据模型,用于跟踪资源提供程序库存和使用情况,以及不同类别的资源。例如,资源提供程序可以是计算节点、共享存储池或IP分配池。Placement 服务跟踪每个提供者的库存和使用情况。

4.1 先决条件

4.1.1 创建placement 数据库

[root@xgk-ctl ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.5.16-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 placement;
Query OK, 1 row affected (0.000 sec)

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

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

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> exit;
Bye

4.1.2 加载admin-openrc文件获取管理员凭证

[root@xgk-ctl ~]# source /etc/keystone/admin-openrc 

4.1.3 创建Placement服务用户

[root@xgk-ctl ~]# openstack user create --domain default --password-prompt placement
User Password:#此处设置placement用户的密码,比如PLACEMENT_PASS
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 060095f767d04775a3c99c0289130940 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

4.1.4 将Placement用户添加到具有管理员角色的服务项目

[root@xgk-ctl ~]# openstack role add --project service --user placement admin

4.1.5 在服务目录中创建Placement API条目

[root@xgk-ctl ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 1fc2ffd99a7247079c4d67f93442ba70 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

4.1.6 创建Placement API服务端点

1、创建public端点

[root@xgk-ctl ~]# openstack endpoint create --region RegionOne placement public http://xgk-ctl:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 10ea5d1a937a4937a86cd50310c4055e |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1fc2ffd99a7247079c4d67f93442ba70 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://xgk-ctl:8778              |
+--------------+----------------------------------+

2、创建internal端点

[root@xgk-ctl ~]# openstack endpoint create --region RegionOne placement internal http://xgk-ctl:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 65c3357f16e242a3a891640371a20c63 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1fc2ffd99a7247079c4d67f93442ba70 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://xgk-ctl:8778              |
+--------------+----------------------------------+

3、创建admin端点

[root@xgk-ctl ~]# openstack endpoint create --region RegionOne placement admin http://xgk-ctl:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 54908616f012401daca1de63bf2d7e2f |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1fc2ffd99a7247079c4d67f93442ba70 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://xgk-ctl:8778              |
+--------------+----------------------------------+

4.2 安装和配置组件

4.2.1 安装软件包

[root@xgk-ctl ~]# dnf -y install openstack-placement-api

4.2.2 编辑/etc/placement/placement.conf文件

[root@xgk-ctl ~]# cp -a /etc/placement/placement.conf{,.bak}
[root@xgk-ctl ~]# grep -Ev '^$|#' /etc/placement/placement.conf.bak > /etc/placement/placement.conf
[root@xgk-ctl ~]# vim /etc/placement/placement.conf
[DEFAULT]
[api]
auth_strategy = keystone
[cors]
[keystone_authtoken]
auth_url = http://xgk-ctl:5000/v3
memcached_servers = xgk-ctl:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS
[oslo_middleware]
[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@xgk-ctl/placement
[profiler]

4.2.3 初始化placement数据库

如下所示,会有一个警告,可以无视。

[root@xgk-ctl ~]# su -s /bin/sh -c "placement-manage db sync" placement
/usr/lib/python3.10/site-packages/pymysql/cursors.py:170: Warning: (1280, "Name 'alembic_version_pkc' ignored for PRIMARY key.")
  result = self._query(query)

4.2.4 重启httpd服务,完成安装

[root@xgk-ctl ~]# systemctl restart httpd

4.2.5 验证

[root@xgk-ctl ~]# source /etc/keystone/admin-openrc
[root@xgk-ctl ~]# placement-status upgrade check
+----------------------------------------------------------------------+
| Upgrade Check Results                                                |
+----------------------------------------------------------------------+
| Check: Missing Root Provider IDs                                     |
| Result: Success                                                      |
| Details: None                                                        |
+----------------------------------------------------------------------+
| Check: Incomplete Consumers                                          |
| Result: Success                                                      |
| Details: None                                                        |
+----------------------------------------------------------------------+
| Check: Policy File JSON to YAML Migration                            |
| Result: Failure                                                      |
| Details: Your policy file is JSON-formatted which is deprecated. You |
|   need to switch to YAML-formatted file. Use the                     |
|   ``oslopolicy-convert-json-to-yaml`` tool to convert the            |
|   existing JSON-formatted files to YAML in a backwards-              |
|   compatible manner: https://docs.openstack.org/oslo.policy/         |
|   latest/cli/oslopolicy-convert-json-to-yaml.html.                   |
+----------------------------------------------------------------------+

  执行以下命令安装osc-placement并列出可用的资源类型和功能

[root@xgk-ctl ~]# dnf -y install python3-osc-placement
[root@xgk-ctl ~]# openstack --os-placement-api-version 1.2 resource class list --sort-column name
[root@xgk-ctl ~]# openstack --os-placement-api-version 1.6 trait list --sort-column name

下一篇:构建基于openEuler2209的OpenStack云平台(五)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值