Undeploy instance from inside guest operative system

Hello,

Is there any configuration way to force an “undeploy” when user power off an instance from inside guest operative system? I have forced power button to undeploy action, but if user shutdowns “correctly” his instances (from the power button in Gnome, for example), instance execute a “power off” and not an undeploy and, then, instances doesn’t free up its resources.

Thanks!

Hello,
It is possible to use onegate but I think defining a VM hook that trigger VM undeploy when VM goes to powered off state fits better.

Best Regards,
Anton Todorov