Sha256: d7f75d9c4a041adfae488f315a7580cc2bc8dc0b6615896f4793db55e11dce91

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'beaker/hypervisor/vagrant'

class Beaker::VagrantLibvirt < Beaker::Vagrant
  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

  def provision(provider = 'libvirt')
    super
  end

  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

  def self.build_options(options)
    return [] unless options['libvirt']

    options['libvirt'].map { |k, v| "      node.#{k} = '#{v}'" }
  end

  private

  def set_host_default_ip(host)
    # In vagrant-libvirt hosts get a management IP, no need for a default
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-vagrant-0.7.0 lib/beaker/hypervisor/vagrant_libvirt.rb