11.3.4. List Current Virtual Machines' Names, Types, and Operating Systems

This example produces a list of all current virtual machines names, types and operating systems in the Red Hat Enterprise Virtualization Manager environment. This kind of report demonstrates the usage of the ENUM table. The following SQL query defines this report:

Example 11.4. 

SELECT 	vm_name, vm_type_value.value as vm_type, os_value.value as operating_system
  FROM 	v3_0_latest_vm_configuration_view
		inner join v3_0_enum_translator_view as vm_type_value on (vm_type_value.enum_type = 'VM_TYPE' and v3_0_latest_vm_configuration_view.vm_type = vm_type_value.enum_key)
		inner join v3_0_enum_translator_view as os_value on (os_value.enum_type = 'OS_TYPE' and v3_0_latest_vm_configuration_view.operating_system = os_value.enum_key)

This query returns a table of virtual machines with OS and VM Type data:

Table 11.4. Current Virtual Machines' Names, Types, and Operating Systems

vm_name vm_type operating_system
RHEL6-Pool-2 Desktop RHEL 6 x64
RHEL6-Pool-1 Desktop RHEL 6 x64
RHEL6-Pool-3 Desktop RHEL 6 x64
RHEL6-Pool-4 Desktop RHEL 6 x64
RHEL6-Pool-5 Desktop RHEL 6 x64

Reporting Views

The Red Hat Enterprise Virtualization Technical Reference Guide provides a detailed reference that describes all the configuration and history views available for reporting.