Bug 1278537 - TemplateResource updates can destroy more than is needed
Summary: TemplateResource updates can destroy more than is needed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat
Version: 7.0 (Kilo)
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: z3
: 7.0 (Kilo)
Assignee: Zane Bitter
QA Contact: Amit Ugol
URL:
Whiteboard:
Depends On:
Blocks: 1272357
TreeView+ depends on / blocked
 
Reported: 2015-11-05 18:00 UTC by Steven Hardy
Modified: 2023-02-22 23:02 UTC (History)
13 users (show)

Fixed In Version: openstack-heat-2015.1.2-2.el7ost
Doc Type: Bug Fix
Doc Text:
On a stack update, old and new resource types were previously compared based on the type specified in the template, not the actual resolved type (taking into account the environment). Consequently, in a stack with type aliases defined in the environment, renaming one of those aliases resulted in resources of that type being replaced on update, even if the old and new aliases resolved to the same type. With this update, the actual resource plug-ins are compared for the old an new types to determine whether the types have changed between the old and new templates. As a result, users can now rename resource type aliases without replacing all of the resources that use them.
Clone Of:
Environment:
Last Closed: 2015-12-21 17:03:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1508115 0 None None None Never
OpenStack gerrit 238194 0 None None None Never
Red Hat Product Errata RHBA-2015:2680 0 normal SHIPPED_LIVE openstack-heat bug fix advisory 2015-12-21 21:51:10 UTC

Description Steven Hardy 2015-11-05 18:00:50 UTC
Description of problem:
When doing a stack-update of a heat stack containing nested stacks, it's impossible to change the type alias of the resource in the resource_registry without destroying the nested stack, even if the stack template referenced has not changed.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:

$ cat > parent.yaml << EOF
heat_template_version: 2014-10-16
 resources:
   random:
     type: My::Random
EOF

$cat > random.yaml << EOF
heat_template_version: 2014-10-16
 resources:
   the_random:
     type: OS::Heat::RandomString
EOF

$ cat > env.yaml << EOF
 resource_registry:
   My::Random: random.yaml
   My::Random2: random.yaml
EOF


$ heat stack-create r1 -f parent.yaml -e env.yaml 
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 | r1         | CREATE_IN_PROGRESS | 2015-11-05T17:56:46 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
-bash-4.3$ heat resource-list -n2 r1
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
| resource_name | physical_resource_id                           | resource_type          | resource_status | updated_time        | stack_name             |
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
| random        | 42764e30-6184-4714-ad2e-533cb6ad5f30           | My::Random             | CREATE_COMPLETE | 2015-11-05T17:56:46 | r1                     |
| the_random    | r1-random-r2oxpnrqbsoi-the_random-ljovuhzofeyv | OS::Heat::RandomString | CREATE_COMPLETE | 2015-11-05T17:56:46 | r1-random-r2oxpnrqbsoi |
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
-bash-4.3$ heat stack-list -n 
+--------------------------------------+------------------------+-----------------+---------------------+--------------+--------------------------------------+
| id                                   | stack_name             | stack_status    | creation_time       | updated_time | parent                               |
+--------------------------------------+------------------------+-----------------+---------------------+--------------+--------------------------------------+
| 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 | r1                     | CREATE_COMPLETE | 2015-11-05T17:56:46 | None         | None                                 |
| 42764e30-6184-4714-ad2e-533cb6ad5f30 | r1-random-r2oxpnrqbsoi | CREATE_COMPLETE | 2015-11-05T17:56:46 | None         | 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 |

Actual results:
If you update the type in parent.yaml to My::Random2, the nested stack is replaced, despite pointing to the same template:

$ sed -i "s/My::Random/My::Random2/" parent.yaml 
-bash-4.3$ heat stack-update r1 -f parent.yaml -e env.yaml 
+--------------------------------------+------------+-----------------+---------------------+--------------+
| id                                   | stack_name | stack_status    | creation_time       | updated_time |
+--------------------------------------+------------+-----------------+---------------------+--------------+
| 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 | r1         | CREATE_COMPLETE | 2015-11-05T17:56:46 | None         |
+--------------------------------------+------------+-----------------+---------------------+--------------+
-bash-4.3$ heat stack-list
+--------------------------------------+------------+-----------------+---------------------+---------------------+
| id                                   | stack_name | stack_status    | creation_time       | updated_time        |
+--------------------------------------+------------+-----------------+---------------------+---------------------+
| 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 | r1         | UPDATE_COMPLETE | 2015-11-05T17:56:46 | 2015-11-05T17:59:31 |
+--------------------------------------+------------+-----------------+---------------------+---------------------+
-bash-4.3$ heat resource-list -n2 r1
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
| resource_name | physical_resource_id                           | resource_type          | resource_status | updated_time        | stack_name             |
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
| random        | 15a9503b-5d36-4e74-b118-ee285f601d2d           | My::Random2            | CREATE_COMPLETE | 2015-11-05T17:59:31 | r1                     |
| the_random    | r1-random-qvndtjvasurz-the_random-3hjbwb7myxyz | OS::Heat::RandomString | CREATE_COMPLETE | 2015-11-05T17:59:31 | r1-random-qvndtjvasurz |
+---------------+------------------------------------------------+------------------------+-----------------+---------------------+------------------------+
-bash-4.3$ heat stack-list -n 
+--------------------------------------+------------------------+-----------------+---------------------+---------------------+--------------------------------------+
| id                                   | stack_name             | stack_status    | creation_time       | updated_time        | parent                               |
+--------------------------------------+------------------------+-----------------+---------------------+---------------------+--------------------------------------+
| 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 | r1                     | UPDATE_COMPLETE | 2015-11-05T17:56:46 | 2015-11-05T17:59:31 | None                                 |
| 15a9503b-5d36-4e74-b118-ee285f601d2d | r1-random-qvndtjvasurz | CREATE_COMPLETE | 2015-11-05T17:59:31 | None                | 0076e20e-3f2b-486f-a9c4-a7e81b18c1c7 |


Expected results:
the nested stack and nested the_random resource should be unmodified, not replaced as above.

Additional info:

Comment 2 James Slagle 2015-11-09 21:34:24 UTC
can we get this backported for z3?

Comment 3 Zane Bitter 2015-11-10 01:11:36 UTC
We don't have an upstream patch yet, but when we do I'd expect to backport it.

Comment 4 Zane Bitter 2015-11-16 17:50:02 UTC
The upstream patch is now ready to go I think.

Comment 6 Amit Ugol 2015-12-14 14:29:09 UTC
works better now. mind the syntax in the example on comment 0

Comment 8 errata-xmlrpc 2015-12-21 17:03:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2015:2680


Note You need to log in before you can comment on or make changes to this bug.