How to clean Archived VM's only


I would like to clean all the Archived VM’s only from VMDB. I have noticed this /var/www/miq/vmdb/tools/purge_archived_vms.rb will help in this.

But here my question is, under Compute/Infrastructure/Virtual Machines/VMs & Templates/.

Here the list whatever showing is both Archived and Templates too.

How to clean only the Archived VM’s, not a templates.

Thanks in advance.

query = Vm.where("updated_on < ? or updated_on IS NULL", ARCHIVE_CUTOFF)

The query should only return VMs.
ManageIQ has different Objects for Vm and Template and VmOrTemplate. The UI uses VmOrTemplate.

You can try to run the query in rails console, if you want to check it for yourself

As for the UI, there really is no way to see just archived templates in the VMs & Templates view,
but, in the Templates accordion, advanced search can be used to set a Template : Archived = "true" filter. (Or, you may already have a predefined Status / Archived filter.)