There are no accessibilities for the backup_stack

Bug #1301320 reported by Ryo Miki
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve Baker

Bug Description

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)

Revision history for this message
Zane Bitter (zaneb) wrote :

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.

Changed in heat:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Removed by request (removed3381998) wrote :

In my case this is also effects restoring from snapshots.
steps:
  create a stack like in ^ example,
  make a snapshot,
  update (that will fail),
  restore will fail so we can't go back to the good stack, as now we have a broken network.

I'd rise the the importance here to High.

Revision history for this message
Removed by request (removed3381998) wrote :

FYI,
in my case, I have changed the CIDR and also the name, tried to update and then tried to restore. After restoring from the snapshot (and failing):
# neutron subnet-list
+--------------------------------------+--------------------------------+--------------+-----------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+--------------------------------+--------------+-----------------------------------------------+
| 26685177-8c82-4ce2-a037-1c6e00dd8ad0 | private_subnet_heat | 10.1.10.0/24 | {"start": "10.1.10.10", "end": "10.1.10.200"} |
| 248e559e-3b34-46b5-83fc-1ed08c4d524c | private_subnet_heat_huhuhuhuhu | 10.2.10.0/24 | {"start": "10.2.10.10", "end": "10.2.10.200"} |
+--------------------------------------+--------------------------------+--------------+-----------------------------------------------+

Changed in heat:
importance: Medium → High
Revision history for this message
Kanagaraj Manickam (kanagaraj-manickam) wrote :

this bug will become invalid once convergence in place

tags: added: fixed-by-convergence
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/342612

Changed in heat:
assignee: nobody → Steve Baker (steve-stevebaker)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/342613

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

Reviewed: https://review.openstack.org/342612
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=483c505d61a1161ecdab77e56f014ff34f1304d3
Submitter: Jenkins
Branch: master

commit 483c505d61a1161ecdab77e56f014ff34f1304d3
Author: Steve Baker <email address hidden>
Date: Fri Jul 15 11:53:31 2016 +1200

    Do not raise NotFound for resource_get_all_* queries

    A stack with zero resources is not an exception worthy condition (for
    example, a stack being deleted, a stack which really does have zero
    resources).

    Also its unusual that a collection query function would raise a
    NotFound when the result count is zero.

    This change fixes that for resource_get_all_by_stack and
    resource_get_all_active_by_stack

    Change-Id: I3420d5099830f5626095b17c01e9d886b477915c
    Related-Bug: #1301320
    Related-Bug: #1523748

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/342613
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=10030beb2f2895150ecb55b4f539d661d0f7e4bc
Submitter: Jenkins
Branch: master

commit 10030beb2f2895150ecb55b4f539d661d0f7e4bc
Author: Steve Baker <email address hidden>
Date: Fri Jul 15 16:24:13 2016 +1200

    Fallback to db for resource show

    This change adds a Stack.resource_get which is used by
    describe_stack_resource (stack resource show). It has a different
    behaviour when the resource is missing from the stack resources dict,
    attempting to return a resource from the DB record in the current
    stack.

    This allows "stack resource show" to show a resource in a convergence
    stack while the resource is being deleted.

    Change-Id: I975778ac36ae31fe5bd3ebdbcd7c48a6fcc60757
    Partial-Bug: #1301320
    Related-Bug: #1523748

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/278231
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=fab4fe769bd10c458a218e372dcdddef21e289b4
Submitter: Jenkins
Branch: master

commit fab4fe769bd10c458a218e372dcdddef21e289b4
Author: Steve Baker <email address hidden>
Date: Fri Jun 3 09:10:26 2016 +1200

    Load resources from DB for resource list

    Currently, when a user makes an API call to list resources, they were
    retrieved from the currently active template associated with the
    stack. This worked in the legacy engine where no concurrent updates
    where possible. With convergence and thus concurrent updates, a stack
    is allowed to have resources of previous traversals and still continue
    creating new resources. Therefore, relying on the template to list
    resources won't exactly match the state in the database.

    For example, on deletes where we update with an empty template,
    currently, the stack parses the empty template searching for
    resources. Doing a `resource-list` when the stack is in a state of
    DELETE_IN_PROGRESS shows an empty list of resources and therefore not
    matching the state in the database.

    This change makes iter_resources always call _find_filtered_resources
    which builds all its resources from a database query.

    Change-Id: Ibe87a773c38efb6d4865fd3a1dbd079972dd8be4
    Closes-Bug: #1523748
    Closes-Bug: #1301320

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 7.0.0.0b3

This issue was fixed in the openstack/heat 7.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.