Provider options cpu and memory added. Those are used while creating

a new domain.
This commit is contained in:
pradels
2013-04-11 17:03:24 +02:00
parent e98c64c0be
commit 076e7dd8f5
3 changed files with 47 additions and 12 deletions

View File

@@ -13,11 +13,13 @@ module VagrantPlugins
end
def call(env)
# Get config.
config = env[:machine].provider_config
# Gather some info about domain
# TODO from Vagrantfile
@name = env[:domain_name]
@cpus = 1
@memory_size = 512*1024
@cpus = config.cpus
@memory_size = config.memory*1024
# TODO get type from driver config option
@domain_type = 'kvm'

View File

@@ -22,6 +22,10 @@ module VagrantPlugins
# be stored.
attr_accessor :storage_pool_name
# Domain specific settings used while creating new domain.
attr_accessor :memory
attr_accessor :cpus
def initialize
@driver = UNSET_VALUE
@host = UNSET_VALUE
@@ -29,15 +33,23 @@ module VagrantPlugins
@username = UNSET_VALUE
@password = UNSET_VALUE
@storage_pool_name = UNSET_VALUE
# Domain specific settings.
@memory = UNSET_VALUE
@cpus = UNSET_VALUE
end
def finalize!
@driver = 'qemu' if @driver == UNSET_VALUE
@host = nil if @host == UNSET_VALUE
@driver = 'qemu' if @driver == UNSET_VALUE
@host = nil if @host == UNSET_VALUE
@connect_via_ssh = false if @connect_via_ssh == UNSET_VALUE
@username = nil if @username == UNSET_VALUE
@password = nil if @password == UNSET_VALUE
@storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
# Domain specific settings.
@memory = 512 if @memory == UNSET_VALUE
@cpus = 1 if @cpus == UNSET_VALUE
end
def validate(machine)