Skip to content

Instantly share code, notes, and snippets.

@MartinPaulo
Last active May 31, 2020 17:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MartinPaulo/654c15b77e0681e4fa5e to your computer and use it in GitHub Desktop.
Save MartinPaulo/654c15b77e0681e4fa5e to your computer and use it in GitHub Desktop.
Devstack IceHouse in a Vagrant box...

Boxing devstack with Vagrant...

The simplest way is to install the latest version of Vagrant Then just follow the instructions given by Christian Berendt in his blog entry: http://www.cberendt.de/2014/04/an-other-vagrant-box-with-devstack-and-ubuntu-14-04/ (you might want to reduce the memory and the number of CPU's, dependent on your hardware - also, don't forget the warning about waiting for 10+ minutes once you have fired the whole thing up)

To install a specific branch of devstack

These are the steps I followed to install the icehouse branch of devstack into a Vagrant controlled VM

# create directory to work in.
mkdir DevStackIceHouse
cd DevStackIceHouse
# add a vagrant box
vagrant box add trusty64 https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
# set up the Vagrantfile
vagrant init trusty64
nano Vagrantfile

Then in the resultant edit window alter the Vagrant file to be as follows:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "trusty64"

  # set up the the network
  config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  config.vm.network "forwarded_port", guest: 6080, host: 8081, host_ip: "127.0.0.1"

  # and the amount of memory and cpu's to use
  config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--memory", "4096"]
      vb.customize ["modifyvm", :id, "--cpus", "2"]
  end

end

Bring the VM up and ssh into it...

vagrant up && vagrant ssh

Once in the VM bring it up to date and install git

sudo apt-get update && sudo apt-get -y install git

Then fetch devstack and change into its directory...

git clone git://git.openstack.org/openstack-dev/devstack && cd devstack

Switch to the icehouse branch

git checkout stable/icehouse

Create a file named localrc and add the following lines to it:

# if you want a specific distro, then uncomment the line below and add it..
# IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
# I wanted ceilomter enabled, hence the following lines
# Enable the ceilometer metering services
enable_service ceilometer-acompute ceilometer-acentral ceilometer-anotification ceilometer-collector

# Enable the ceilometer alarming services
enable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier

# Enable the ceilometer api services
enable_service ceilometer-api

Then fire up devstack

./stack.sh

Provide the requested passwords, etc..

Once up, the dashboard is available from the host computer at http://localhost:8080/. Your users are 'admin' and 'demo', and the password is the one that you provided when answering the stack.sh questions...

In the VM you can source the openrc file to enable credentials for command line tools as the demo user.

source ~devstack/openrc

NB: If you want to be the admin user on the command line, source with 'admin' as an argument

source ~devstack/openrc admin

To stop devstack,

./unstack.sh

To run devstack off line, in openrc add the line (but note that devstack must have been run successfully with Internet access prior to doing this)

OFFLINE=True

To force devstack to update all of the repositories when it runs, in openrc add the line

RECLONE=yes

And if using the command line tools, once you've sourced openrc you can generate a keypair to use as follows

#to generate a keypair to use...
nova keypair-add heat_key > heat_key.priv
chmod 600 heat_key.priv

If you start devstack, sign in via the dashboard, then restart devstack, you might find that your browser still is associated with the old session, hence you get a big django exception when you return to the dashboard. Simply visit http://localhost:8080/auth/logout to clear the old session...

The above is a little out of date when talking about localrc. For more on setting the conf files, see:

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