Add resource IDs as an attribute on ResourceGroup

Bug #1582837 reported by Jay Dobies
20
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Jay Dobies

Bug Description

The refs attribute on ResourceGroup returns a list of IDs for the created resources. But this isn't directly compatible with SoftwareDeploymentGroup which expects a map of name/ID pairs.

The current workaround is to make a template for a nested stack that outputs the ID using a get_resource call [2] and then get that value from the group's attributes[1].

This request is to add another attribute to ResourceGroup to retrieve the resource IDs as a map.

[1]
  my_deployment_group:
    type: OS::Heat::SoftwareDeploymentGroup
    properties:
      servers: { get_attr: [my_servers, attributes, server_id] }

[2]
resources:
  server:
    type: OS::Nova::Server
    properties:
      key_name: { get_param: key_name }
      image: { get_param: image }
      flavor: { get_param: flavor }

outputs:
  server_id:
    description: Nova ID of the deployed server
    value: { get_resource: server }

Tags: spec-lite
Jay Dobies (jdob)
Changed in heat:
assignee: nobody → Jay Dobies (jdob)
Revision history for this message
Steven Hardy (shardy) wrote :

So, +1 on the general idea, but a couple of requests:

1. Can we please add the same attribute to AutoScalingGroup which suffers from the same problem IIRC

2. Can we please figure out a way (e.g via map_merge or repeat) to combine the maps of ID's from multiple resource groups, such that it's possible to do this:

group1:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: count_group1}
      resource_def:
        type: OS::Nova::Server
        properties:
          key_name: { get_param: key_name }
          image: { get_param: image }
          flavor: { get_param: flavor }

group2:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: count_group2}
      resource_def:
        type: OS::Nova::Server
        properties:
          key_name: { get_param: key_name }
          image: { get_param: image }
          flavor: { get_param: flavor }

allnodes_deployment_group:
    type: OS::Heat::SoftwareDeploymentGroup
    properties:
      servers:
        <map_merge or repeat?>
        - { get_attr: [group1, $resource_id_map_attribute] }
        - { get_attr: [group2, $resource_id_map_attribute] }

Note we can't just use map_merge, because the keys will collide, so perhaps we can make repeat capable of generating maps, and iterating over each map adding a prefix related to the group name?

Revision history for this message
Jay Dobies (jdob) wrote :

Agreed on adding the first point to this request, but I'm going to file a new spec-lite for the second request. I'd like us to keep the spec-lites small and scoped to 1-2 commits, whereas these are two different features.

Revision history for this message
Jay Dobies (jdob) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/318312

Changed in heat:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/318312
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=05ea885e73ae48f2cd8110d3d121ce7ba4678d15
Submitter: Jenkins
Branch: master

commit 05ea885e73ae48f2cd8110d3d121ce7ba4678d15
Author: Jay Dobies <email address hidden>
Date: Wed May 18 15:45:25 2016 -0400

    Added refs_map attribute to resource groups

    This attribute produces a map of resource name to ID, suitable for
    passing into a SoftwareDeploymentGroup servers input.

    Change-Id: I9c9a2cd8f3f4c1fd50837c74bd49fc4dd4d06bcf
    Partial-Bug: #1582837

Revision history for this message
Jay Dobies (jdob) wrote :

I also split out the AutoScalingGroup refs request because it's non-trivial. I was hoping I'd be able to leverage the implementation in ResourceGroup, but there is code relationship between the two and AFAICT it's not a trivial solution.

The new spec-lite can be found at https://bugs.launchpad.net/heat/+bug/1585316

Revision history for this message
Thomas Herve (therve) wrote :

I closed bug #1544728 as a duplicate of this one.

Thomas Herve (therve)
Changed in heat:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.