Skip to content

Instantly share code, notes, and snippets.

@Dieterbe
Created April 25, 2012 14:47
Show Gist options
  • Save Dieterbe/2490281 to your computer and use it in GitHub Desktop.
Save Dieterbe/2490281 to your computer and use it in GitHub Desktop.
create a numbered virtualbox VM with the right properties to serve as Swift node.
#!/bin/bash
if [ -z "$1" ]; then
echo "pass a number as \$1 (storage nodes are numbered, i.e. 1 and 2)"
exit 2
fi
name="crowbar_swift_$1"
# Create and Register the VM with VirtualBox
VBoxManage createvm --register --name "$name"
# Configure the crowbar_client VM Storage Controllers
VBoxManage storagectl "$name" --name "IDE Controller" --add ide --controller PIIX4 --hostiocache on
VBoxManage storagectl "$name" --name "SATA Controller" --add sata --controller IntelAHCI --sataportcount 16 --hostiocache off
# Create hard disks
VBoxManage createhd --filename ~/VirtualBox\ VMs/"$name"/"$name-main.vdi" --size 5000
VBoxManage createhd --filename ~/VirtualBox\ VMs/"$name"/"$name-stor0.vdi" --size 9000
VBoxManage createhd --filename ~/VirtualBox\ VMs/"$name"/"$name-stor1.vdi" --size 9000
# Configure the settings for the crowbar_client VM
VBoxManage modifyvm "$name" --nic1 hostonly --hostonlyadapter1 vboxnet0 --nictype1 Am79C973 --cableconnected1 on
VBoxManage modifyvm "$name" --nic2 hostonly --hostonlyadapter2 vboxnet1 --nictype2 82545EM --cableconnected2 on
VBoxManage modifyvm "$name" --memory 2048 --ostype 'Ubuntu_64' --ioapic on --rtcuseutc on --cpus 1 --pae off --boot1 net --boot2 disk --chipset piix3 --vram 16
# Attach the bootable Openstack Crowbar ISO to the crowbar_client VM
VBoxManage storageattach "$name" --storagectl "IDE Controller" --device 0 --port 0 --type dvddrive --medium emptydrive
# Attach the hard drives to the crowbar_client VM
VBoxManage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/"$name"/"$name-main.vdi"
VBoxManage storageattach "$name" --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium ~/VirtualBox\ VMs/"$name"/"$name-stor0.vdi"
VBoxManage storageattach "$name" --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium ~/VirtualBox\ VMs/"$name"/"$name-stor1.vdi"
# Start the VM!
VBoxManage startvm "$name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment