[openstack-dev] [Heat] referencing the index of a ResourceGroup
Jason Greathouse
jason.greathouse at leankit.com
Wed Sep 10 21:44:01 UTC 2014
I'm trying to find a way to create a set of servers and attach a new volume
to each server.
I first tried to use block_device_mapping but that requires an existing
snapshot or volume and the deployment would fail when Rackspace
intermittently timed out trying to create the new volume from a snapshot.
I'm now trying with 3 ResourceGroups: OS::Cinder::Volume to build volumes
followed by OS::Nova::Server and then trying to attach the volumes
with OS::Cinder::VolumeAttachment.
This works when I do a single server and volume if I reference the
VolumeAttachment properties like this:
volume_id: { get_attr: [group_volumes, refs, 0] }
Is there a way to add the index reference to the property when using
get_attr? Something like this:
volume_id: { get_attr: [group_volumes, refs, %index%] }
Here is my template for reference:
heat_template_version: 2013-05-23
resources:
group_volumes:
type: "OS::Heat::ResourceGroup"
properties:
count: 1
resource_def:
type: "OS::Cinder::Volume"
properties:
size: 150
description: stack-test-vol-%index%
name: stack-test-vol-%index%
volume_type: SATA
group_servers:
type: "OS::Heat::ResourceGroup"
properties:
count: 1
resource_def:
type: "OS::Nova::Server"
properties:
key_name: root-20140819
flavor: performance1-2
image: 255df5fb-e3d4-45a3-9a07-c976debf7c14
name: heat-test-withdisk-%index%
networks:
- uuid: 00000000-0000-0000-0000-000000000000
- uuid: 11111111-1111-1111-1111-111111111111
user_data: |
{"role":"build", "env":"test"}
user_data_format: RAW
config_drive: true
attach_volumes:
type: "OS::Heat::ResourceGroup"
properties:
count: 1
resource_def:
type: "OS::Cinder::VolumeAttachment"
properties:
instance_uuid: { get_attr: [group_servers, refs, 0] }
mountpoint: /dev/xvdg
volume_id: { get_attr: [group_volumes, refs, 0] }
#properties:
# instance_uuid: { get_attr: [group_servers, refs,
"%index%"] } #This doesn't work
# mountpoint: /dev/xvdg
# volume_id: { get_attr: [group_volumes, refs,
"%index%"] }
--
*Jason Greathouse*
Sr. Systems Engineer
*[image: LeanKitlogo] <https://leankit.com/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140910/0559600b/attachment.html>
More information about the OpenStack-dev
mailing list