mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Provider options cpu and memory added. Those are used while creating
a new domain.
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user