Ask Your Question
2

create a bootable volume from an image and launch an instance from this volume

asked 2019-07-16 11:13:43 -0500

snowmoon gravatar image

Hello , We are trying to create a heat script to create an instance with cinder volume as root disk from an image. From dashboard am able to create it without any issues (It will take ~3 mins to create an instance of 150GB).I want to achieve the same using heat script (Boot from image (create new volume)) Step:

select boot source image + create New volume + Delete Volume on instance deletion

I have tried multiple option to create heat script but no luck . Below is the heat script which i used to create the instance . Its taking long time to create the volume itself and later its throws error.

resources:
   node:
     type: OS::Nova::Server
     properties:
       name: test
       block_device_mapping: [{ device_name: "vda", volume_id : { get_resource: volume_root }, delete_on_termination : "false"}]
       flavor: c08_r32_d140
       key_name: cro-key
       availability_zone: zone-2
       security_groups:
       - default
       networks:
       - network: A494_Provider
       - network: P02-Private_Network
   volume_root:
      type: OS::Cinder::Volume
      properties:
           image: RHEL7U6_Build2.09.qcow2
           size: 150
   volume_attachment:
      type: OS::Cinder::VolumeAttachment
      properties:
        volume_id: { get_resource: volume_root }
        instance_uuid: { get_resource: node }

outputs:
  instance_name:
    description: Name of the instance.
    value: { get_attr: [ node, name ] }
  instance_ip:
    description: IP address of the instance.
    value: { get_attr: [ node, first_address ] }
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-07-17 10:25:20 -0500

zaneb gravatar image

updated 2019-07-17 10:25:32 -0500

You don't need both a block_device_mapping property and an OS::Cinder::VolumeAttachment resource. Pick one.

edit flag offensive delete link more

Comments

1

Thank you ! It worked and the volume created in seconds :)

snowmoon gravatar imagesnowmoon ( 2019-07-18 10:30:41 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2019-07-16 11:09:15 -0500

Seen: 33 times

Last updated: Jul 17