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            |
......

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM