Skip to content

opennebula inventory: add VM ID and VM host to data #8532

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

Merged
merged 16 commits into from
Oct 7, 2024

Conversation

aioue
Copy link
Contributor

@aioue aioue commented Jun 17, 2024

SUMMARY
To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
opennebula.py
ADDITIONAL INFORMATION
                "host": "foo23.host",
                "id": 1234,

##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output

<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

<!--- Please do not forget to include a changelog fragment:
      https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
      No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
      Read about more details in CONTRIBUTING.md.
      -->

##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
      'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request

##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py

##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->

<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
                "host": "foo23.host",
                "id": 1234,
```
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added cloud feature This issue/PR relates to a feature request inventory inventory plugin needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR plugins plugin (any type) labels Jun 17, 2024
@ansibullbot ansibullbot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label Jun 17, 2024
@aioue
Copy link
Contributor Author

aioue commented Jun 17, 2024

Not sure why the tests are failing as I'm not adding a new import for the pyone library...?

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-9 Automatically create a backport for the stable-9 branch labels Jun 17, 2024
@feldsam
Copy link
Contributor

feldsam commented Jun 20, 2024

Hi, problem is, that you added new method which is calling pyone package. To pass test, you need to also update tests to reflect this.

Anyway, for such infromation - host on which is VM running, there is easier method to get this. It is already in VM object, in history records, you just need to get last history record of VM to get host. So no need to do aditional api call and searching for host.

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jun 28, 2024
@ansibullbot ansibullbot removed the stale_ci CI is older than 7 days, rerun before merging label Jul 2, 2024
@aioue
Copy link
Contributor Author

aioue commented Jul 2, 2024

@feldsam updated PR to reflect the new information you provided. It's a very simple PR now!

I'm afraid I don't understand how to fix the tests.

@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jul 12, 2024
@ansibullbot ansibullbot removed the stale_ci CI is older than 7 days, rerun before merging label Jul 17, 2024
@ansibullbot ansibullbot added the stale_ci CI is older than 7 days, rerun before merging label Jul 26, 2024
@ansibullbot ansibullbot added tests tests unit tests/unit and removed stale_ci CI is older than 7 days, rerun before merging labels Aug 21, 2024
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Aug 21, 2024
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed merge_commit This PR contains at least one merge commit. Please resolve! labels Oct 1, 2024
@aioue
Copy link
Contributor Author

aioue commented Oct 1, 2024

Made a mess of that rebase 🤦 I should learn more before trying this again.

@abakanovskii
Copy link
Contributor

Made a mess of that rebase 🤦 I should learn more before trying this again.

haha, same thing happened to me before :)

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Oct 1, 2024
@aioue aioue requested a review from felixfontein October 1, 2024 15:43
@abakanovskii
Copy link
Contributor

there was still a merge commit hanging, now it should be fine

@aioue
Copy link
Contributor Author

aioue commented Oct 1, 2024

Thank you @abakanovskii 🙌

Appreciate your time and skilled help with this.

@ansibullbot ansibullbot removed the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Oct 1, 2024
@felixfontein
Copy link
Collaborator

Looks good to me as far as I can judge this. If nobody objects, I'll merge this on the weekend.

Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (as far as I can tell - not familiar with OpenNebula)

@felixfontein felixfontein changed the title opennebula inventory: add VM id and VM host to data opennebula inventory: add VM ID and VM host to data Oct 2, 2024
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Oct 7, 2024
@felixfontein felixfontein merged commit 24b74cc into ansible-collections:main Oct 7, 2024
141 checks passed
Copy link

patchback bot commented Oct 7, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/24b74cc4b9976dd0e3cacf94316e4d131c409fbf/pr-8532

Backported as #9003

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 7, 2024
* Add VM id and VM host to opennebula inventory data

##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output

<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

<!--- Please do not forget to include a changelog fragment:
      https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
      No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
      Read about more details in CONTRIBUTING.md.
      -->

##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
      'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request

##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py

##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->

<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
                "host": "foo23.host",
                "id": 1234,
```

* Create 8532-expand-opennuebula-inventory-data.yml

* Update opennebula.py

* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml

Co-authored-by: Felix Fontein <[email protected]>

* Add check for empty records and add test

* fix attribute test

* fix attribute test

* fix attribute test

* fix attribute test

* Update plugins/inventory/opennebula.py

Co-authored-by: Felix Fontein <[email protected]>

* update as per guidance

* restore attribute checks

* fix attr

* fix indent

* PR Fixes

* add attribute check in case of empty variable

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Александр Бакановский <[email protected]>
(cherry picked from commit 24b74cc)
@felixfontein
Copy link
Collaborator

@aioue @abakanovskii thanks for your contribution!
@feldsam @russoz thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Oct 7, 2024
…D and VM host to data (#9003)

opennebula inventory: add VM ID and VM host to data (#8532)

* Add VM id and VM host to opennebula inventory data

##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output

<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

<!--- Please do not forget to include a changelog fragment:
      https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
      No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
      Read about more details in CONTRIBUTING.md.
      -->

##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
      'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request

##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py

##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->

<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
                "host": "foo23.host",
                "id": 1234,
```

* Create 8532-expand-opennuebula-inventory-data.yml

* Update opennebula.py

* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml

Co-authored-by: Felix Fontein <[email protected]>

* Add check for empty records and add test

* fix attribute test

* fix attribute test

* fix attribute test

* fix attribute test

* Update plugins/inventory/opennebula.py

Co-authored-by: Felix Fontein <[email protected]>

* update as per guidance

* restore attribute checks

* fix attr

* fix indent

* PR Fixes

* add attribute check in case of empty variable

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Александр Бакановский <[email protected]>
(cherry picked from commit 24b74cc)

Co-authored-by: Tom Paine <[email protected]>
@aioue aioue deleted the patch-1 branch October 8, 2024 20:06
@aioue
Copy link
Contributor Author

aioue commented Oct 8, 2024

@felixfontein possibly silly question, but should the commit message leak email addresses like that?

@felixfontein
Copy link
Collaborator

@aioue that's how GitHub works, if you don't tell it to hide your email address in commit messages. (https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line)

(I'm not sure whether the Co-authored-by: name <email> syntax is GitHub specific or also used elsewhere in the Git ecosystem.)

Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…ons#8532)

* Add VM id and VM host to opennebula inventory data

##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output

<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

<!--- Please do not forget to include a changelog fragment:
      https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
      No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
      Read about more details in CONTRIBUTING.md.
      -->

##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
      'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request

##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py

##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->

<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
                "host": "foo23.host",
                "id": 1234,
```

* Create 8532-expand-opennuebula-inventory-data.yml

* Update opennebula.py

* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml

Co-authored-by: Felix Fontein <[email protected]>

* Add check for empty records and add test

* fix attribute test

* fix attribute test

* fix attribute test

* fix attribute test

* Update plugins/inventory/opennebula.py

Co-authored-by: Felix Fontein <[email protected]>

* update as per guidance

* restore attribute checks

* fix attr

* fix indent

* PR Fixes

* add attribute check in case of empty variable

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Александр Бакановский <[email protected]>
austinlucaslake pushed a commit to austinlucaslake/community.general that referenced this pull request Mar 14, 2025
…ons#8532)

* Add VM id and VM host to opennebula inventory data

##### SUMMARY
<!--- Describe the change below, including rationale and design decisions --> To enable greater use of the inventory, add the ID of the VM, and the hostname of the host the VM is running on to the inventory output

<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

<!--- Please do not forget to include a changelog fragment:
      https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
      No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
      Read about more details in CONTRIBUTING.md.
      -->

##### ISSUE TYPE
<!--- Pick one or more below and delete the rest.
      'Test Pull Request' is for PRs that add/extend tests without code changes. -->
- Feature Pull Request

##### COMPONENT NAME
<!--- Write the SHORT NAME of the module, plugin, task or feature below. --> opennebula.py

##### ADDITIONAL INFORMATION
<!--- Include additional information to help people understand the change here --> <!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->

<!--- Paste verbatim command output below, e.g. before and after your change -->
```paste below
                "host": "foo23.host",
                "id": 1234,
```

* Create 8532-expand-opennuebula-inventory-data.yml

* Update opennebula.py

* Update changelogs/fragments/8532-expand-opennuebula-inventory-data.yml

Co-authored-by: Felix Fontein <[email protected]>

* Add check for empty records and add test

* fix attribute test

* fix attribute test

* fix attribute test

* fix attribute test

* Update plugins/inventory/opennebula.py

Co-authored-by: Felix Fontein <[email protected]>

* update as per guidance

* restore attribute checks

* fix attr

* fix indent

* PR Fixes

* add attribute check in case of empty variable

---------

Co-authored-by: Felix Fontein <[email protected]>
Co-authored-by: Александр Бакановский <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-9 Automatically create a backport for the stable-9 branch cloud feature This issue/PR relates to a feature request inventory inventory plugin plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants