cheng029 发表于 2015-7-9 14:07:46

编排服务Heat

注意需要安装在物理controller上,与云主机无关。

6、编排服务Heat
注意:需要将编排服务安装在物理controller上,安装在云主机上没有意义。
注意:本文档是按照5月12日测试题目要求编写的,需要先完成任务一、二,存在glance image:centos、以及net-flat网络。

(1)配置Heat
yum install openstack-heat-api openstack-heat-engine openstack-heat-api-cfn

openstack-config --set /etc/heat/heat.conf database connection mysql://heat:000000@controller/heat

mysql -u root -p
CREATE DATABASE heat;
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY '000000';
exit

su -s /bin/sh -c "heat-manage db_sync" heat

openstack-config --set /etc/heat/heat.conf DEFAULT qpid_hostname controller

. admin-openrc.sh
keystone user-create --name=heat --pass=000000 --email=heat@localhost
keystone user-role-add --user=heat --tenant=service --role=admin

openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_uri http://controller:5000/v2.0
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/heat/heat.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/heat/heat.conf keystone_authtoken admin_user heat
openstack-config --set /etc/heat/heat.conf keystone_authtoken admin_password 000000
openstack-config --set /etc/heat/heat.conf ec2authtoken auth_uri http://controller:5000/v2.0

keystone service-create --name=heat --type=orchestration --description="Orchestration"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ orchestration / {print $2}') \
--publicurl=http://controller:8004/v1/%\(tenant_id\)s \
--internalurl=http://controller:8004/v1/%\(tenant_id\)s \
--adminurl=http://controller:8004/v1/%\(tenant_id\)s

keystone service-create --name=heat-cfn --type=cloudformation --description="Orchestration CloudFormation"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ cloudformation / {print $2}') \
--publicurl=http://controller:8000/v1 \
--internalurl=http://controller:8000/v1 \
--adminurl=http://controller:8000/v1

keystone role-create --name heat_stack_user

(注:192.168.100.10为物理controller的管理网络IP地址)
openstack-config --set /etc/heat/heat.conf DEFAULT heat_metadata_server_url http://192.168.100.10:8000
openstack-config --set /etc/heat/heat.conf DEFAULT heat_waitcondition_server_url http://192.168.100.10:8000/v1/waitcondition

service openstack-heat-api start
service openstack-heat-api-cfn start
service openstack-heat-engine start
chkconfig openstack-heat-api on
chkconfig openstack-heat-api-cfn on
chkconfig openstack-heat-engine on

(2)测试Heat

<1>查询stack 列表的信息
. admin-openrc.sh
# heat stack-list
+----+------------+--------------+---------------+
| id | stack_name | stack_status | creation_time |
+----+------------+--------------+---------------+
+----+------------+--------------+---------------+

<2>使用提供的文件test-stack.yml创建heat stack,其中glance镜像使用centos,网络使用net-flat。
注意:本文档是按照5月12日测试题目要求编写的,需要先完成任务一、二,存在glance image:centos、以及net-flat网络。

将test-stack.yml通过SFTP传到云主机
# NET_ID=$(nova net-list | awk '/ net-flat / { print $2 }')
# heat stack-create -f test-stack.yml -P "ImageID=centos;NetID=$NET_ID" heatstack
+--------------------------------------+------------+--------------------+----------------------+
| id                                 | stack_name | stack_status       | creation_time      |
+--------------------------------------+------------+--------------------+----------------------+
| 527915a1-af98-4419-a3f3-2dd7140a0643 | heatstack| CREATE_IN_PROGRESS | 2015-05-14T03:56:37Z |
+--------------------------------------+------------+--------------------+----------------------+

提交查询stack列表信息:
# heat stack-list
+--------------------------------------+------------+-----------------+----------------------+
| id                                 | stack_name | stack_status    | creation_time      |
+--------------------------------------+------------+-----------------+----------------------+
| 527915a1-af98-4419-a3f3-2dd7140a0643 | heatstack| CREATE_COMPLETE | 2015-05-14T03:56:37Z |
+--------------------------------------+------------+-----------------+----------------------+

<3>删除编排服务自动创建的云主机
注意:以上操作会自动创建云主机
# nova list
+--------------------------------------+------------------+--------+------------+-------------+--------------------------+
| ID                                 | Name             | Status | Task State | Power State | Networks               |
+--------------------------------------+------------------+--------+------------+-------------+--------------------------+
| c9e15922-63bd-4568-9b89-575a3f0c66dc | Test Heat server | ACTIVE | -          | Running   | net-flat=192.168.200.102 |
+--------------------------------------+------------------+--------+------------+-------------+--------------------------+

重要:在继续配置PaaS之前,需要将Heat自动创建的云主机终止,否则计算节点内存不够用:
# nova delete c9e15922-63bd-4568-9b89-575a3f0c66dc
c9e15922-63bd-4568-9b89-575a3f0c66dc为nova list所显示的云主机ID。
页: [1]
查看完整版本: 编排服务Heat