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

(BKR-1697) Fix libvirt support #39

Closed
genebean opened this issue Mar 24, 2021 · 1 comment · Fixed by #47
Closed

(BKR-1697) Fix libvirt support #39

genebean opened this issue Mar 24, 2021 · 1 comment · Fixed by #47

Comments

@genebean
Copy link
Contributor

The information below is being transferred from Jira:

Envrionment
Followed this blog post for environment setup

And then ran export BEAKER_HYPERVISOR=vagrant_libvirt

After implementing the following code changes I was able to get the beaker nodes to work as intended with libvirt.

Suggested code changes:
lib/beaker/hypervisor/vagrant_libvirt.rb

def private_network_generator(host)
  unless host['dhcp_ip'].nil? || host['dhcp_ip'].empty?
    dhcp_ip = host['dhcp_ip']
  else
    dhcp_ip = "172.28.128.0"
  end
  private_network_string = "    v.vm.network :private_network, :type => \"dhcp\", :libvirt__network_address => \"#{dhcp_ip}\"\n"
end

and

def shell_provisioner_generator(provisioner_config)
  unless provisioner_config.nil?
    shell_provisioner_string = "    v.vm.provision 'shell', :inline => 'ip route del default', :run => 'always'\n"
  else
    shell_provisioner_string = "    v.vm.provision 'shell', :inline => 'ip route del default', :run => 'always'\n"
  end
end

Description

beaker-vagrant's libvirt support was missing handling networking information. It should defer out to the defaults specified in the vagrant-libvirt plugin if no options are supplied in the nodeset.

Vagrant-libvirt functions differently than the VirtualBox defaults in that it can build a private network via Libvirt's internal private DHCP settings, and then it will establish an IP Masquerade to forward out the VM's traffic to the internet.

Also, the vagrant-libvirt plugin will handle the networking at the time of provisioning and updates to the Libvirt VM's, therefore the Vagrantfile should delete the default routes and let the plugin fix everything up.

@ekohl
Copy link
Member

ekohl commented Mar 24, 2021

For what it's worth, I addressed this in #29 but it looks like it breaks VirtualBox. My approach was to just use the default network and not add a private IP because there's no reason you'd want that except in very specific cases.

@ekohl ekohl linked a pull request May 18, 2021 that will close this issue
@ekohl ekohl closed this as completed in #47 May 18, 2021
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 a pull request may close this issue.

2 participants