Total Pageviews

Wednesday, 5 October 2016

Instant live openstack

Instant live openstack with vagrant, ansible and devstack.

Vagrant Ansible Devstack

Quick Start
This project provides a simple way to build an instant openstack developing environment through devstack.
You should have the following installed:
Then you should have a vagrant base box, I recommend precise64:
vagrant box add precise64 --provider virtualbox
Commercial Time: I myself use a vagrant hackerbox, which provides a really comfortable working environment.
vagrant box add hackerbox_precise64 --provider virtualbox
After all the prerequisities met, you can boot an instant openstack developing environment:
git clone
cd vagrant-ansible-devstack
vagrant up
Note that, there may be some errors due to network, pip/apt mirror, devstack bugs, be patient, please. If you’re a lazy guy. I’ve already built a devstack box for you. Just download the box from here, add it to your vagrant box list:
vagrant box add devstack
Modify some parameters in your Vagrantfile, ensure that you have as the private network ip for your box. Then
$ vagrant up --no-provision
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:
Welcome to your Vagrant-built virtual machine.
Last login: Fri Nov 22 09:22:37 2013 from
vagrant@precise64:~$ cd devstack/
vagrant@precise64:~/devstack$ ./
If you want to make cinder work in your local box, you need to add an extra virtualbox disk, and then issue some LVM commands like this:
sudo pvcreate /dev/sdb
sudo vgcreate stack-volumes /dev/sdb
Internally, this box contains code from openstack master branch till date Oct 28 2013. You may need do some git pull origin master to update your code. For simplicity, this box set up dev environment based on localrc.basic, which means it doesn’t contain OpenStack heat, ceilometer, and neutron.

You can set some basic options in devstack.yml, such as:
  • Which openstack branch you want to clone? master or stable/grizzly?
  • Where you can get the openstack code? Through github or you company’s internal github mirror?
  • Do you want do git pull the code each time you redo
Personally, I recommend you use a stable/xxx branch for the first time, since the master branch may have some really weird bugs, which may make you disgusting.
This project also provide two devstack localrc template:
  • localrc.basic enable basic openstack service, including nova, cinder, glance, keystone and horizon, requires at least 1GB RAM.
  • localrc.full beyond basic openstack service, enable quantum, heat, ceilometer, you’d better give the vm 2GB RAM.
I recommend you use localrc.basic as the starting point.
You can also do something else through a hook, such as:
  • change the default apt source.list to boost you apt-get
  • change default devstack options, etc.

Bonus Tips
  • Use virtualbox snapshot if possible to keep a clean, working environment.
  • Use to restart openstack service instead of

For Chinese Users
Chinese user have a really difficult environment to do openstack development due to the poor network and the fucking Great Fire Wall. So I built a openstack git mirror:
Hope it helps. And another weird problem is pip, which often ends with a Connection Timeout error during devstack My workaround here: