49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
require "vagrant"
|
|
|
|
module VagrantPlugins
|
|
module HyperV
|
|
class Config < Vagrant.plugin("2", :config)
|
|
# The timeout to wait for an IP address when booting the machine,
|
|
# in seconds.
|
|
#
|
|
# @return [Integer]
|
|
attr_accessor :ip_address_timeout
|
|
attr_accessor :memory
|
|
attr_accessor :maxmemory
|
|
attr_accessor :cpus
|
|
attr_accessor :vmname
|
|
|
|
# The default VLAN ID for network interface for the virtual machine.
|
|
#
|
|
# @return [Integer]
|
|
attr_accessor :vlan_id
|
|
|
|
def initialize
|
|
@ip_address_timeout = UNSET_VALUE
|
|
@memory = UNSET_VALUE
|
|
@maxmemory = UNSET_VALUE
|
|
@cpus = UNSET_VALUE
|
|
@vmname = UNSET_VALUE
|
|
@vlan_id = UNSET_VALUE
|
|
end
|
|
|
|
def finalize!
|
|
if @ip_address_timeout == UNSET_VALUE
|
|
@ip_address_timeout = 120
|
|
end
|
|
@memory = nil if @memory == UNSET_VALUE
|
|
@maxmemory = nil if @maxmemory == UNSET_VALUE
|
|
@cpus = nil if @cpus == UNSET_VALUE
|
|
@vmname = nil if @vmname == UNSET_VALUE
|
|
@vlan_id = 0 if @vlan_id == UNSET_VALUE
|
|
end
|
|
|
|
def validate(machine)
|
|
errors = _detected_errors
|
|
|
|
{ "Hyper-V" => errors }
|
|
end
|
|
end
|
|
end
|
|
end
|