1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #9381 from debfx/facts_virt_kvm

Detect kvm guests through sys_vendor.
This commit is contained in:
James Cammarata 2014-10-20 10:53:39 -05:00
commit efb40969b3

View file

@ -2206,6 +2206,11 @@ class LinuxVirtual(Virtual):
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_role'] = 'guest'
return return
if sys_vendor == 'QEMU':
self.facts['virtualization_type'] = 'kvm'
self.facts['virtualization_role'] = 'guest'
return
if os.path.exists('/proc/self/status'): if os.path.exists('/proc/self/status'):
for line in open('/proc/self/status').readlines(): for line in open('/proc/self/status').readlines():
if re.match('^VxID: \d+', line): if re.match('^VxID: \d+', line):