Backstory: I'm making a vagrant box for development. All the software and 
services are running inside the vagrant box (Oracle Virtualbox, Centos 7), 
but two things reside outside: the source code and the MySQL DB. The 
reasoning is that these two things should survive a "vagrant 
destroy"/"vagrant up" cycle. But if the developer wants to start a 
completely clean slate, he should be able to simply delete the appropriate 
folders, and Vagrant will create them anew.

The source code is simply mounted as a shared folder and symlinked where it 
need to be inside the system. That works well. I tried to do the same thing 
with the DB - just pointing MySQL at the shared folder - but the world 
falls apart when the machine is suspended/resumed 
<https://dba.stackexchange.com/questions/185711/running-mysql-in-virtualbox-with-data-dir-on-shared-folder-sometimes-results-in>.
 
So I'm trying another approach - add a separate virtual disk for MySQL data.

Unfortunately, virtualbox is being a b*tch about it. When you create a 
virtual disk (VDI), it also assigns it a new UUID and then registers both 
the path and the UUID in its internal storage registry. If a developer 
subsequently deletes the file, trying to recreate the file with "vboxmanage 
createhd" will fail because VirtualBox already has a different file 
registered for that path. Simply placing a new file in that location will 
also fail because the UUIDs won't match. To do anything, I need to issue a 
"vboxmanage closemedium" first which removes it from the registry. 
Unfortunately I cannot just execute that command blindly either, because it 
will fail (and in turn trip up vagrant) if the file does not exist in the 
registry. And as far as I'm aware, there's no way I can query the registry 
from within a vagrant script...

One solution would be to use a new random filename each time, but that 
would seriously pollute the Virtualbox storage registry. Also, virtualbox 
likes to complain about invalid disks in its registry.

Any ideas?

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/00ea994e-a6c0-4d65-be3c-2dc0bb3a3ba6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to