[libvirt_manager] Add predictable network interface names via --target#3891
[libvirt_manager] Add predictable network interface names via --target#3891holser wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
Conversation
|
[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 |
Assign deterministic TAP device names on the host by passing --target
to virsh attach-interface, so interface names survive VM reboots and
re-creations instead of getting arbitrary vnetN names from libvirt.
Naming convention: {vm_short}p{net_index} (e.g. compute0p0,
controller0p1). Controlled by cifmw_libvirt_manager_predictable_nic_names
(defaults to true).
Jira: OSPRH-29381
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Sergii Golovatiuk <sgolovat@redhat.com>
|
LGTM, asked for a TP. |
| {{ | ||
| (vm_item | default(_clean_vm)) | replace('-', '') | ||
| }} | ||
| _target_dev: >- |
There was a problem hiding this comment.
(praise) Great improvement adding --target for predictable NIC naming.
(Question) : _target_dev is currently computed as (_vm_short ~ 'p' ~ (net_idx|int))[:15]. Because this relies on truncation to satisfy the 15‑char limit, there’s a chance of collisions for VMs with similar prefixes. Just another thing to mention, once net_idx goes to 2+ digits (p9 → p10), the suffix length changes and the truncation point shifts, which increases the chance of two different inputs collapsing to the same 15‑char string.
Would you be up for considering a slightly more collision‑resistant naming scheme that still stays within 15 characters (for example a fixed layout like <vm_prefix><short_hash_of _clean_vm>, using only letters and numbers)? Alternatively, a small guard/assert to catch duplicate targets early could also work nicely.
Assign deterministic TAP device names on the host by passing --target
to virsh attach-interface, so interface names survive VM reboots and
re-creations instead of getting arbitrary vnetN names from libvirt.
Naming convention: {vm_short}p{net_index} (e.g. compute0p0,
controller0p1). Controlled by cifmw_libvirt_manager_predictable_nic_names
(defaults to true).