Bug 1264234 - heat updates raw_template when there is no change in raw_template
Summary: heat updates raw_template when there is no change in raw_template
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-heat
Version: 7.0 (Kilo)
Hardware: All
OS: Linux
urgent
high
Target Milestone: async
: 7.0 (Kilo)
Assignee: Steve Baker
QA Contact: Amit Ugol
URL:
Whiteboard:
Depends On: 1260990
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-18 00:21 UTC by Steve Baker
Modified: 2023-02-22 23:02 UTC (History)
27 users (show)

Fixed In Version: openstack-heat-2015.1.1-6.el7ost
Doc Type: Bug Fix
Doc Text:
Clone Of: 1260990
Environment:
Last Closed: 2015-10-15 12:30:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1494108 0 None None None Never
Red Hat Knowledge Base (Solution) 2114981 0 None None None 2016-01-07 07:57:50 UTC
Red Hat Product Errata RHBA-2015:1901 0 normal SHIPPED_LIVE openstack-heat bug fix advisory 2015-10-15 16:28:23 UTC

Comment 7 Amit Ugol 2015-10-14 10:52:04 UTC
the way that I tried to test it is this:
create a stack -> this created two raw templates
updated the stack with the same template, now we have 3 raw_templates
unless I missing something, this bug hasn't been fixed in this version.

tested in RHEL 7.1
version 2015.1.1-6.el7

after create and 1 update:

MariaDB [heat]> select * from raw_template\G;
*************************** 1. row ***************************
         id: 1
 created_at: 2015-10-14 10:35:11
 updated_at: NULL
   template: {"outputs": {"PublicKey": {"value": {"get_attr": ["KeyPair", "public_key"]}}, "PrivateKey": {"value": {"get_attr": ["KeyPair", "private_key"]}}}, "heat_template_version": "2013-05-23", "parameters": {"key_name": {"default": "heat_key_test", "type": "string"}, "key_save": {"default": false, "type": "string"}}, "resources": {"KeyPair": {"type": "OS::Nova::KeyPair", "properties": {"name": {"get_param": "key_name"}, "save_private_key": {"get_param": "key_save"}}}}}
      files: {}
environment: {"parameter_defaults": {}, "parameters": {}, "resource_registry": {"resources": {}}}
predecessor: NULL
*************************** 2. row ***************************
         id: 2
 created_at: 2015-10-14 10:38:37
 updated_at: NULL
   template: {"outputs": {"PublicKey": {"value": {"get_attr": ["KeyPair", "public_key"]}}, "PrivateKey": {"value": {"get_attr": ["KeyPair", "private_key"]}}}, "heat_template_version": "2013-05-23", "resources": {"KeyPair": {"type": "OS::Nova::KeyPair", "properties": {"name": {"get_param": "key_name"}, "save_private_key": {"get_param": "key_save"}}}}, "parameters": {"key_name": {"default": "heat_key_test", "type": "string"}, "key_save": {"default": false, "type": "string"}}}
      files: {}
environment: {"parameter_defaults": {}, "parameters": {}, "resource_registry": {"resources": {}}}
predecessor: NULL
*************************** 3. row ***************************
         id: 3
 created_at: 2015-10-14 10:38:39
 updated_at: NULL
   template: {"outputs": {"PublicKey": {"value": {"get_attr": ["KeyPair", "public_key"]}}, "PrivateKey": {"value": {"get_attr": ["KeyPair", "private_key"]}}}, "heat_template_version": "2013-05-23", "parameters": {"key_name": {"default": "heat_key_test", "type": "string"}, "key_save": {"default": false, "type": "string"}}, "resources": {"KeyPair": {"type": "OS::Nova::KeyPair", "properties": {"name": {"get_param": "key_name"}, "save_private_key": {"get_param": "key_save"}}}}}
      files: {}
environment: {"parameter_defaults": {}, "parameters": {}, "resource_registry": {"resources": {}}}
predecessor: NULL
3 rows in set (0.00 sec)


template that was used in this case:

heat_template_version: 2013-05-23

parameters:
  key_name:
    type: string
    default: heat_key_test
  key_save:
    type: string
    default: false

resources:
  KeyPair:
    type: OS::Nova::KeyPair
    properties:
      name: { get_param: key_name }
      save_private_key: { get_param: key_save }

outputs:
  PublicKey:
    value: { get_attr: [KeyPair, public_key] }
  PrivateKey:
    value: { get_attr: [KeyPair, private_key] }

Comment 8 Amit Ugol 2015-10-14 12:37:21 UTC
tested it better, thanks therve

Comment 9 Amit Ugol 2015-10-14 12:41:26 UTC
tested it better, thanks therve

Comment 10 Zane Bitter 2015-10-14 12:58:42 UTC
The bug wasn't about creating extra raw_template rows, but rather about doing multiple updates (with no actual change) to an existing row.

Also this test would not be sufficient to trigger the reported bug if it were present - it occurs only with Template resources (aka provider resources). There was a second issue fixed in this build that was also resulting in extra updates to the raw_template table which might have been triggered by this test, but I suspect it actually required something to be updated.

The two extra rows (timestamps suggest 1 from create and 2 from update, not the other way around) are expected - Heat creates a backup stack that has its own template, and because of soft deletes it doesn't get cleaned up as soon as we'd like it to (https://bugs.launchpad.net/heat/+bug/1332300). It also writes the new template at the end of the update - there may be a minor bug here in that we're not deleting the old one, but it's unrelated to the reported bug.

Comment 12 errata-xmlrpc 2015-10-15 12:30:25 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:1901


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