We have enabled the retirement state machine but we notice that virtual machines are only removed from the provider when they are provisioned by ManageIQ. When a virtual machine is present in manageIQ by discovery only it is not removed from the provider during retirement.
This behaviour is documented here: https://pemcg.gitbooks.io/introduction-to-cloudforms-automation/content/chapter18/retirement.html
I believe that it should not matter if a VM is provisioned by MIQ or is present in MIQ by discovery only when retiring. ManageIQ is meant to manage virtual machines irrespective of their origin.
The initial set of virtual machines of our MIQ tenants is migrated to VMware vSphere, discovered by MIQ and than the respective MIQ owner is set for each VM. From this moment the tenant will provision new virtual machines using MIQ.
This results in unpredictable behaviour of the Retire VM functionality. Some virtual machines will not be removed from vSphere when retired (the discovered VMs) and other virtual machines will be removed from vSphere when retired (the provisioned VMs).
I suggest the behaviour of the remove_from_provider method is altered so virtual machines will always be removed from the provider when they are retired (and the state machine is enabled) regardless of being provisioned in MIQ or being present in MIQ by discovery only.
Automation Method to be altered: