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

pushed up openvz detection for cases of 'stacked' virtualization

This commit is contained in:
Brian Coca 2015-09-30 11:27:50 -04:00
parent 1fbe168dcd
commit 7b64126c9d

View file

@ -2593,17 +2593,6 @@ class LinuxVirtual(Virtual):
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_role'] = 'guest'
return 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'): if os.path.exists('/proc/vz'):
self.facts['virtualization_type'] = 'openvz' self.facts['virtualization_type'] = 'openvz'
if os.path.exists('/proc/bc'): if os.path.exists('/proc/bc'):
@ -2618,6 +2607,17 @@ class LinuxVirtual(Virtual):
self.facts['virtualization_role'] = 'guest' self.facts['virtualization_role'] = 'guest'
return 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') product_name = get_file_content('/sys/devices/virtual/dmi/id/product_name')
if product_name in ['KVM', 'Bochs']: if product_name in ['KVM', 'Bochs']: