Last active
December 21, 2021 14:23
-
-
Save kikitux/38208e1acd41f0c5de0e to your computer and use it in GitHub Desktop.
Vagrant virtualbox shared disks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
give_info = "true" | |
count_shared_disk = 2 | |
size_shared_disk = 10 | |
#path_shared_disk = "/some/path" | |
config.vm.provider :virtualbox do |vb| | |
vb.name = vm_name_db + "." + Time.now.strftime("%y%m%d%H%M") | |
vb.customize ["modifyvm", :id, "--memory", memory_DB_INSTANCES] | |
vb.customize ["modifyvm", :id, "--cpus", num_CORE] | |
vb.customize ["modifyvm", :id, "--groups", "/collab"] | |
#first shared disk port | |
port=2 | |
#how many shared disk | |
(1..count_shared_disk).each do |disk| | |
if path_shared_disk | |
file_to_dbdisk = path_shared_disk + "/racattack-shared-disk" | |
else | |
file_to_dbdisk = "racattack-shared-disk" | |
end | |
if !File.exist?("#{file_to_dbdisk}#{disk}.vdi") | |
unless give_info==false | |
puts "NOTE:on first boot shared disks will be created, this will take some time" | |
puts "ensure there is free space on the current directory for the shared disks" | |
give_info=false | |
end | |
vb.customize ['createhd', '--filename', "#{file_to_dbdisk}#{disk}.vdi", '--size', (size_shared_disk * 1024).floor, '--variant', 'fixed'] | |
vb.customize ['modifyhd', "#{file_to_dbdisk}#{disk}.vdi", '--type', 'shareable'] | |
end | |
vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', port, '--device', 0, '--type', 'hdd', '--medium', "#{file_to_dbdisk}#{disk}.vdi"] | |
port=port+1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment