2014-02-15 23:29:16 +00:00
|
|
|
require "vagrant"
|
2014-02-15 23:38:11 +00:00
|
|
|
|
2014-02-15 23:29:16 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module HyperV
|
|
|
|
class Config < Vagrant.plugin("2", :config)
|
2014-02-26 19:12:24 +00:00
|
|
|
# The timeout to wait for an IP address when booting the machine,
|
|
|
|
# in seconds.
|
2014-02-15 23:29:16 +00:00
|
|
|
#
|
2014-02-26 19:12:24 +00:00
|
|
|
# @return [Integer]
|
|
|
|
attr_accessor :ip_address_timeout
|
2015-01-14 14:59:01 +00:00
|
|
|
attr_accessor :memory
|
|
|
|
attr_accessor :maxmemory
|
|
|
|
attr_accessor :cpus
|
|
|
|
attr_accessor :vmname
|
2014-02-15 23:38:11 +00:00
|
|
|
|
2014-02-26 19:12:24 +00:00
|
|
|
def initialize
|
|
|
|
@ip_address_timeout = UNSET_VALUE
|
2015-01-14 14:59:01 +00:00
|
|
|
@memory = UNSET_VALUE
|
|
|
|
@maxmemory = UNSET_VALUE
|
|
|
|
@cpus = UNSET_VALUE
|
|
|
|
@vmname = UNSET_VALUE
|
2014-02-15 23:29:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def finalize!
|
2014-02-26 19:12:24 +00:00
|
|
|
if @ip_address_timeout == UNSET_VALUE
|
|
|
|
@ip_address_timeout = 120
|
|
|
|
end
|
2015-01-14 14:59:01 +00:00
|
|
|
@memory = nil if @memory == UNSET_VALUE
|
|
|
|
@maxmemory = nil if @maxmemory == UNSET_VALUE
|
|
|
|
@cpus = nil if @cpus == UNSET_VALUE
|
|
|
|
@vmname = nil if @vmname == UNSET_VALUE
|
2014-02-15 23:29:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def validate(machine)
|
|
|
|
errors = _detected_errors
|
2014-02-27 07:13:09 +00:00
|
|
|
|
|
|
|
{ "Hyper-V" => errors }
|
2014-02-15 23:29:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|