snapshot image of server left after the stack deleted

Bug #1716845 reported by huangtianhua
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
In Progress
Medium
huangtianhua

Bug Description

1. create a stack with the snippet:
*********************
resources:
  server_1:
    type: OS::Nova::Server
    properties:
      name: ser1
      flavor: {get_param: flavor}
      image: {get_param: image}
      networks:
        - port: {get_resource: port_1}
      tags:
        - t1
  server_2:
    type: OS::Nova::Server
    properties:
      name: ser2
      flavor: {get_param: flavor}
      image: {get_param: image}
      networks:
        - port: {get_resource: port_2}
  port_1:
    type: OS::Neutron::Port
    properties:
      network: private
    port_2:
    type: OS::Neutron::Port
    properties:
      network: private
************************
2. snapshot for the stack
3. update the stack to remove the 'server_2' resource
4. delete the stack

The stack and resources deleted successfully, but the image for the resource 'server_2' left.

Changed in heat:
assignee: nobody → huangtianhua (huangtianhua)
milestone: none → queens-1
importance: Undecided → Medium
Revision history for this message
Thomas Herve (therve) wrote :

Can you explain a bit more? Why would the image of the server be deleted?

Revision history for this message
huangtianhua (huangtianhua) wrote :

For step 2 we create the snapshot for the stack, create images for the two servers ('external_ser' and 'th_server'), when we delete the stack, the snapshot image of 'th_server' be deleted as expected,see the code:
https://github.com/openstack/heat/blob/master/heat/engine/stack.py#L1926-L1940

for name, rsrc in six.iteritems(self.resources):
            snapshot_data = snapshot.data
            if snapshot_data:
                data = snapshot.data['resources'].get(name)
                scheduler.TaskRunner(rsrc.delete_snapshot, data)()

We iterate the resources of the stack which has removed the resource 'external_ser' when update, so the snapshot image of the resource 'external_ser' left.
Maybe we should make sure the snapshot image be deleted when remove the resource 'external_ser'.

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

IMO we should not even snapshot an external resource when doing a stack snapshot, as it's not managed by heat.

Revision history for this message
huangtianhua (huangtianhua) wrote :

@Rabi Mishra,
In fact this bug is not related with the 'external' resource, just my template with it. If you remove a normal server resource, the bug is still happen. Of course, I think you mentioned another bug: don't snapshot an external resource when doing a stack :)

Revision history for this message
huangtianhua (huangtianhua) wrote :
Revision history for this message
huangtianhua (huangtianhua) wrote :

I have modified the bug description to use the normal resources.

description: updated
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/504862

Changed in heat:
status: New → In Progress
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-1 → queens-2
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-2 → queens-3
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-3 → queens-rc1
Rico Lin (rico-lin)
Changed in heat:
milestone: queens-rc1 → rocky-1
Rico Lin (rico-lin)
Changed in heat:
milestone: rocky-1 → rocky-2
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.