From ee5f5ee00df5f0ec87117c0346b74586e8167f37 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sun, 19 Oct 2014 22:55:50 +0200 Subject: [PATCH] Detect kvm guests through sys_vendor. The two detection methods currently implemented do not cover all cases. For example qemu guests invoked like this: qemu -machine pc-i440fx-1.4,accel=kvm -cpu SandyBridge return this information: product_name: Standard PC (i440FX + PIIX, 1996) cpuinfo: model name : Intel Xeon E312xx (Sandy Bridge) --- lib/ansible/module_utils/facts.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 9515bd1fffe..e0a21bfcde1 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2157,6 +2157,11 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return + if sys_vendor == 'QEMU': + self.facts['virtualization_type'] = 'kvm' + self.facts['virtualization_role'] = 'guest' + return + if os.path.exists('/proc/self/status'): for line in open('/proc/self/status').readlines(): if re.match('^VxID: \d+', line):