# 建立数据库用户及权限
create database placement;
grant all privileges on placement.* to placement@'localhost' identified by 'Abc@123';
grant all privileges on placement.* to placement@'%' identified by 'Abc@123';
flush privileges;
# 建立用户、角色、服务、项目、域、端点
source ~/.openstack_admin
openstack user create --domain default --project service --password Abc@123 placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "OpenStack Placement Service" placement
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
# 安装程序包
yum install -y openstack-placement-api python-osc-placement
# 变更配置文件
cd /etc/placement
mv placement.conf placement.conf.org
cat > /etc/placement/placement.conf << EOF
[DEFAULT]
debug = false
[placement_database]
connection = mysql+pymysql://placement:Abc@123@controller/placement
[api]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
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 = Abc@123
EOF
chmod 640 /etc/placement/placement.conf
chown root:placement /etc/placement/placement.conf
/etc/httpd/conf.d/00-placement-api.conf
<VirtualHost *:8778>
… 增加执行权限
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
…
</VirtualHost>
# 同步数据库
su -s /bin/bash -c "placement-manage db sync" placement
# 重启服务
systemctl restart httpd
# 验证
placement-status upgrade check
openstack --os-placement-api-version 1.2 resource class list --sort-column name
openstack --os-placement-api-version 1.6 trait list --sort-column name