Suspending and Restarting the OpenStack Cookbook Lab

In our previous post about Installing the OpenStack Cookbook on OSX, we explored the simple first steps needed to get our OpenStack lab environment up and running on OSX. This is OSX specific, but quite similar to the lab being run on Windows and Linux. I will put together a quick post to show how to do the same on Windows and Linux also.

Because we want to manage our resources by bringing the systems down and up on occasion, it is important that we know how to quiesce the lab instances, and to be able to rebuild the lab from scratch when it is already deployed.

Suspending and Restarting your OpenStack Cookbook Lab

Luckily, there’s a blog for that! I had written in the past about how to suspend and resume a number of virtual machines using vagrant and awk here: which will give you the ability to quiesce and to spin up your OpenStack Cookbook lab easily.

Remember that your lab will use resources such as CPU, RAM, and most importantly power. I have been bitten by this in the past where I left a number of virtual instances running in the background while on battery and my laptop did see a rather rapid reduction in battery time as a result.

Deleting the OpenStack Cookbook Lab

There may be events that require you to remove the OpenStack Cookbook lab from your host. This could be to update the code, test some parts of the build, or it could be to correct an issue that may have occurred which is easier to recover from by rebuilding the lab in its entirety.

Removing the OpenStack Cookbook lab from your environment is done easily using the vagrant destroy command while in the home folder of the lab. You will be prompted for each machine as it begins the process of removing the VM:


You can also use the vagrant destroy -f command instead but tread carefully as this command will run without questioning you at all. The -f parameter is an option to force the command without confirmation:


Because this affects the NFS exports that were created to share the /vagrant/ folder to your local host machine, you will be prompted for credentials to remove the NFS attachments:


Once it is all done, you will see the resulting screen as follows:


Once done that, you can simply rebuild the lab by going back to the vagrant up part of the process and you will be back to stacking up the goodness again.

Installing the OpenStack Cookbook on OSX

As an advocate for OpenStack, I am always keen to help give newcomers to the open cloud ecosystem a chance to have a positive learning experience. A great tool for that is the OpenStack Cookbook lab. I’ve been lucky enough to have helped a little along the way as a reviewer for the 2nd edition of the book, and to have done some small code contributions as well.

Luckily, it doesn’t take much to run the OpenStack Cookbook lab, and most importantly, it is free!

You will need to have the following on your Mac in order to run the OpenStack Cookbook lab:

I highlight internet access because you can run the cookbook lab without internet access, but only once it is fully downloaded and built. The lab works great for me during testing when on the road and while disconnected, but we do run a live download of the code and base machines during the setup process.

NOTE:  Once you’ve installed Vagrant, it is highly recommended to also install the vagrant-cachier plugin.  I’ve documented that process here:

Downloading the OpenStack Cookbook code

git clone


Let’s change directory to the OpenStack Cookbook folder with the cd OpenStackCookbook and then we will want to ensure that we are on the stable Kilo branch of the cookbook using git checkout kilo to set the branch:


Now comes the fun part!

Vagrant up

Since you have the Vagrant and VirtualBox all set up on your system and the code is downloaded, it’s time to start up the build of the lab. This is easily done thanks to the magic of automation by using the vagrant up --provider=virtualbox/command:


You will be prompted for credentials during the process of the build at least once as it needs to set up NFS shares to map the /vagrant/ directory from the guest virtual machines to your local host for access the build scripts on the shared folder:


The build takes about 20-30 minutes depending on your internet connection speed and the CPU, memory, and disk performance in your lab host. Once it’s all done building you will see a screen similar to this:


Now it’s time to start up the demo script which will build out the first Neutron router, some floating IP addresses, download a couple of guest instance images to Glance, and spark up a Nova instance. This is done from the console of the controller virtual machine.

First, SSH into the machine from the command line using the vagrant ssh controller command:


Next, we import the openrc file to put some environment variables together which will give us access to the endpoints to run the demo script. That’s done by using the . /vagrant/openrc command:


The last step is to run the demo script which is located in the /vagrant/ folder that’s mapped to your local system with the /vagrant/ command. You will see a bunch of content roll by on the screen and you can scroll up to see all of the commands that were run and the results:


Results will complete with the final command showing an associated floating IP:


Now you open up your browser to access the Horizon dashboard at using the default credentials for the lab which is a username of admin and a password of openstack to log in:


Click on the Projects tab in the left hand pane and then the Instances menu option to see the active instance that was spun up with the demo script:


You now have a two-node OpenStack on KVM lab running and you can dig around to see all of the various features and functionality available.

More OpenStack Cookbook Resources

I will be doing some other posts to show a few nifty ways to use the OpenStack Cookbook lab to learn about the various project features.

Read here on how to suspend and resume your OpenStack Cookbook lab using Vagrant suspend and awk.

That said, there is nothing that makes a better companion to your OpenStack Cookbook lab than the actual guide written by Cody Bunch, Kevin Jackson, and Egle Sigler, which is available here:


You can also read through some great posts at the home site for the book at

Happy Stacking!