Sha256: 61fb3d63acc31ced314ec497c54e44554d628fda9610aaeb02c6d6cd2e8762fc

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require_relative 'box'
require 'nokogiri'

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 = File.open(domain_file) { |f| Nokogiri::XML(f) }
          domain.xpath("//*[local-name()='domain']/*[local-name()='devices']/*[local-name()='disk']/*[local-name()='target']").attribute('bus')
        rescue => e
          raise Errors::BoxAttributeError, error_message: e.message
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-mutate-1.2.0 lib/vagrant-mutate/box/kvm.rb