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

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:
gl0bus 2016-12-02 18:23:43 +01:00 committed by Brian Coca
parent 435dfc2b9c
commit d5eff47fcc

View file

@ -3259,6 +3259,11 @@ class LinuxVirtual(Virtual):
self.facts['virtualization_role'] = 'guest'
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')
if bios_vendor == 'Xen':
@ -3294,6 +3299,11 @@ class LinuxVirtual(Virtual):
self.facts['virtualization_role'] = 'guest'
return
if sys_vendor == 'OpenStack Foundation':
self.facts['virtualization_type'] = 'openstack'
self.facts['virtualization_role'] = 'guest'
return
if os.path.exists('/proc/self/status'):
for line in get_file_lines('/proc/self/status'):
if re.match('^VxID: \d+', line):