Sha256: ef89078acb6f5a6c11e224d33f8922075e38e46a422dd1efbeaacf4cf0755d74

Contents?: true

Size: 856 Bytes

Versions: 6

Compression:

Stored size: 856 Bytes

Contents

require_relative 'box'
require 'rexml/document'

module VagrantMutate
  module Box
    class Kvm < Box
      def initialize(env, name, version, dir)
        super
        @provider_name    = 'kvm'
        @supported_input  = true
        @supported_output = true
        @image_format     = 'qcow2'
        @image_name       = 'box-disk1.img'
      end

      # TODO: implement these methods
      #  architecture, mac_address, cpus, memory
      #  to support converting to providers besides libvirt

      def disk_interface
        domain_file = File.join(@dir, 'box.xml')
        begin
          domain = REXML::Document.new(File.read(domain_file))
          domain.elements['/domain/devices/disk/target'].attributes['bus']
        rescue => e
          raise Errors::BoxAttributeError, error_message: e.message
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-mutate-1.1.0 lib/vagrant-mutate/box/kvm.rb
vagrant-mutate-1.0.4 lib/vagrant-mutate/box/kvm.rb
vagrant-mutate-1.0.3 lib/vagrant-mutate/box/kvm.rb
vagrant-mutate-1.0.2 lib/vagrant-mutate/box/kvm.rb
vagrant-mutate-1.0.1 lib/vagrant-mutate/box/kvm.rb
vagrant-mutate-1.0.0 lib/vagrant-mutate/box/kvm.rb