Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible fails to detect Nutanix AHV virtualization facts #57732

Closed
jjh74 opened this issue Jun 12, 2019 · 7 comments
Closed

ansible fails to detect Nutanix AHV virtualization facts #57732

jjh74 opened this issue Jun 12, 2019 · 7 comments
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@jjh74
Copy link
Contributor

jjh74 commented Jun 12, 2019

SUMMARY

ansible-2.8.0 doesn't detect virtualization facts when VM is running on Nutanix AHV hypervisor.

ISSUE TYPE
COMPONENT NAME

module_utils/facts/virtual/linux.py

ANSIBLE VERSION
ansible 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Same results with:

ansible 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr  3 2019, 17:26:03) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
CONFIGURATION
HOST_KEY_CHECKING(/home/username/.ansible.cfg) = True
OS / ENVIRONMENT

When VM is running on Nutanix AHV:

  • /sys/devices/virtual/dmi/id/product_name == 'AHV'
  • /sys/devices/virtual/dmi/id/sys_vendor == 'Nutanix'
  • /sys/devices/virtual/dmi/id/bios_vendor == 'SeaBIOS' (SeaBIOS when VM is using BIOS, AFAIK UEFI has different 'bios' vendor).
STEPS TO REPRODUCE

ansible -m setup localhost
...
"ansible_virtualization_role": "NA",
"ansible_virtualization_type": "NA",
...

EXPECTED RESULTS

ansible -m setup localhost should return for example:
...
"ansible_virtualization_role": "guest",
"ansible_virtualization_type": "kvm",
...

ACTUAL RESULTS
...
       "ansible_system_vendor": "Nutanix",
...
        "ansible_virtualization_role": "NA",
        "ansible_virtualization_type": "NA",
...
@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jun 12, 2019
@samdoran
Copy link
Contributor

Did this work in previous versions or Ansible?

needs_info

@samdoran samdoran added waiting_on_contributor This would be accepted but there are no plans to actively work on it. and removed needs_triage Needs a first human triage before being processed. labels Jun 13, 2019
@ansibot ansibot added the needs_info This issue requires further information. Please answer any outstanding questions. label Jun 13, 2019
@jjh74
Copy link
Contributor Author

jjh74 commented Jun 14, 2019

Doesn't seem to work on previous versions:

Tested with rpm packages from releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
ansible 2.6.2
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]:

        "ansible_virtualization_role": "NA",
        "ansible_virtualization_type": "NA",

ansible 2.4.6.0
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

        "ansible_virtualization_role": "NA",
        "ansible_virtualization_type": "NA",

ansible 2.2.3.0 (from releases.ansible.com/ansible/rpm/nightly/stable-2.2/epel-7-x86_64/)

        "ansible_virtualization_role": "NA",
        "ansible_virtualization_type": "NA",

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Jun 14, 2019
@samdoran
Copy link
Contributor

Thank you for the information. I just wanted to verify this isn't a regression. Please submit a PR that adds support for gathering facts on Nutanix AHV, including tests.

@jjh74
Copy link
Contributor Author

jjh74 commented Jun 25, 2019

I just created a PR(#58327). Unfortunately it doesn't include tests, I didn't find any existing unit tests that mock virtual facts. I'll read https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html#testing-units and see if I can come up with unit tests for this.

@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 27, 2019
@jjh74
Copy link
Contributor Author

jjh74 commented Jul 31, 2019

So far I haven't had time to create tests for this. Is the PR ok without tests or are tests required ?

@Akasurde
Copy link
Member

Akasurde commented Dec 9, 2019

Closing this as PR #58327 merged. @jjh74 Thanks for the contribution.

@Akasurde Akasurde closed this as completed Dec 9, 2019
@ansible ansible locked and limited conversation to collaborators Jan 7, 2020
@sivel sivel removed the waiting_on_contributor This would be accepted but there are no plans to actively work on it. label Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

5 participants