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

[PR #9787/e8e3e5c2 backport][stable-10] Allow Xen Host and/or Xen VM names instead of their UUIDs #9801

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Feb 24, 2025

This is a backport of PR #9787 as merged into main (e8e3e5c).

This is a redo of a previously closed PR where I messed up git rebase and figured it would be quicker to just make a new PR with a fresh branch.
( #9767 )

SUMMARY

Currently the inventory entry names are created exclusively using UUID's as the inventory items name.
Sometimes we would prefer to use the Host/VM names in the inventory so I've added some options to allow adding Hosts/VMs using their names (name_labels) instead of their UUIDs from Xen.

By default UUID's will be used just like how it currently exists.
If you set use_vm_uuids or use_host_uuids to false then names will be used instead.

WHY

Currently since every VM is using UUIDs this means you cannot use host patterns/limits for controlling where your jobs run (as far as I know) and you're stuck using flow controls from tags and other bits of metadata that need to be in your playbooks directly.

Another major benefit to this is if you're using AWX/Tower this will make your dynamic inventory much more easily searchable/usable.

With that in mind there is a glaringly obvious downside to using names which is duplicate names are possible with Xen so this may cause issues as this PR does not currently consider duplicate name handling though there is some logic to append a number count to any duplicate names to get around this.

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

Xen Orchestra

EXAMPLE OUTPUT

pr-9787-xoa_allow_using_names_in_inventory.json

* Allow using Xen Host and/or Xen VM names instead of their UUIDs for inventory

* xen_orchestra inventory plugin allow using vm and host names instead of UUID inventory

* Update changelog fragment with correct PR number

* Set missing inventory attributes in unit test

* Add version_added suggestion as per github comments

* Description update.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e8e3e5c)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport feature This issue/PR relates to a feature request inventory inventory plugin needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) tests tests unit tests/unit labels Feb 24, 2025
@felixfontein felixfontein merged commit 27629b6 into stable-10 Feb 24, 2025
138 checks passed
@felixfontein felixfontein deleted the patchback/backports/stable-10/e8e3e5c2b0d6387cac9f806f37e70c643bc706ae/pr-9787 branch February 24, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport feature This issue/PR relates to a feature request inventory inventory plugin needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants