Class: VagrantPlugins::LibcloudHelper::Action::AllocateSataPorts

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-libcloud-helper/action/allocate_sata_ports.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ AllocateSataPorts

Returns a new instance of AllocateSataPorts.



6
7
8
9
# File 'lib/vagrant-libcloud-helper/action/allocate_sata_ports.rb', line 6

def initialize(app, env)
  @app = app
  @machine = env[:machine]
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-libcloud-helper/action/allocate_sata_ports.rb', line 11

def call(env)
  return @app.call(env) if @machine.state.id != :poweroff && [:up].include?(env[:machine_action])

  numports = env[:machine].config.libcloud_helper.allocate_sata_ports
  if numports > 0
    env[:ui].info "Allocating SATA ports"
    env[:machine].provider.driver.allocate_sata_ports numports
  end

  @app.call(env)
end