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

IP configured in a private networks is not used #1838

Open
desmax74 opened this issue Jan 15, 2025 · 0 comments
Open

IP configured in a private networks is not used #1838

desmax74 opened this issue Jan 15, 2025 · 0 comments

Comments

@desmax74
Copy link

desmax74 commented Jan 15, 2025

Describe the bug
A clear and concise description of what the bug is.

With
On Fedora 41 with
Vagrant Version: 2.4.3
Vagrant-libvirt (0.12.2)
libvirt 10.6.0
a configuration network in the vagrant file like this:

main_server.vm.box = "generic-x64/rhel9" main_server.vm.network "private_network", address: "192.168.121.60"

and the dhcp behaviour is used
and in the log is visible the message

Waiting for domain to get an IP address... ... INFO wait_till_up: Got IP address 192.168.121.127

and a random ip is used, 192.168.121.xxx, instead of the static ip configured

could be related to fog/fog-libvirt@97450dd and is needed a different way to configure a static ip ?

To Reproduce
Configure a private network with an ip, the vagrant instance will receive a different ip

Expected behavior
Is expected to honor the configuration with the static ip configured
instead in the log:


 INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::SetBootOrder:0x00007f2d5335df68>
 INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::StartDomain:0x00007f2d53777fe0>
 INFO start_domain: Using vagrant-libvirt at 192.168.121.0/24 as the management network nat is the mode
DEBUG start_domain: In config found network type private_network options {:ip=>"192.168.121.60", :protocol=>"tcp", :id=>"541f3de1-b474-4c9a-83c4-e0c31c596af7"}
DEBUG start_domain: In config found network type forwarded_port options {:guest=>80, :host=>8080, :protocol=>"tcp", :id=>"tcp8080"}
DEBUG start_domain: In config found network type forwarded_port options {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :protocol=>"tcp"}
DEBUG start_domain: Adapter not specified so found slot 0
DEBUG start_domain: Found network by name
DEBUG start_domain: Adapter not specified so found slot 1
DEBUG start_domain: Found network by ip
....
==> prototype: Waiting for domain to get an IP address...
 INFO wait_till_up: Got IP address 192.168.121.127

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information)::

  • Libvirt version:
  • Vagrant version [Vagrant Version: 2.4.3]:
  • Vagrant flavour [Fedora 41]:
  • Vagrant plugins versions (including vagrant-libvirt) [vagrant-libvirt (0.12.2, global)
    vagrant-registration (1.3.4, global)]:

Debug Log
Attach Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt >vagrant.log 2>&1
vagrant.log

A Vagrantfile to reproduce the issue:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    config.registration.unregister_on_halt = false
    config.registration.username = ENV['NODE_REGISTRATION_USERNAME']
    config.registration.password = ENV['NODE_REGISTRATION_PASSWORD']

    config.vm.define "prototype" do |main_server|
          main_server.vm.box = "generic-x64/rhel9"
          main_server.vm.hostname = "prototype"
          main_server.vm.network "private_network", ip: "192.168.121.60"
          main_server.vm.network "forwarded_port", guest: 80, host: 8080

          main_server.vm.provider "libvirt" do |libvirt|
              libvirt.memory = "8192"
              libvirt.cpus = "8"
          end

          main_server.vm.provision "ansible" do |ansible|
             ansible.verbose = "v"
             ansible.compatibility_mode = "2.0"
             ansible.playbook = "./../../play.yml"
             ansible.galaxy_role_file = "./../../requirements.yml"
           end
      end

end

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

No branches or pull requests

1 participant