Product SiteDocumentation Site

3.4.5. getType

The getType method can be used to obtain the type of virtualization in use on this connection. If successful it returns a string representing the type of virtualization in use. If an error occurred, None will be returned instead. The following code demonstrates the use of getType:

Example 3.15. Using virConnectGetType

# Example-14.py
#!/usr/bin/env python3
import sys
import libvirt

conn = None
try:
    conn = libvirt.open("qemu:///system")
except libvirt.libvirtError as e:
    print(repr(e), file=sys.stderr)
    exit(1)

print('Virtualization type: '+conn.getType())

conn.close()
exit(0)