Sha256: 8adbb8afd672421ff6b5515c0cfaaed635a84d4caa24a7112097cab50114be6e

Contents?: true

Size: 971 Bytes

Versions: 20

Compression:

Stored size: 971 Bytes

Contents

require 'beaker/hypervisor/vagrant'

class Beaker::VagrantLibvirt < Beaker::Vagrant
  @memory = nil
  @cpu    = nil

  class << self
    attr_reader :memory
  end

  # Return a random mac address with colons
  #
  # @return [String] a random mac address
  def randmac
    "08:00:27:" + (1..3).map{"%0.2X"%rand(256)}.join(':')
  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" +
      build_options_str(options) +
      "    end\n"
  end

  def self.build_options_str(options)
    other_options_str = ''
    if options['libvirt']
      other_options = []
      options['libvirt'].each do |k, v|
        other_options << "      node.#{k} = '#{v}'"
      end
      other_options_str = other_options.join("\n")
    end
    "#{other_options_str}\n"
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
beaker-vagrant-0.6.2 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.6.1 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.6.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.5.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.4.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.3.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.2.1 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.2.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.1.1 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-vagrant-0.1.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.20.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.19.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.18.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.17.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.16.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.15.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.14.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.13.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.12.0 lib/beaker/hypervisor/vagrant_libvirt.rb
beaker-3.11.0 lib/beaker/hypervisor/vagrant_libvirt.rb