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:
parent
1fbe168dcd
commit
7b64126c9d
1 changed files with 11 additions and 11 deletions
|
@ -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']:
|
||||
|
|
Loading…
Reference in a new issue