Devstack provides a convenient way to quickly deploy Openstack. It can be deployed on a dedicated machine or using virtual machines. If your new to Openstack, it’s a great way to evaluate it. If your a developer then it is also a great way to test your latest features and patches, without having to run a production system.
This is a guide describes setting up Devstack using a Windows 7 laptop. A vagrant file has been provided at the bottom to help automate the process.
Host Computer with the following
- 8 GB RAM
- 20 GB Free Disk Space
- Windows 7 OS
- VirtualBox > 5.X
- Vagrant (optional but useful to automate the deployment)
- Cygwin (optional but useful to allow you to ssh into the VM)
- Fedora 23 iso (if your not using vagrant, then you’ll need the ISO to perform a basic install)
Devstack will run in a Fedora 23 virtual machine using VirtualBox as the hypervisor. This setup will allow you to launch VMs and access them directly from your windows desktop.
We will use two networks
- Host Only
The NAT network is the default in VirtualBox. It provides your VM with external access. All traffic is source NAT’d, providing the VM with access to the outside world. The outside world can only access the VM if port mapping rules are setup.
The Host Only network provides your VM with an interface, that allows you to access the VM from your host computer. This is the interface that you will use to SSH into the VM, as well as connect to any Openstack services.
Create the Host Only Network
Start by creating a host-only network in VirtualBox
- Click on File->Preferences->Network
- Select the ‘Host Only Network‘ Tab
- Click the + icon to add a new network
By default VirtualBox will create a new network, without DHCP. Click on the ‘screw driver’ icon and take note of the IP address. In the example below it is 192.168.173.1
Create the Virtual Machine
From VirtualBox Create a new VM. The VM should have the following configuration:
- 4096 MB RAM
- 40 GB Disk
- NIC 1 – NAT
- NIC 2 – Host Only
- Enter a name and type
- Specify 4096 MB RAM
- Create a new 40GB Disk (VDI and Dynamically Allocated)
- Edit the VM Configuration to enable the second network adapter. Select the host only network you created earlier, and make sure promiscious mode is set to ‘AllowAll’
Install Fedora 23
Download Fedora 23 from here
Attach the ISO to your VM and then start the VM. The VM will boot from the ISO and start the installation process. Follow the wizard accepting the default options.
When the installation is complete, you will need to configure eth1. This is the interface attached to our host only network. Open the VM and login as the root user on the console.
Create the interface file /etc/sysconfig/network-scripts/ifcfg-eth1
Add the following contents to the file
BOOTPROTO=none ONBOOT=yes DEVICE=eth1 IPADDR=192.168.173.100 NETMASK=255.255.255.0
Here we assign the VM the IP 192.168.173.100. This is from the range of the host only network. N.B we currently don’t use DHCP so it’s fine to assign a static address.
Bring up the interface
When devstack is installed, we will access the horizon dashboard using this address.
Time for a quick test
Now is a good time to test your setup is functioning as expected.
If you installed Cygwin on your windows host, then you should open the Cygwin Terminal and try to ssh to your VM
If everything works as expected you can now install Devstack. If you can’t ssh into your VM, see if you can ping it. If you can ping, but not ssh in then you may need to disable the firewall
service firewalld stop
You may also need to install and start the ssh service
dnf install -y openssh-server service sshd start
Add some Swap
It’s not essential to add swap, but I’ve found without it DevStack can easily run out of memory.
First check if a swap has aleady been setup
sudo swapon -s
Swapon will return any existing swaps. If there aren’t any, then create one now.
sudo dd if=/dev/zero of=/swapfile bs=1024 count=4194304 sudo mkswap /swapfile sudo swapon -a
You can make this permant by adding the following to /etc/fstab
/swapfile swap swap defaults 0 0
The installation of Devstack is remarkably simple, but from time to time a few dependencies may go missing. Run the following commands to install devstack. This may take sometime depending on how powerful your system is.
N.B this should be run as a non-root user, who has sudo permissions.
# Install some dependancies sudo dnf install -y git libnghttp2 libnghttp2-devel mod_wsgi facter # Checkout devstack cd ~ git clone https://git.openstack.org/openstack-dev/devstack # Create default local.conf, specifying the PUBLIC_INTERFACE cat << EOF > ~/devstack/local.conf [[local|localrc]] ADMIN_PASSWORD=secret DATABASE_PASSWORD=$ADMIN_PASSWORD RABBIT_PASSWORD=$ADMIN_PASSWORD SERVICE_PASSWORD=$ADMIN_PASSWORD # Replace MySQL with Postgres disable_service mysql enable_service postgresql PUBLIC_INTERFACE=eth1 EOF # Append the IP Address echo "HOST_IP=$(facter ipaddress_eth1)" >> ~/devstack/local.conf # Run Devstack N.B this should be run as a non-root user cd ~/devstack && ./stacks.sh
Once the stack.sh script completes, you should see the following output:
========================= DevStack Component Timing ========================= Total runtime 787 run_process 57 test_with_retry 4 pip_install 112 restart_apache_server 9 wait_for_service 15 yum_install 18 ========================= This is your host IP address: 192.168.173.100 This is your host IPv6 address: ::1 Horizon is now available at http://192.168.173.100/dashboard Keystone is serving at http://192.168.173.100/identity/ The default users are: admin and demo The password: secret
Browsing to http://192.168.173.100/dashboard you should now see the Openstack Horizon dashboard
Setup Default Routing to access VMs from Windows Host
At this point you can create a VM in the demo tenant, and assign it a floating IP. Unfortunately by default you may find that you cannot route traffic to it i.e. ping, or ssh into the VM. This is usually because the default routing rules haven’t been setup on the Windows host.
By default you should have found that Devstack created a public network using the following CIDR 172.24.4.0/24. When you assign a floating IP to a VM it will come from this block.
In order to route to it, you must add the following rule.
- Open windows command and type
route add 172.24.4.0 MASK 255.255.255.0 192.168.173.100
This tells windows to route all traffic for addresses in 172.24.4.0/24 via the gateway 192.168.173.100 i.e. your Devstack VM.
You now have a fully working Openstack environment to play with; Enjoy 🙂