class Beaker::VagrantLibvirt

Public Class Methods

build_options(options) click to toggle source
# File lib/beaker/hypervisor/vagrant_libvirt.rb, line 27
def self.build_options(options)
  return [] unless options['libvirt']

  options['libvirt'].map { |k, v| "      node.#{k} = '#{v}'" }
end
new(*) click to toggle source
Calls superclass method Beaker::Vagrant::new
# File lib/beaker/hypervisor/vagrant_libvirt.rb, line 4
def initialize(*)
  super

  # This needs to be unique for every system with the same hostname but does
  # not affect VirtualBox
  vagrant_path_digest = Digest::SHA256.hexdigest(@vagrant_path)
  @vagrant_path += '_' + vagrant_path_digest[0..2] + vagrant_path_digest[-3..-1]
  @vagrant_file = File.expand_path(File.join(@vagrant_path, "Vagrantfile"))
end
provider_vfile_section(host, options) click to toggle source
# File lib/beaker/hypervisor/vagrant_libvirt.rb, line 18
def self.provider_vfile_section(host, options)
  "    v.vm.provider :libvirt do |node|\n" +
    "      node.cpus = #{cpus(host, options)}\n" +
    "      node.memory = #{memsize(host, options)}\n" +
    "      node.qemu_use_session = false\n" +
    build_options(options).join("\n") + "\n" +
    "    end\n"
end

Public Instance Methods

provision(provider = 'libvirt') click to toggle source
Calls superclass method Beaker::Vagrant#provision
# File lib/beaker/hypervisor/vagrant_libvirt.rb, line 14
def provision(provider = 'libvirt')
  super
end