Bug 1278537 - TemplateResource updates can destroy more than is needed
TemplateResource updates can destroy more than is needed
Status: CLOSED ERRATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat (Show other bugs)
7.0 (Kilo)
Unspecified Unspecified
high Severity unspecified
: z3
: 7.0 (Kilo)
Assigned To: Zane Bitter
Amit Ugol
: ZStream
Depends On:
Blocks: 1272357
  Show dependency treegraph
 
Reported: 2015-11-05 13:00 EST by Steven Hardy
Modified: 2016-04-26 18:21 EDT (History)
14 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-21 12:03:03 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1508115 None None None Never
OpenStack gerrit 238194 None None None Never

  None (edit)
Description Steven Hardy 2015-11-05 13:00:50 EST
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 16:34:24 EST
can we get this backported for z3?
Comment 3 Zane Bitter 2015-11-09 20:11:36 EST
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 12:50:02 EST
The upstream patch is now ready to go I think.
Comment 6 Amit Ugol 2015-12-14 09:29:09 EST
works better now. mind the syntax in the example on comment 0
Comment 8 errata-xmlrpc 2015-12-21 12:03:03 EST
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.