You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/lib/ansible/module_utils
Rick Elrod 707458cc8c
Make netbsd virtualization facts more specific (#70467)
Change:
Our handling of NetBSD virtualization facts led to facts that were just
plain incorrect. One example is reporting Xen even when the system is
running on something completely different (like KVM).

As stated by the reporter of #69352, NetBSD has a better sysctl setting
to use for this information, machdep.hypervisor.

This PR does the following:

- Try to use machdep.hypervisor sysctl value if the other sysctl values
  we check don't end up with enough information to be useful
- Only look for /dev/xencons and assume Xen if nothing else works
  (Really this should probably return 'unknown' since the file exists on
  non-Xen systems and is not very useful).
- Add a few more patterns (Xen matches and also Hyper-V) to
  VirtualSysctlDetectionMixin#detect_virt_product.

This change is slightly breaking:
- If the first two attempts at using sysctl worked before,
  (machdep.dmi.system-product and machdep.dmi.system-vendor), they will
  continue to work.
- For cases when those values didn't work, previously the existence of
  /dev/xencons was checked, and if found, we reported 'xen' (even on
  non-Xen systems when the file existed). After this PR, we try the
  machdep.hypervisor sysctl key before still falling back to
  /dev/xencons. This means that in some cases, we might go from
  (wrongly) saying "xen" to giving a more accurate value such as "kvm"
  or "Hyper-V".

Test Plan:
- Tested with local NetBSD VM and got 'kvm' instead of 'xen' back.

Tickets:
- Fixes #69352

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
..
common Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
compat Fix filedescriptor out of range in select() when running commands (#65058) 4 years ago
csharp Deprecation revisited (#69926) 4 years ago
distro Update bundled version of distro from 1.4.0 to 1.5.0 (#69709) 4 years ago
facts Make netbsd virtualization facts more specific (#70467) 4 years ago
parsing Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
powershell Ansible.Basic added generic fragment merger for module options (#69719) 4 years ago
six Updated bundled libraries (#70418) 4 years ago
__init__.py Enhance empty __init__ code-smell to check module_utils (#33438) 7 years ago
_text.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
ansible_release.py [AWS] Add Ansible Version to botocore user agent string (#39993) 6 years ago
api.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
basic.py Fix string/bytestring comparsion in m_u.basic (#70439) 4 years ago
connection.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
json_utils.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
pycompat24.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
service.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
splitter.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
urls.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
yumdnf.py Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago