Skip to content

Instantly share code, notes, and snippets.

@djoreilly
Last active September 28, 2021 17:30
Show Gist options
  • Save djoreilly/e75e4e1e7e6ed371ef98 to your computer and use it in GitHub Desktop.
Save djoreilly/e75e4e1e7e6ed371ef98 to your computer and use it in GitHub Desktop.
Vagrant with extra disks
Vagrant.configure("2") do |config|
config.vm.box = "trusty"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.hostname = "devstack"
# forward ssh keys from main host - handy for gerrit and github
config.ssh.forward_agent = true
# eth1 will be the primary interface for access to the vagrant box.
# It's plugged into a virtualbox bridge, so its IP can be accessed
# directly from the main host without nat port-forwarding hassle.
# You can configure devstack so OpenStack services listen on this
# address by putting HOST_IP=192.168.2.2 in localrc
config.vm.network :private_network, ip: "192.168.2.2"
# Add eth2 and eth3 - these can be used by Neutron or nova-network
# It's necessary to specify IPs here - but they won't be configured.
config.vm.network :private_network, ip: "192.168.3.2", auto_config: false
config.vm.network :private_network, ip: "192.168.4.2", auto_config: false
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", "4"]
v.customize ["modifyvm", :id, "--memory", "6000"]
# enable serial port just in case vagrant image does not
v.customize ["modifyvm", :id, "--uart1", "0x3F8", 4]
file_to_disk = 'disk2.vdi'
unless File.exist?(file_to_disk)
# 50 GB
v.customize ['createhd', '--filename', file_to_disk, '--size', 50 * 1024]
end
v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
file_to_disk = 'disk3.vdi'
unless File.exist?(file_to_disk)
# 50 GB
v.customize ['createhd', '--filename', file_to_disk, '--size', 50 * 1024]
end
v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 2, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
end
@rfum
Copy link

rfum commented Sep 28, 2021

is it possible to do that via vmdk type disk? does that applies to it too?

@djoreilly
Copy link
Author

is it possible to do that via vmdk type disk? does that applies to it too?

donno, haven't used vagrant in years - this gist is from 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment