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

fix: Avoid colliding guest names on libvirt when running multiple kit… #495

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aalmenar
Copy link

This change avoids colllision in guest names on libvirt when using a shared development server, by setting a default_prefix on vagrant-libvirt that names the guest as closely possible as vagrant and hyperv behaviour.

Issues Resolved

Type of Change

fix (non-breaking) as it was throughly tested on our enviroment.

Check List

@aalmenar aalmenar marked this pull request as draft April 3, 2024 14:49
@aalmenar aalmenar marked this pull request as ready for review April 3, 2024 14:50
@@ -126,6 +126,7 @@ Vagrant.configure("2") do |c|
<% config[:customize].each do |key, value| %>
<% case config[:provider]
when "libvirt" %>
p.default_prefix = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if it would be better to modify line 114 to include when "hyperv", "libvirt" to get the same behaviour. Currently this would be the wrong place to put this especially without wrapping it in if key == :default_prefix block as multiple customize parameters for libvirt would then cause this line to get added to Vagrantfile multiple times. Wrapping it with a special key call would also allow for current functionality and make this an optional addition to the machine name.

Copy link
Author

Choose a reason for hiding this comment

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

Line 114 use p.vmname but that afaik is not available on libvirt provider thats why default_prefix was used. Now i understand that if a user overrides using default_prefix it could be duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants