mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Detect vmm virtualization for OpenBSD, both host and guest.
This commit is contained in:
parent
469c4a106b
commit
9547d6b422
1 changed files with 13 additions and 0 deletions
|
@ -3309,6 +3309,7 @@ class OpenBSDVirtual(Virtual):
|
|||
- virtualization_role
|
||||
"""
|
||||
platform = 'OpenBSD'
|
||||
DMESG_BOOT = '/var/run/dmesg.boot'
|
||||
|
||||
def get_virtual_facts(self):
|
||||
sysctl_path = self.module.get_bin_path('sysctl')
|
||||
|
@ -3345,6 +3346,18 @@ class OpenBSDVirtual(Virtual):
|
|||
if out.rstrip() == 'QEMU':
|
||||
self.facts['virtualization_type'] = 'kvm'
|
||||
self.facts['virtualization_role'] = 'guest'
|
||||
if out.rstrip() == 'OpenBSD':
|
||||
self.facts['virtualization_type'] = 'vmm'
|
||||
self.facts['virtualization_role'] = 'guest'
|
||||
|
||||
# Check the dmesg if vmm(4) attached, indicating the host is
|
||||
# capable of virtualization.
|
||||
dmesg_boot = get_file_content(OpenBSDVirtual.DMESG_BOOT)
|
||||
for line in dmesg_boot.splitlines():
|
||||
match = re.match('^vmm0 at mainbus0: (SVM/RVI|VMX/EPT)$', line)
|
||||
if match:
|
||||
self.facts['virtualization_type'] = 'vmm'
|
||||
self.facts['virtualization_role'] = 'host'
|
||||
|
||||
class HPUXVirtual(Virtual):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue