Refrence:
[OpenStack Orchestration In Depth]
https://developer.rackspace.com/blog/openstack-orchestration-in-depth-part-1-introduction-to-heat/
[Heat Orchestration Template]
http://docs.openstack.org/developer/heat/template_guide/hot_spec.html
[OpenStack Resource Types and Properties]
http://docs.openstack.org/developer/heat/template_guide/openstack.html
[Deploying Services in SUSE by heat]
http://www.susecon.com/doc/2014/sessions/HO5893.pdf
[HOT examples]
https://github.com/openstack/heat-templates/tree/master/hot
orchestration by openstack heat 04-resource group
资源组,组内可以包括一个或多个相同的嵌套资源 OS::Heat::ResourceGroup
root@node-6:~/heat# cat 07_resource_group.yml
root@node-6:~/heat# openstack stack create resgroup-stack -t 07_resource_group.yml --parameter image=027e7611-c85f-4097-8d66-eab63f620987
root@node-6:~/heat# openstack stack output show resgroup-stack --all
root@node-6:~/heat# openstack stack resource list resgroup-stack -n 1
update stack
这时候就面临着另一个问题,如果stack创建完成后需要调整子资源的数量,怎么实现?
调整模板中的count参数,然后用stack-update命令即可。
例如在上面模板的基础上,把count改为5,stack-update之后再查看子资源,就会发现多了一个名称为[3, 4]的子资源。
而如果把count改为2,stack-update之后,就只剩下名称为[0, 1]的子资源了。
注:子资源移除是删除名称数字较大的,保留名称数字较小的。例如上面更新子资源数量为1后,就把名称为1和2的子资源删除了,剩下名称为0的子资源。
update stack resource-group extend
root@node-6:~/heat# openstack stack update resgroup-stack -t 07_resource_group.yml --parameter image=027e7611-c85f-4097-8d66-eab63f620987 --parameter cluster_size=5
root@node-6:~/heat# openstack stack resource list resgroup-stack -n 1
update stack resource-group shrink
root@node-6:~/heat# openstack stack update resgroup-stack -t 07_resource_group.yml --parameter image=027e7611-c85f-4097-8d66-eab63f620987 --parameter cluster_size=2
root@node-6:~/heat# openstack stack resource list resgroup-stack -n 1
关于异常
Stack update的过程中,如果资源创建异常(eg: Quota exceeded for instances),stack状态:更新失败,可以重新update一个配额范围内的资源数量,stack状态自动变更正常。TODO测试rollback机制。