Heat gets wrong id during property translation

Bug #1609787 reported by Oleksii Chuprykov
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
In Progress
High
Unassigned

Bug Description

When subnet template is using network name as a reference then it fails to find its parent network.

simplified example:
net.yaml
heat_template_version: 2015-04-30
resources:
  media_net:
    type: OS::Neutron::Net
    properties:
      name: media_net
  signaling_net:
    type: OS::Neutron::Net
    properties:
      name: signaling_net

subnet.yaml
heat_template_version: 2015-04-30
resources:
  signaling_subnet:
    type: OS::Neutron::Subnet
    properties:
      name: signaling_subnet
      cidr: 10.0.0.0/24
      network: signaling_net
      gateway_ip: 10.0.0.1
      allocation_pools:
        - start: 10.0.0.2
          end: 10.0.0.100
  media_subnet:
    type: OS::Neutron::Subnet
    properties:
      name: media_subnet
      cidr: 10.1.0.0/24
      network: media_net
      gateway_ip: 10.1.0.1
      allocation_pools:
        - start: 10.1.0.2
          end: 10.1.0.100

steps to reproduce:
heat stack-create net -f net.yaml
heat stack-create subnet -f subnet.yaml

heat stack-delete subnet
heat stack-delete net

heat stack-create net -f net.yaml
heat stack-create subnet -f subnet.yaml <--- fail here:

TRACE heat.engine.resource Traceback (most recent call last):
TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 732, in _action_recorder
TRACE heat.engine.resource handler_args = [resource_data] if resource_data is not None else []
TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 812, in _do_action
TRACE heat.engine.resource try:
TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/scheduler.py", line 312, in wrapper
TRACE heat.engine.resource else:
TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resource.py", line 775, in action_handler_task
TRACE heat.engine.resource # This method can be called when we replace a resource, too. In that
TRACE heat.engine.resource File "/opt/stack/heat/heat/engine/resources/openstack/neutron/subnet.py", line 361, in handle_create
TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 669, in create_subnet
TRACE heat.engine.resource return self.post(self.subnets_path, body=body)
TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 347, in post
TRACE heat.engine.resource headers=headers, params=params)
TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 282, in do_request
TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 257, in _handle_fault_response
2016-08-04 15:51:12.691 TRACE heat.engine.resource exception_handler_v20(status_code, error_body)
2016-08-04 15:51:12.691 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 84, in exception_handler_v20
2016-08-04 15:51:12.691 TRACE heat.engine.resource request_ids=request_ids)
2016-08-04 15:51:12.691 TRACE heat.engine.resource NetworkNotFoundClient: Network e3d7df54-7193-4c80-81f8-1a295e344cd1 could not be found.
2016-08-04 15:51:12.691 TRACE heat.engine.resource Neutron server returns request_ids: ['req-c57becb1-94ff-4787-bb3f-433342a4729b']

I think the problem is in cache for resource finders.

Changed in heat:
assignee: nobody → Oleksii Chuprykov (ochuprykov)
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/362406

Changed in heat:
assignee: Oleksii Chuprykov (ochuprykov) → Peter Razumovsky (prazumovsky)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in heat:
assignee: Peter Razumovsky (prazumovsky) → Dmitriy (duvarenkov)
Revision history for this message
Rabi Mishra (rabi) wrote :

If we want to create/delete and recreate resources with same name so frequently, would not it be better disable the finder specific cache[1] for that deployment, rather than adding code to invalidate the cache while deleting resources.

[1] https://github.com/openstack/heat/blob/8b02644d631ea2d28b27fcc30d7b8091b002a9db/heat/common/cache.py#L83

Revision history for this message
Dmitriy (duvarenkov) wrote :

Well, you can disable cache, but it will be additional action. With that approach, user needs to know that if he wants to do actions A, he needs to do a list of actions B. If he doesn't he will be confused and looking for help. Even if he does not plan to recreate resource frequently he can stuck into this bug.
Safest way is to disable finder specific cache by default. But, that will make deployment slower, cache exists for a reason. And again, to make it faster, user needs to do additional actions.
So I think it is certainly better to resolve this automatically.

Revision history for this message
Rabi Mishra (rabi) wrote :

Not sure why you would want to disable any cache(global/finder specific) by default?? There is always a flag to toggle it and also a ttl to set based on your deployment requirements.

We should not link/complicate resource plugin lifcycle code with cache stuff, as it does not really know whether, it is actually enabled or not. It should be agnostic to existence of cache or not.

Revision history for this message
Dmitriy (duvarenkov) wrote :

Well, we can add a check to look into conf file is cache enabled or not. Would this solve problem you mentioned?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Peter Razumovsky (<email address hidden>) on branch: master
Review: https://review.openstack.org/362406
Reason: due to another solution abandon current https://review.openstack.org/#/c/366696/

Thomas Herve (therve)
Changed in heat:
milestone: none → ocata-1
importance: Undecided → Medium
Rabi Mishra (rabi)
Changed in heat:
milestone: ocata-1 → ocata-2
Rabi Mishra (rabi)
Changed in heat:
milestone: ocata-2 → next
Revision history for this message
Thomas Herve (therve) wrote :

https://bugs.launchpad.net/heat/+bug/1670435 has been marked as a duplicated of this bug.

Zane Bitter (zaneb)
Changed in heat:
assignee: Dmitriy (duvarenkov) → nobody
importance: Medium → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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