stack-delete fails when deleting a template with resource group

Bug #1547435 reported by jz
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
New
Undecided
zhaozhilong

Bug Description

using the below template created a stack. but delete will fail

heat_template_version: 2015-04-30

description: Simple template to deploy 100 compute instances

parameters:
  image_name:
    type: string
  instance_count:
    type: number
    default: 2

resources:
   net:
      type: OS::Neutron::Net
      properties:
         admin_state_up: true
  subnet:
      type: OS::Neutron::Subnet
      properties:
         cidr: 10.0.0.0/24
         enable_dhcp: true
         network_id: { get_resource: net }
         allocation_pools:
         - start: 10.0.0.1
           end: 10.0.0.10

  instances:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: instance_count }
      resource_def:
        type: OS::Nova::Server
        properties:
          image: { get_param: image_name }
          flavor: { get_param: flavor_name }
          networks:
             - network: { get_resource: net }

when deleting the stack, it seemed that heat did not calclulate the dependencies correctly, and tried
to delete the subnet first which led to a conflict:
"Conflict: Unable to complete operation on subnet bb7a7d76-e651-4f9e-a205-3756999de58a. One or more ports have an IP allocation from this subnet"

Changed in heat:
assignee: nobody → zhaozhilong (zhaozhilong)
Revision history for this message
Rabi Mishra (rabi) wrote :

I think you can get around this issue by adding explicit dependency 'depends-on' to 'instances' or use the subnet with the server networks property.

ex.

instances:
    type: OS::Heat::ResourceGroup
    depends_on: subnet

or

          networks:
             - subnet: { get_resource: subnet }

There is check for the OS::Nova::Server to check for subnets[1] in the same stack. However, it does not work with ResourceGroup as it's nested stack and the subnet is in the parent/root stack.

However, the template you used results in a non deletable stack which is worrying.

[1] https://github.com/openstack/heat/blob/master/heat/engine/resources/openstack/nova/server.py#L987-L998

Revision history for this message
jz (danielradcliffe2004) wrote :

I know add depends_on is a work around and has tried that already. But I think even
without depends_on, heat should handle the dependency correctly in this case.

Revision history for this message
tom king (kingttx) wrote :

This also affects VIO 3.1.

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

We probably don't have a way to handle this atm. You can surely use the workaround in comment #1.

Changed in heat:
milestone: none → next
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.