def call(env)
config = env[:machine].provider_config
fog_pool = ProviderLibvirt::Util::Collection.find_matching(
env[:libvirt_compute].pools.all, config.storage_pool_name)
return @app.call(env) if fog_pool
@logger.info("No storage pool '#{config.storage_pool_name}' is available.")
raise Errors::NoStoragePool if config.storage_pool_name != 'default'
@logger.info("Creating storage pool 'default'")
begin
libvirt_pool = env[:libvirt_compute].client.create_storage_pool_xml(
to_xml('default_storage_pool'))
rescue => e
raise Errors::CreatingStoragePoolError,
:error_message => e.message
end
raise Errors::NoStoragePool if !libvirt_pool
@app.call(env)
end