in files/destroy-vm.py [0:0]
def destroy_all():
"""
Destroys all VMs marked with the 'sd-workstation' tag, in the following order:
DispVMs, AppVMs, then TemplateVMs. Excludes VMs for which
installed_by_rpm=true.
"""
# Remove DispVMs first, then AppVMs, then TemplateVMs last.
sdw_vms = [vm for vm in q.domains if SDW_DEFAULT_TAG in vm.tags]
sdw_template_vms = [
vm for vm in sdw_vms if vm.klass == "TemplateVM" and not vm.installed_by_rpm
]
sdw_disp_vms = [vm for vm in sdw_vms if vm.klass == "DispVM"]
sdw_app_vms = [vm for vm in sdw_vms if vm.klass == "AppVM"]
for vm in sdw_disp_vms:
destroy_vm(vm)
for vm in sdw_app_vms:
destroy_vm(vm)
for vm in sdw_template_vms:
destroy_vm(vm)