VirtWhat - Command virt-what

Parses the output of the virt-what command to check if the host is running in a virtual machine.

Sample input::

kvm

Examples

>>> vw = shared[VirtWhat]
>>> vw.is_virtual
True
>>> vw.is_physical
False
>>> vw.generic
'kvm'
>>> 'aws' in vw
False

Note

For virt-what-1.13-8 or older on RHEL7, the command fails when running without an environment (or very restricted environment), and reports below error:

virt-what: virt-what-cpuid-helper program not found in $PATH
class insights.parsers.virt_what.VirtWhat(*args, **kwargs)[source]

Bases: CommandParser

Class for parsing virt-what command.

generic

The type of the virtual machine. ‘baremetal’ if physical machine.

Type:

str

errors

List of the error information if any error occurs.

Type:

list

specifics

List of the specific information if the command outputs.

Type:

list

property is_physical

Is the host running in a physical machine? None when something is wrong.

Type:

bool

property is_virtual

Is the host running in a virtual machine? None when something is wrong.

Type:

bool

parse_content(content)[source]

This method must be implemented by classes based on this class.