facts: detect FreeBSD jails guest (#62857)

* facts: detect FreeBSD jails

* PEP8 fix
This commit is contained in:
leManu 2019-09-26 16:08:33 +02:00 committed by Brian Coca
parent 5b1c047a56
commit f8fcf7fcbb
2 changed files with 5 additions and 1 deletions

View file

@ -41,7 +41,8 @@ class FreeBSDVirtual(Virtual, VirtualSysctlDetectionMixin):
virtual_facts['virtualization_role'] = 'guest' virtual_facts['virtualization_role'] = 'guest'
if virtual_facts['virtualization_type'] == '': if virtual_facts['virtualization_type'] == '':
virtual_product_facts = self.detect_virt_product('kern.vm_guest') or self.detect_virt_product('hw.hv_vendor') virtual_product_facts = self.detect_virt_product('kern.vm_guest') or self.detect_virt_product(
'hw.hv_vendor') or self.detect_virt_product('security.jail.jailed')
virtual_facts.update(virtual_product_facts) virtual_facts.update(virtual_product_facts)
if virtual_facts['virtualization_type'] == '': if virtual_facts['virtualization_type'] == '':

View file

@ -48,6 +48,9 @@ class VirtualSysctlDetectionMixin(object):
elif out.rstrip() == 'RHEV Hypervisor': elif out.rstrip() == 'RHEV Hypervisor':
virtual_product_facts['virtualization_type'] = 'RHEV' virtual_product_facts['virtualization_type'] = 'RHEV'
virtual_product_facts['virtualization_role'] = 'guest' virtual_product_facts['virtualization_role'] = 'guest'
elif (key == 'security.jail.jailed') and (out.rstrip() == '1'):
virtual_product_facts['virtualization_type'] = 'jails'
virtual_product_facts['virtualization_role'] = 'guest'
return virtual_product_facts return virtual_product_facts