OpenStack学习系列之四:安装部署placement

Placement服务跟踪资源(比如计算节点,存储资源池,网络资源池等)的使用情况,提供自定义资源的能力,为分配资源提供服务。
Placement在openstack的Stein版本之前,属于Nova组件的一部分。该组件应该在Nova之前安装。
Placement API作为一个标准的WSGI脚本,为WSGI服务器提供了模块级的应用程序属性。
一个资源提供者可以是一个计算节点,共享存储池,或一个IP分配池。placement服务跟踪每个供应商的库存和使用情况。例如,在一个计算节点创建一个实例的可消费资源如计算节点的资源提供者的CPU和内存,磁盘从外部共享存储池资源提供商和IP地址从外部IP资源提供者。
 

安装placement(控制节点,node1)

---------------------------------------------#初始化数据库,placement连接mysql用户密码placement/placement
mysql -uroot -pmysql << EOF
CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
  IDENTIFIED BY 'placement';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
  IDENTIFIED BY 'placement';
EOF
---------------------------------------------#创建用户,node1执行
[root@node1 ~]# . admin-openrc
[root@node1 ~]# openstack user create --domain default --password-prompt placement # 输入placement密码placement
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 3d56ecd0dfd44276a81578af8a933535 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+  
[root@node1 ~]# openstack role add --project service --user placement admin
[root@node1 ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 8918426db3ee487796b53ef1af8ebb6a |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+
[root@node1 ~]# openstack endpoint create --region RegionOne placement public http://node1:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 07a475fc34904b6abf935f7e33c2995e |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8918426db3ee487796b53ef1af8ebb6a |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://node1:8778                |
+--------------+----------------------------------+
[root@node1 ~]# openstack endpoint create --region RegionOne placement internal http://node1:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 21a1fe3aa0484611b9a6baaa04d12753 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8918426db3ee487796b53ef1af8ebb6a |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://node1:8778                |
+--------------+----------------------------------+
[root@node1 ~]# openstack endpoint create --region RegionOne placement admin http://node1:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b06633f437544a1e9bcc88093715a254 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8918426db3ee487796b53ef1af8ebb6a |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://node1:8778                |
+--------------+----------------------------------+

---------------------------------------------#安装配置组件
yum -y install openstack-placement-api
crudini --set /etc/placement/placement.conf placement_database connection mysql+pymysql://placement:placement@node1/placement
crudini --set /etc/placement/placement.conf api auth_strategy keystone
crudini --set /etc/placement/placement.conf keystone_authtoken auth_url http://node1:5000/v3
crudini --set /etc/placement/placement.conf keystone_authtoken memcached_servers node1:11211
crudini --set /etc/placement/placement.conf keystone_authtoken auth_type password
crudini --set /etc/placement/placement.conf keystone_authtoken project_domain_name Default
crudini --set /etc/placement/placement.conf keystone_authtoken user_domain_name Default
crudini --set /etc/placement/placement.conf keystone_authtoken project_name service
crudini --set /etc/placement/placement.conf keystone_authtoken username placement
crudini --set /etc/placement/placement.conf keystone_authtoken password placement
---------------------------------------------#初始化数据
/bin/sh -c "placement-manage db sync" placement
---------------------------------------------#启动服务
systemctl restart httpd
---------------------------------------------#验证,node1执行
 . admin-openrc
[root@node1 ~]#  placement-status upgrade check
+----------------------------------+
| Upgrade Check Results            |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
| Check: Incomplete Consumers      |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
 ---------------------------------------------#安装api接口,node1执行
 pip3 install osc-placement
 # 解决问题  placement Expecting value: line 1 column 1 (char 0)
 echo '<Files "placement-api">
     Require all granted
</Files>' >> /etc/httpd/conf.d/00-placement-api.conf
systemctl restart httpd

[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          |
+----------------------------+

[root@node1 ~]#  openstack --os-placement-api-version 1.6 trait list --sort-column name
+---------------------------------------+
| name                                  |
+---------------------------------------+
| COMPUTE_ACCELERATORS                  |
| COMPUTE_DEVICE_TAGGING                |
| COMPUTE_GRAPHICS_MODEL_CIRRUS         |
| COMPUTE_GRAPHICS_MODEL_GOP            |
......

 

posted @ 2022-03-02 15:27  喝杯茶  阅读(1125)  评论(1编辑  收藏  举报