mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #388 from electrofelix/fix-parallel-up
Fixes #387: Break from mutex synchronize before calling next action
This commit is contained in:
commit
65f14f4fe6
@ -37,9 +37,12 @@ module VagrantPlugins
|
||||
env[:box_volume_name] = env[:machine].box.name.to_s.dup.gsub("/", "-VAGRANTSLASH-")
|
||||
env[:box_volume_name] << "_vagrant_box_image_#{env[:machine].box.version.to_s rescue ''}.img"
|
||||
|
||||
# while inside the synchronize block take care not to call the next
|
||||
# action in the chain, as must exit this block first to prevent
|
||||
# locking all subsequent actions as well.
|
||||
@@lock.synchronize do
|
||||
# Don't continue if image already exists in storage pool.
|
||||
return @app.call(env) if ProviderLibvirt::Util::Collection.find_matching(
|
||||
break if ProviderLibvirt::Util::Collection.find_matching(
|
||||
env[:libvirt_compute].volumes.all, env[:box_volume_name])
|
||||
|
||||
# Box is not available as a storage pool volume. Create and upload
|
||||
|
@ -14,14 +14,16 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def call(env)
|
||||
@@lock.synchronize do
|
||||
# Get config options.
|
||||
config = env[:machine].provider_config
|
||||
# Get config options.
|
||||
config = env[:machine].provider_config
|
||||
|
||||
# while inside the synchronize block take care not to call the next
|
||||
# action in the chain, as must exit this block first to prevent
|
||||
# locking all subsequent actions as well.
|
||||
@@lock.synchronize do
|
||||
# Check for storage pool, where box image should be created
|
||||
fog_pool = ProviderLibvirt::Util::Collection.find_matching(
|
||||
break if 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.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user