Extend OpenStack related hypervisor detection (#15166)
* fixed detection of ansible_virtualization_(role|path) facts for VM's running in OpenStack Instances * NOTE: this will break detection of ansible_virtualization_(role|path) facts if you are using Openstack Instaces with nested virtualization * fixed detection of ansible_virtualization_(role|path) facts for VM's running in OpenStack Instances Fixes #15165 * NOTE: this will break detection of ansible_virtualization_(role|path) facts if you are using Openstack Instaces with nested virtualization
This commit is contained in:
parent
435dfc2b9c
commit
d5eff47fcc
1 changed files with 10 additions and 0 deletions
|
@ -3259,6 +3259,11 @@ class LinuxVirtual(Virtual):
|
||||||
self.facts['virtualization_role'] = 'guest'
|
self.facts['virtualization_role'] = 'guest'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if product_name == 'OpenStack Nova':
|
||||||
|
self.facts['virtualization_type'] = 'openstack'
|
||||||
|
self.facts['virtualization_role'] = 'guest'
|
||||||
|
return
|
||||||
|
|
||||||
bios_vendor = get_file_content('/sys/devices/virtual/dmi/id/bios_vendor')
|
bios_vendor = get_file_content('/sys/devices/virtual/dmi/id/bios_vendor')
|
||||||
|
|
||||||
if bios_vendor == 'Xen':
|
if bios_vendor == 'Xen':
|
||||||
|
@ -3294,6 +3299,11 @@ class LinuxVirtual(Virtual):
|
||||||
self.facts['virtualization_role'] = 'guest'
|
self.facts['virtualization_role'] = 'guest'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if sys_vendor == 'OpenStack Foundation':
|
||||||
|
self.facts['virtualization_type'] = 'openstack'
|
||||||
|
self.facts['virtualization_role'] = 'guest'
|
||||||
|
return
|
||||||
|
|
||||||
if os.path.exists('/proc/self/status'):
|
if os.path.exists('/proc/self/status'):
|
||||||
for line in get_file_lines('/proc/self/status'):
|
for line in get_file_lines('/proc/self/status'):
|
||||||
if re.match('^VxID: \d+', line):
|
if re.match('^VxID: \d+', line):
|
||||||
|
|
Loading…
Reference in a new issue