placement服務提供一個HTTP API,用於跟蹤資源提供者清單和使用狀況。placement做爲數據模型上的web服務進行操做。安裝包括建立必要的數據庫以及安裝和配置web服務。這是一個簡單的過程,可是要將placement與OpenStack雲的其他部分集成起來,有至關多的步驟。
其餘一些OpenStack服務(尤爲是nova)須要安裝placement,所以應該在其餘服務以前安裝placement,而在Identity (keystone)以後安裝placement。mysql
安裝配置placement服務以前,建庫等。web
創建數據庫sql
1. 完成下列建庫操做: ○ 使用root用戶登陸: $ mysql -u root -p root123 ○ 創建placement database: MariaDB [(none)]> CREATE DATABASE placement; ○ Grant proper access to the database: MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement123'; 2. Configure User and Endpoints 1. Source the admin credentials to gain access to admin-only CLI commands: $ . admin-openrc 2. Create a Placement service user using your chosen PLACEMENT_PASS: $ openstack user create --domain default --password-prompt placement User Password:placement123 Repeat User Password:placement123 +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | fa742015a6494a949f67629884fc7ec8 | | name | placement | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ 3. Add the Placement user to the service project with the admin role: $ openstack role add --project service --user placement admin 4. Create the Placement API entry in the service catalog: $ openstack service create --name placement \ --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Placement API | | enabled | True | | id | 2d1a27022e6e4185b86adac4444c495f | | name | placement | | type | placement | +-------------+----------------------------------+ 5. Create the Placement API service endpoints: 注意:域名爲你規劃好url, 必須可以解析. $ openstack endpoint create --region RegionOne placement public http://stack.flex.net:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 2b1b2637908b4137a9c2e0470487cbc0 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 2d1a27022e6e4185b86adac4444c495f | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ $ openstack endpoint create --region RegionOne placement internal http://stack.flex.net:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 02bcda9a150a4bd7993ff4879df971ab | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 2d1a27022e6e4185b86adac4444c495f | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ $ openstack endpoint create --region RegionOne placement admin http://stack.flex.net:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 3d71177b9e0f406f98cbff198d74b182 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 2d1a27022e6e4185b86adac4444c495f | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+
# yum install openstack-placement-api
Edit the /etc/placement/placement.conf file and complete the following actions:數據庫
○ In the [placement_database] section, configure database access: [placement_database] # ... connection = mysql+pymysql://placement:placement123@dbs.flex.net/placement ○ In the [api] and [keystone_authtoken] sections, configure Identity service access: [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_url = http://stack.flex.net:5000/v3 memcached_servers = dbs.flex.net:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = placement password = placement123 注意: 註釋或移除在掉在[keystone_authtoken]區域中的其它的選項
# su -s /bin/sh -c "placement-manage db sync" placement
○ Restart the httpd service: # systemctl restart httpd
你須要admin的權限驗證api
$ . admin-openrc
$ placement-status upgrade check +----------------------------------+ | Upgrade Check Results | +----------------------------------+ | Check: Missing Root Provider IDs | | Result: Success | | Details: None | +----------------------------------+ | Check: Incomplete Consumers | | Result: Success | | Details: None | +----------------------------------+
運行對placement API的命令(這個步驟我沒有成功,但不影響):dom
○ Install the osc-placement plugin: $ pip install osc-placement ○ List available resource classes and traits: $ openstack --os-placement-api-version 1.2 resource class list --sort-column name +----------------------------+ | name | +----------------------------+ | DISK_GB | | IPV4_ADDRESS | | ... | $ openstack --os-placement-api-version 1.6 trait list --sort-column name +---------------------------------------+ | name | +---------------------------------------+ | COMPUTE_DEVICE_TAGGING | | COMPUTE_NET_ATTACH_INTERFACE | | ... |