OpenStack Wallaby 部署4 安置服务 Placement

👌 2021-05-08 OpenStack Wallaby 部署4 安置服务-placement

FileInfo Filename - OpenStack Wallaby 部署简介 Version - v1.0.2105(2021/05/08 ~ 2021/05/10) Author - standuke Email - shadowdoker@gmail.com DescriptionKey - Placement installation of OpenStack Wallaby deployment

版本修订记录:

v1.0.2105:2021-05-08:建立 OpenStack Wallaby 部署4 安置服务-placement,修订人:standuke

[TOC]

MariaDB 创建用户

  1. 创建数据库
CREATE DATABASE placement;
  1. 授予权限

PLACEMENT_DBPASS = PLACEMENT

GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
 IDENTIFIED BY 'PLACEMENT_DBPASS';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
 IDENTIFIED BY 'PLACEMENT_DBPASS';
 flush privileges;

keystone 创建相关信息

生效管理员用户

. admin-openrc

创建用户、服务

  1. 创建 placement 用户
openstack user create --domain default --password-prompt placement

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | c5a59f718c1e41e4a38add5cce840372 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
  1. 赋予 placement 用户到 service 项目中的 admin 角色

此处的 service 项目已经在 keystone 的 2. 创建服务「Service」 步骤完成了,所以只需要赋予角色即可

openstack role add --project service --user placement admin

该命令不提供任何输出。
  1. 创建 glance 服务实体
openstack service create --name placement --description "Placement API" placement

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | afa22a1b206d44a79234c535e82d1bb3 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

创建服务 endpoint

openstack endpoint create --region RegionOne placement public http://controller:8778

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | d5488a2138bf4692aa0b672801b4c612 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | afa22a1b206d44a79234c535e82d1bb3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+

openstack endpoint create --region RegionOne placement internal http://controller:8778

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0c06139bed0544709a08347df76d2153 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | afa22a1b206d44a79234c535e82d1bb3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+

openstack endpoint create --region RegionOne placement admin http://controller:8778

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 9f2649d5d3544b52a6ccc7256c29dbb6 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | afa22a1b206d44a79234c535e82d1bb3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+

部署 palcement

安装软件包

apt install placement-api

修改配置文件

  1. 编辑 /etc/placement/placement.conf 文件并完成以下操作

PLACEMENT_PASS = PLACEMENT_DBPASS => PLACEMENT

vim /etc/placement/placement.conf

[placement_database]
# ...
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement

[api]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS
  1. 初始化 placement 数据库
su -s /bin/sh -c "placement-manage db sync" placement

重启 http

systemctl restart apache2.service

截至目前 apache2 服务状态如下

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-05-08 14:58:53 CST; 9s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 19552 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 19565 (apache2)
      Tasks: 95 (limit: 308840)
     Memory: 54.3M
     CGroup: /system.slice/apache2.service
             ├─19565 /usr/sbin/apache2 -k start
             ├─19566 (wsgi:keystone-pu -k start
             ├─19567 (wsgi:keystone-pu -k start
             ├─19568 (wsgi:keystone-pu -k start
             ├─19569 (wsgi:keystone-pu -k start
             ├─19570 (wsgi:keystone-pu -k start
             ├─19571 (wsgi:placement-a -k start
             ├─19572 (wsgi:placement-a -k start
             ├─19573 (wsgi:placement-a -k start
             ├─19574 (wsgi:placement-a -k start
             ├─19575 (wsgi:placement-a -k start
             ├─19576 /usr/sbin/apache2 -k start
             └─19577 /usr/sbin/apache2 -k start

里程碑

生效管理员用户

. admin-openrc

查看状态

placement-status upgrade check

apt install python3-pip
pip3 install osc-placement

root@node1:~# openstack --os-placement-api-version 1.2 resource class list --sort-column name
+----------------------------+
| name                       |
+----------------------------+
| DISK_GB                    |
| FPGA                       |
| IPV4_ADDRESS               |
| MEMORY_MB                  |
| MEM_ENCRYPTION_CONTEXT     |
| NET_BW_EGR_KILOBIT_PER_SEC |
| NET_BW_IGR_KILOBIT_PER_SEC |
| NUMA_CORE                  |
| NUMA_MEMORY_MB             |
| NUMA_SOCKET                |
| NUMA_THREAD                |
| PCI_DEVICE                 |
| PCPU                       |
| PGPU                       |
| SRIOV_NET_VF               |
| VCPU                       |
| VGPU                       |
| VGPU_DISPLAY_HEAD          |
+----------------------------+