Class: VagrantPlugins::XenServer::Action::SetVMParams

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-xenserver/action/set_vm_params.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SetVMParams

Returns a new instance of SetVMParams.



7
8
9
10
# File 'lib/vagrant-xenserver/action/set_vm_params.rb', line 7

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("vagrant::xenserver::actions::set_vm_params")
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-xenserver/action/set_vm_params.rb', line 12

def call(env)
  myvm = env[:machine].id

  if env[:machine].provider_config.pv
    env[:xc].VM.set_HVM_boot_policy(myvm,"")
    env[:xc].VM.set_PV_bootloader(myvm,"pygrub")
  end

  mem = ((env[:machine].provider_config.memory) * (1024*1024)).to_s
  env[:xc].VM.set_memory_limits(myvm,mem,mem,mem,mem)

  @app.call env
end