Monday, October 9, 2017

OpenStack Heat Stack to create a Glance Image Ocata

OpenStack Heat Stack to create a Glance Image



# create a txt YAML file as glanceimagecentos.yml

echo '---
# for Ocata release of OpenStack
#
# Please note the heat_template_version specified is for OpenStack Ocata
heat_template_version: 2017-02-24

description: glance image

resources:
  glancecentos64bitimage:
    type: OS::Glance::Image
    properties:
      name: centos7_64_qcow2
      is_public: true
      container_format: bare
      disk_format: qcow2
      location: http://webserver.netx.sujit.com/images//CentOS-7-x86_64-GenericCloud-1705.qcow2

outputs:
  glancecentos64bitimage_info:
    value: { get_attr: [ glancecentos64bitimage ] }' > glanceimagecentos.yml
    
    
    
# run the stack 

openstack stack create -t glanceimagecentos.yml centos_glance_image



[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack stack create -t glanceimagecentos.yml centosglanceimage
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 298ef3d6-808f-44ed-a515-e1f76758a560 |
| stack_name          | centosglanceimage                    |
| description         | glance image                         |
| creation_time       | 2017-10-09T08:45:33Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#

# Confirm the stack creation completes 

[root@controllero HeatOrchestrationTemplates(keystone_admin)]# openstack stack list | grep centosglanceimage
| 298ef3d6-808f-44ed-a515-e1f76758a560 | centosglanceimage | CREATE_COMPLETE | 2017-10-09T08:45:33Z | None         |
[root@controllero HeatOrchestrationTemplates(keystone_admin)]#



# As the stack creation completes, the glance image is formed

# See the glance image has been created 


the CentOS image gets created.



[root@controllero HeatOrchestrationTemplates(keystone_admin)]# glance image-list
+--------------------------------------+------------------+
| ID                                   | Name             |
+--------------------------------------+------------------+
| 38989da6-900a-48cc-bf74-519599f2e284 | centos7_64_qcow2 |
| d66b73e7-cb0c-42c5-bf73-d5bbdf245da5 | cirros           |
+--------------------------------------+------------------+

[root@controllero HeatOrchestrationTemplates(keystone_admin)]#

No comments:

Post a Comment