OpenStack's placement service (Placement)

1. Basic concept of placement service

The cloud host (virtual machine) in the cloud computing platform does not appear out of thin air, it is divided from the existing hardware resources in the cloud. Each creation of a cloud host will use a part of the physical host resources, such as CPU, disk, memory, etc. Therefore, before creating a cloud host, the OpenStack cloud computing platform needs to know which computers in all computer clusters in the cloud have enough hardware resources to create a cloud host, and then make a judgment on which computer to choose. Generate this cloud host. Placement is a component that monitors the usage of all hardware resources in the cloud. Before the Stein version of OpenStack appeared, the monitoring of system resources and the selection of cloud host resources were independently completed by the computing component Nova. Starting from OpenStack (Stein version), the monitoring function of system resources is separated from Nova and becomes an independent component called Placement.

Two, Placement components

The main component of Placement is its interface module (Placement-API), which monitors system resource information. The cooperative relationship between Placement and Nova is roughly like this: Nova's computing module (Nova-Compute) submits the hardware requirements of the cloud host to be created to Placement-API; after receiving the requirements, Placement-API inquires from the system resource library Existing resources meet the information of all computers that create cloud hosts, and then return the results to Nova's planning module (Nova-Scheduler); Nova-Scheduler selects one of the computers based on the obtained information and tells Nova-Compute the result.image.png

3. Placement workflow

image.png

  • Step 1: Nova tells Placement what resources and how many resources the cloud hosts to create need.
  • Step 2, Placement queries the database to obtain two data. The first data is the physical hosts with sufficient free resources to create cloud hosts and their remaining resource information. The second data is the original resource information of these physical hosts. .
  • In step 3, the database returns the queried data for Placement.
  • Step 4, Placement informs Nova of the two data obtained.
  • In step 5, Nova uses these two data to select the physical host to create the cloud host through an algorithm, and informs Placement of the selection result.
  • Step 6: Placement modifies the database and deducts the corresponding resources from the resources of the physical host.

4. Placement project implementation

**1. Install and configure Placement**

Install the Placement package

yum -y install openstack-placement-api

view user information

cat /etc/passwd | grep placement

View user group information

cat /etc/group | grep placement

Create a Placement database and authorize it

#登录数据库
mysql -uroot -p123456

#创建placement数据库
CREATE DATABASE placement;

#placement数据库进行授权
GRANT ALL PRIVILEGES ON placement.* TO placement@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON placement.* TO placement@'%' IDENTIFIED BY '123456';

Modify the Placement configuration file

#备份
cp /etc/placement/placement.conf /etc/placement/placement.bak

#去掉所有注释和空行,生成新的配置文件。
grep -Ev '^$|#' /etc/placement/placement.bak > /etc/placement/placement.conf

Edit the new configuration file

vi /etc/placement/placement.conf

#修改“[placement_database]”部分,实现与数据库连接。
connection = mysql+pymysql://placement:123456@controller/placement

#修改“[api]”与“[keystone_authtoken]”部分,实现与Keystone交互。
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = project
username = placement
password = 123456

Modify the Apache configuration file

vi /etc/httpd/conf.d/00-placement-api.conf

#在“VirtualHost”节点中加入以下代码使Httpd对“/usr/bin”目录拥有权限。
<Directory /usr/bin>
Require all granted
</Directory>

Initialize the Placement database

su placement -s /bin/sh -c "placement-manage db sync"
2. Placement component initialization

Import environment variables to simulate login.

admin-login

Create user "placement" in the OpenStack cloud computing platform.

openstack user create --domain default --password 123456 placement

Assign the "admin" role to the user "placement"

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

Create Placement service and endpoint

#创建服务
openstack service create --name placement placement

#创建放置服务端点
#公共服务节点
openstack endpoint create --region RegionOne placement public
http://controller:8778

#内部组件访问的服务端点
openstack endpoint create --region RegionOne placement internal http://controller:8778

#Admin用户访问端点。
openstack endpoint create --region RegionOne placement admin http://controller:8778

Start the Placement service

systemctl restart httpd

View port usage

netstat -tnlup|grep 8778

Verify service endpoint

curl http://controller:8778

Guess you like

Origin blog.csdn.net/xiaoyu070321/article/details/131380445