Correct Driver Function For Cleaning Up Allocation Resources

I have a custom driver that spin up VM resources and will automatically reschedule the workload if the VM exits (successfully or unsuccessfully) however I’m trying to figure out a way to automatically clean up the old resources.

It seems like StopTask and DestroyTask only get called if the job is stopped. I’m looking for something to do when the allocation stop.

Any advice?