Class: Vagrant::Ssd::Action::SsdDisk

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/ssd/actions.rb

Constant Summary collapse

VB_Meta =

Creates infix for VBoxManage commands (driver.execute) according to VirtualBox version

VagrantPlugins::ProviderVirtualBox::Driver::Meta.new()
MEDIUM =
'hd'

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SsdDisk

Returns a new instance of SsdDisk.



18
19
20
21
22
23
24
25
26
# File 'lib/vagrant/ssd/actions.rb', line 18

def initialize(app, env)
  @app = app
  @machine = env[:machine]
  @enabled = true
  if @machine.provider.to_s !~ /VirtualBox/
    @enabled = false
    env[:ui].error "Vagrant-ssd plugin supports VirtualBox only."
  end
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vagrant/ssd/actions.rb', line 28

def call(env)

  if @enabled
    
    driver = @machine.provider.driver
    disks = identify_disks(driver)
    
    disks.each do | disk |
      attach_disk(driver, disk)
    end
  end
  
  # Allow middleware chain to continue so VM is booted
  @app.call(env)
  
end