This is derivation bug report from bug-1270775.
https://bugs.launchpad.net/heat/+bug/1270775
Heat's behavior of when UpdateReplace has been failed is follows.
Mr.Zane wrote;
- The resource to be replaced gets moved to the backup stack
- The replacement resource is created. If this fails then...
- If rollback is enabled, it is deleted and the original resource returned. Everything is fine.
- If rollback is disabled, the failed resource remains in the stack and the old resource in the backup stack.
- When deleting the stack both the failed and the backup resource will be deleted.
When the UpdateReplace is failed, the resource_id seems None. But it is just
moved to backup_stack. However, we have no APIs to access the backup_stack.
[example]
- create a stack to update
devstack@heat-test-env:~/work_heat/updatereplace$ cat template.before
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"Net": {
"Type": "OS::Neutron::Net",
"Properties": {
"name": "network"
}
},
"SubNet": {
"Type": "OS::Neutron::Subnet",
"Properties": {
"network_id": {"Ref": "Net"},
"ip_version": 4,
"cidr": "10.0.1.0/24",
"allocation_pools": [{"start": "10.0.1.20", "end": "10.0.1.150"}]
}
}
}
}
devstack@heat-test-env:~/work_heat/updatereplace$ heat stack-create -f template.before stack1
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
| 8ea7366e-a870-495b-9854-86b007f4d927 | stack1 | CREATE_IN_PROGRESS | 2014-03-28T05:24:15Z |
+--------------------------------------+------------+--------------------+----------------------+
devstack@heat-test-env:~/work_heat/updatereplace$ heat stack-list
+--------------------------------------+------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+-----------------+----------------------+
| 8ea7366e-a870-495b-9854-86b007f4d927 | stack1 | CREATE_COMPLETE | 2014-03-28T05:24:15Z |
+--------------------------------------+------------+-----------------+----------------------+
- update the stack to be UPDATE_FAILED
devstack@heat-test-env:~/work_heat/updatereplace$ cat template.after
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"Net": {
"Type": "OS::Neutron::Net",
"Properties": {
"name": "network"
}
},
"SubNet": {
"Type": "OS::Neutron::Subnet",
"Properties": {
"network_id": {"Ref": "Net"},
"ip_version": 4,
"cidr": "10.0.2.0/24",
"allocation_pools": [{"start": "10.0.2.20", "end": "10.0.2.999"}]
}
}
}
}
- the physical_resource_id is None. it seems lost.
devstack@heat-test-env:~/work_heat/updatereplace$ heat stack-update -f template.after stack1
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
| 8ea7366e-a870-495b-9854-86b007f4d927 | stack1 | UPDATE_IN_PROGRESS | 2014-03-28T05:24:15Z |
+--------------------------------------+------------+--------------------+----------------------+
devstack@heat-test-env:~/work_heat/updatereplace$ heat stack-list
+--------------------------------------+------------+---------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+---------------+----------------------+
| 8ea7366e-a870-495b-9854-86b007f4d927 | stack1 | UPDATE_FAILED | 2014-03-28T05:24:15Z |
+--------------------------------------+------------+---------------+----------------------+
devstack@heat-test-env:~/work_heat/updatereplace$ heat resource-show stack1 SubNet
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
| description | |
| links | http://192.168.10.99:8004/v1/c1685cb61c4243efa3660550a0b99627/stacks/stack1/8ea7366e-a870-495b-9854-86b007f4d927/resources/SubNet |
| | http://192.168.10.99:8004/v1/c1685cb61c4243efa3660550a0b99627/stacks/stack1/8ea7366e-a870-495b-9854-86b007f4d927 |
| logical_resource_id | SubNet |
| physical_resource_id | |
| required_by | Port |
| resource_name | SubNet |
| resource_status | CREATE_FAILED |
| resource_status_reason | NeutronClientException: Invalid input for allocation_pools. Reason: '10.0.2.999' is not a valid IP address. |
| resource_type | OS::Neutron::Subnet |
| updated_time | 2014-03-28T05:25:24Z |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
- the resource is in the backup_stack
mysql> select id, nova_instance, name, status, stack_id from resource;
+--------------------------------------+--------------------------------------+--------+----------+--------------------------------------+
| id | nova_instance | name | status | stack_id |
+--------------------------------------+--------------------------------------+--------+----------+--------------------------------------+
| 21d8983e-4978-435c-9b71-028d405d4b4a | 3a3c6ecf-de94-4a6e-a64c-d6ae65af4fb4 | Net | COMPLETE | 8ea7366e-a870-495b-9854-86b007f4d927 |
| 58d92166-e6aa-4d6d-be0d-778e96be8e52 | e67aebe4-7dfb-4a95-ac2f-d0f2cd5cfbe9 | SubNet | FAILED | 1eb8a9ee-772b-4c98-a364-846fb917e054 |
| ed16b409-a875-4c1c-b3b5-986fcbe9d88f | NULL | SubNet | FAILED | 8ea7366e-a870-495b-9854-86b007f4d927 |
+--------------------------------------+--------------------------------------+--------+----------+--------------------------------------+
4 rows in set (0.00 sec)
The long term plan for this with the "convergence" architecture is to get rid of the backup stack and allow multiple versions of a resource to co-exist within a single stack at the same time.