Retire Services - VMWare VMs not removed


I have just started evaluating the ManageIQ product, and I intend to manage a VMWare (vSphere) infrastructure and a OpenStack cloud with it.
I have created catalog items for both cases, and in the case of OpenStack it seems to be working just fine; but in the VMWare case I got a little bit confused: when retiring a service, the VM on vSphere is powered off, but not removed from vSphere – unlike the OpenStack case, that the VM is terminated. This would mean that the resources have not been “cleaned” on vSphere…
Is this the expected result, or am I missing something in my setup? If this is indeed the expected feature, what would be a possible way to remove the VM from vSphere?

Thank you and best regards.

In order for ManageIQ to fully retire a virtual machine the retirement state machine needs to be enabled. An policy will need to be created that will trigger the retirement state machine when a retirement event is triggered.

  1. Go to Control/Explorer/Policies.Click Control Policies and then highlight Vm Control Policies. Click Configuration and the select Add a New Vm Control Policy Provide a name for the policy and click save.

  2. Select the policy name and then click Configuration -> Edit this Policy’s Event Assignments assign the VM Retired event.

  3. Select the VM Retired event on the left hand side and then click Configuration -> Edit Actions for this policy event. Add the Raise Automation Event

  4. Go to Control/Explorer/Policies/Policy Profiles and then create a
    new policy profiles that will contain this newly created policy.

  5. Last step is to assign the policy profile to the Cloud or Infrastructure provider for that you would like to enforce a full retirement instance/virtual machines lifecycle.


Hi jcarter,

Thank you for the explanation, it worked like a charm!

Best regards.

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:

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.

Use case:
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). :worried:

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: