[libvirt_manager] Add parent_group key for libvirt layouts#3925
[libvirt_manager] Add parent_group key for libvirt layouts#3925michburk wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
nemarjan
left a comment
There was a problem hiding this comment.
LGTM in general, just some questions.
| {{ | ||
| _cifmw_libvirt_manager_layout.vms | | ||
| dict2items | | ||
| selectattr('value.parent_group', 'defined') | |
There was a problem hiding this comment.
(non-blocking): Since selectattr('value.parent_group', 'defined') only checks key existence, would an explicitly empty value like parent_group: "" slip through here? If so, it would produce a file named -group.yml and a nameless group?
There was a problem hiding this comment.
That'd be an interesting situation, I'll test it and probably end up adding an explicit check for an empty string and fail in that case. Thanks!
There was a problem hiding this comment.
Tested a setup with parent_group: '' and this did indeed create a -group.yml file, added an explicit check: rejectattr('value.parent_group', 'equalto', '') to not create this file. Other parts of this patch treat an empty value as falsey and don't do anything if '' is supplied as a parent group, so rejecting here treats it as if there were no parent group field at all.
If you think parent_group: '' should produce an error early on instead, I wouldn't mind refactoring to handle it that way.
9fbc705 to
35a87eb
Compare
35a87eb to
62f4064
Compare
|
Also added a check to the My testing used two child VM types (compute94 and compute96) both setting parent_group: computes, with no Nemanja's comment prompted me to test a layout with both a regular |
62f4064 to
d202b36
Compare
Allow libvirt layout VM types to declare a parent_group field so that multiple subtypes (e.g. compute94, compute96) are aggregated under a shared inventory group (e.g. computes) while remaining independently targetable via their subtype groups. Changes: - add_vm_to_inventory: add hosts to both subtype and parent groups - generate_networking_data: resolve effective group via parent_group, aggregate sibling amounts into a single networking group-template - all-inventory.yml.j2: emit parent group with children entries Generated-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Michael Burke <michburk@redhat.com>
d202b36 to
8a9d4a5
Compare
Allow VM types to declare a parent_group key. Hosts are added to the parent group at add_host time so that groups like 'computes' are populated before dependent roles check group membership. A parent group inventory file is also written to reproducer-inventory/ for subsequent playbook runs.