Backlog #2021

Add an delete-on-termination for automatically deleting images on VM termination

Added by Simon Boulet about 8 years ago. Updated over 7 years ago.

Status:PendingStart date:05/10/2013
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Documentation
Target version:-

Description

Much like the Amazon EC delete-on-termination attribute (which automatically deletes EBS disk on VM termination). It would allow the user to select whether or not to delete the persistent VM image when the VM is deleted. We could have a special attribute ex. IMAGE_DELETE_ON_TERMINATION yes/no in the USER_TEMPLATE attributes. Or if we want finer configuration perhaps make IMAGE_DELETE_ON_TERMINATION an array with IMAGE ID to be deleted.

Or, perhaps it's better to leave this Off from the core, and instead encourage VM_HOOK for that (I believe this can be quite easily implemented using the DONE hook).

History

#1 Updated by Ruben S. Montero about 8 years ago

I also think that the DONE hook will be so easily implemented, given that you have the template. you can query the template and delete any image... The implementation could be as follows:

1. Add one or more delete attributes to the user template

IMAGE_DELETE_ON_TERMINATION = [ IMAGE_ID = "3" ]

2. The on done hook would be like (off the top of my head...)


client = Client.new
vm     = OpenNebula::VirtualMachine.new(ARGV[0],client)

ids    = vm.retrieve_elements("/VM/USER_TEMPLATE/IMAGE_DELETE_ON_TERMINATION/IMAGE_ID")

return if ids.nil?

ids.each { |i|
  image = OpenNebula::Image.build_xml(i)

  image.delete
}

#2 Updated by Ruben S. Montero about 8 years ago

BTW, we could probably add this to some part of the documentation or the wiki if you finally implement this. Maybe we can have this an other hooks in share samples... but I think we should not include this as a default.

#3 Updated by Ruben S. Montero about 8 years ago

  • Tracker changed from Feature to Request

#4 Updated by Simon Boulet about 8 years ago

Ruben S. Montero wrote:

BTW, we could probably add this to some part of the documentation or the wiki if you finally implement this. Maybe we can have this an other hooks in share samples... but I think we should not include this as a default.

I like the idea of bundling some samples hooks with the distribution. Perhaps requiring the author to maintain a page on the wiki for his contribution.

#5 Updated by Ruben S. Montero over 7 years ago

  • Tracker changed from Request to Backlog
  • Category set to Documentation
  • Priority changed from Normal to Low

To add this as an example

Also available in: Atom PDF