Class: VagrantPlugins::ProviderKvm::Action::InitStoragePool

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-kvm/action/init_storage_pool.rb

Overview

Initialize storage pool.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ InitStoragePool

Returns a new instance of InitStoragePool.



6
7
8
# File 'lib/vagrant-kvm/action/init_storage_pool.rb', line 6

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-kvm/action/init_storage_pool.rb', line 10

def call(env)
  # Create the storage pool in tmp_path if it doesn't exist
  pool = env[:machine].provider_config.storage_pool
  pool_path = File.join(env[:tmp_path], "/storage-pool")
  env[:machine].provider.driver.init_storage_pool(pool, pool_path)
  env[:machine].provider.driver.activate_storage_pool(pool)

  @app.call(env)
end