Ask Your Question
0

Heat doesn't recreate deleted resource on stack update

asked 2017-10-13 05:37:03 -0500

Alli gravatar image

If I start a stack that creates a Keystone user, then manually delete the user, and then update the stack, the user will not be recreated. Is this expected behaivor? Isn't Heat supposed to recreate resource when stack update operation is run.

Here is an example. Notice at the end that the stack is in UPDATE_COMPLETE status, but the user was not created.

root@server1:~# cat s1.yaml
heat_template_version: pike
description: Template 1
resources:
  r1:
    type: OS::Keystone::User
    properties:
      description: Desc 5
      name: u1
      password: p2

root@server1:~# openstack stack create s1 -t s1.yaml
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 011eb0c9-cf51-4dc9-a97b-238f098800c3 |
| stack_name          | s1                                   |
| description         | Template 1                           |
| creation_time       | 2017-10-13T10:28:26Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+
root@server1:~# openstack stack list
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+--------------+
| ID                                   | Stack Name | Project                          | Stack Status    | Creation Time        | Updated Time |
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+--------------+
| 011eb0c9-cf51-4dc9-a97b-238f098800c3 | s1         | 24383c68b68b4b838ee778c52459601f | CREATE_COMPLETE | 2017-10-13T10:28:26Z | None         |
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+--------------+
root@server1:~# openstack user list | grep u1
| 73dc60ea185148cca5275f0bb1ab6e2e | u1    |
root@server1:~# openstack user delete u1
root@server1:~# openstack stack update s1 -t s1.yaml
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 011eb0c9-cf51-4dc9-a97b-238f098800c3 |
| stack_name          | s1                                   |
| description         | Template 1                           |
| creation_time       | 2017-10-13T10:28:26Z                 |
| updated_time        | 2017-10-13T10:29:23Z                 |
| stack_status        | UPDATE_IN_PROGRESS                   |
| stack_status_reason | Stack UPDATE started                 |
+---------------------+--------------------------------------+
root@server1:~# openstack stack list
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+----------------------+
| ID                                   | Stack Name | Project                          | Stack Status    | Creation Time        | Updated Time         |
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+----------------------+
| 011eb0c9-cf51-4dc9-a97b-238f098800c3 | s1         | 24383c68b68b4b838ee778c52459601f | UPDATE_COMPLETE | 2017-10-13T10:28:26Z | 2017-10-13T10:29:23Z |
+--------------------------------------+------------+----------------------------------+-----------------+----------------------+----------------------+
root@server1:~# openstack user list | grep u1
root@server1:~#
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2017-10-13 08:22:19 -0500

zaneb gravatar image

That's the expected behaviour; Heat only responds to changes in the template.

You can use the stack-check action to check that all resources still exist; it will put any missing resources into the CHECK_FAILED state. If you know that a particular resource is missing/degraded, you can put it in the CHECK_FAILED state directly using the mark-unhealthy command.

Any resources in a *_FAILED state _will_ be replaced in a subsequent stack update.

edit flag offensive delete link more

Comments

I tried stack check command, however it will not put any missing resource into the CHECK_FAILED state. Here is a result for Keystone user: ​ | resource_status | CHECK_COMPLETE | | resource_status_reason | CHECK not supported for OS::Keystone::User

I got the same result for Neutron network.

Alli gravatar imageAlli ( 2017-10-16 00:25:01 -0500 )edit
1

Manual mark works as you described. It was added however recently (in 2016). Without it it can work with this trick: 1. Change some property of the resource, like description. 2. Run stack update, which will fail to update the resource and will mark it with UPDATE_FAILED. 3. Run stack update again.

Alli gravatar imageAlli ( 2017-10-16 00:34:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-10-13 05:37:03 -0500

Seen: 866 times

Last updated: Oct 13 '17