From 7b64126c9d83f7201453c128c69f9fcdac082cdb Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 30 Sep 2015 11:27:50 -0400 Subject: [PATCH] pushed up openvz detection for cases of 'stacked' virtualization --- lib/ansible/module_utils/facts.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index c8b2056f107..1ba61bb77f0 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2593,17 +2593,6 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return - if os.path.exists("/proc/xen"): - self.facts['virtualization_type'] = 'xen' - self.facts['virtualization_role'] = 'guest' - try: - for line in get_file_lines('/proc/xen/capabilities'): - if "control_d" in line: - self.facts['virtualization_role'] = 'host' - except IOError: - pass - return - if os.path.exists('/proc/vz'): self.facts['virtualization_type'] = 'openvz' if os.path.exists('/proc/bc'): @@ -2618,6 +2607,17 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return + if os.path.exists("/proc/xen"): + self.facts['virtualization_type'] = 'xen' + self.facts['virtualization_role'] = 'guest' + try: + for line in get_file_lines('/proc/xen/capabilities'): + if "control_d" in line: + self.facts['virtualization_role'] = 'host' + except IOError: + pass + return + product_name = get_file_content('/sys/devices/virtual/dmi/id/product_name') if product_name in ['KVM', 'Bochs']: