nsidc / vagrant-vsphere

VMware vSphere provider for Vagrant
Other
607 stars 166 forks source link

Should create the VM target folder only once if it doesn't exist when creating multi VMs #242

Open unklhe opened 7 years ago

unklhe commented 7 years ago

If target path specified by vsphere.vm_base_path doesn't exist, it'll be created automatially, as implemented in #76 . The creation should happen only once, but currently if multi nodes are defined in Vagrantfile then the "Create folder" takes place more than once--not exact the times as the nodes amount, but really takes place more than once.

When "Create folder" takes place more than once, vSphere will throw exception: image

And vagrant will fail to create some VMs.

I guess it's due to multi-threading: when one thread gets the exception it'll stop its following action. A simple solution is to having one more check for the folder to see if it exists when "Create folder" fails.