Post VM Delete cleanup script

Hi!

We’re using OpenNebula for a developer sandbox where they can create and destroy VM’s at will, backed by VMWare.

I have created VM templates for Windows and Linux and added customization scripts to do things like automatic domain joining, installation of AV agent, etc. and they deploy well.

The problem we have is cleaning up when a VM is destroyed. We need to remove it from AD, remove it from monitoring, remove any DNS entries, etc.

Is there a way to call a script to do this sort of thing, or do I need to do monitoring of VM’s another way, such as vSphere powercli?

Thanks!

Hi,

You could try registering a VM_HOOK that should be called on VM state DONE.
For more details take a look in the docs which should be configured in /etc/one/oned.conf

Hope this helps.

Best Regards,
Anton Todorov

Thank you! This is exactly what I wanted.

Hello Max,
I’m facing the same challenge than you, delete the VM from AD when a user terminate with it.
Could you give me some advice or the script that you use to do this ?

Thanks for your help
BR
Matthieu