VMware prevent VM from deletion on Delete action

Hello,
Can somebody point on the source code which triggers delete VM from VMware on host delete?
I need to skip that step, since we have a custom scripts which move VMs to archive storage (Disassociate is not an option, we still want to control VMs from foreman and be able to jump to the console)

Thanks

Hi,

the vm deletion is here - https://github.com/theforeman/foreman/blob/develop/app/models/concerns/orchestration/compute.rb#L75-L79

if you plan to send a patch, there’s and RFE to make VM deletion optional when we delete a host. It could be a global setting perhaps. If you decide to work on this, feel free to use existing redmine issue Feature #22737: Flag to avoid deletion from compute resource of an host associated when it’s removed from satellite - Foreman

Hope this helps

Yeah, already found it yesterday.
Definetely this should go as a global option.
I’ll check the redmine ticket.
Thanks.

1 Like