Skip to content

Scope Vagrant libvirt domains to allow multiple checkouts#494

Open
ehelms wants to merge 1 commit into
theforeman:masterfrom
ehelms:scope-vagrant-libvirt-domains
Open

Scope Vagrant libvirt domains to allow multiple checkouts#494
ehelms wants to merge 1 commit into
theforeman:masterfrom
ehelms:scope-vagrant-libvirt-domains

Conversation

@ehelms
Copy link
Copy Markdown
Member

@ehelms ehelms commented May 5, 2026

Why are you introducing these changes? (Problem description, related links)

I sometimes have 2-3 different directories working at the same time, this change will prevent clashes in those environments.

What are the changes introduced in this pull request?

Use a hash of the absolute working directory path to generate a unique libvirt domain prefix per checkout, preventing collisions when multiple clones or git worktrees deploy Vagrant boxes simultaneously.

Both the libvirt domain name prefix and the VM hostnames are scoped using the prefix, ensuring full isolation between deployments.

How to test this pull request

Steps to reproduce:

  • ./forge vms start
  • vagrant ssh quadlet
  • hostname

Check that the hostname is not quadlet.example.com

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

@ehelms ehelms force-pushed the scope-vagrant-libvirt-domains branch from f74dc9f to 51a8bdd Compare May 5, 2026 18:04
Comment thread Vagrantfile
Comment thread tests/conftest.py
Comment thread tests/conftest.py
Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/test.yml Outdated
@ekohl
Copy link
Copy Markdown
Member

ekohl commented May 19, 2026

Thanks for merging #305. Needs a rebase now.

@ehelms ehelms force-pushed the scope-vagrant-libvirt-domains branch from 51a8bdd to 29075ee Compare May 19, 2026 12:29
Comment thread .github/workflows/test.yml Outdated
Comment thread Vagrantfile
@ehelms ehelms force-pushed the scope-vagrant-libvirt-domains branch from 29075ee to 068523f Compare May 19, 2026 13:46
Comment thread Vagrantfile Outdated
@ehelms ehelms force-pushed the scope-vagrant-libvirt-domains branch from 068523f to 2418c95 Compare May 19, 2026 14:46
Use a hash of the absolute working directory path to generate a unique
libvirt domain prefix per checkout, preventing collisions when multiple
clones or git worktrees deploy Vagrant boxes simultaneously.

Both the libvirt domain name prefix and the VM hostnames are scoped
using the prefix, ensuring full isolation between deployments.

Resolve VM FQDNs dynamically in CI and test fixtures instead of
hardcoding the .example.com domain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ehelms ehelms force-pushed the scope-vagrant-libvirt-domains branch from 2418c95 to d41999e Compare May 19, 2026 19:04
Copy link
Copy Markdown
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

When we merge this, will it break existing checkouts users may have? Should the prefix be opt-in?

Comment thread Vagrantfile

config.vm.provider "libvirt" do |libvirt|
libvirt.management_network_domain = DOMAIN
libvirt.default_prefix = prefix
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it good to keep the foremanctl prefix so they're still grouped?

Suggested change
libvirt.default_prefix = prefix
libvirt.default_prefix = "foremanctl_#{prefix}"

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