def call(env)
env[:ui].info(I18n.t('vagrant_libvirt.remove_stale_volume'))
config = env[:machine].provider_config
fog_pool = ProviderLibvirt::Util::Collection.find_matching(
env[:machine].provider.driver.connection.pools.all, config.storage_pool_name)
@logger.debug("**** Pool #{fog_pool.name}")
name = "#{env[:domain_name]}.img"
@logger.debug("**** Volume name #{name}")
box_volume = ProviderLibvirt::Util::Collection.find_matching(
env[:machine].provider.driver.connection.volumes.all, name)
if box_volume && box_volume.pool_name == fog_pool.name
@logger.info("Deleting volume #{box_volume.key}")
box_volume.destroy
env[:result] = box_volume
else
env[:result] = nil
end
@app.call(env)
end