Installing the DevStack release of OpenStack on F21

Losely based upon the single machine setup page at http://docs.openstack.org/developer/devstack/guides/single-machine.html. This is the additional steps you really should do if you want to use it.

It assumes you already have a host system configured for running VMs, with a bridged interface you can assign to the DevStack VM, in my examples br0. This post is on getting DevStack running in a VM, not on how to setup bridging so I am not covering setting up bridging here; you should already have it setup if you are already using VMs.

Initial VM setup

Download the latest Fedora 21 Desktop Live CD/DVD from fedoraprject.org
Use the Fedora 21 Live Desktop CD to install an OS into a VM, a sample command is provided below.

  1. customise the disk serial to avoid conflicts with any VMs you already use
  2. customise the console (graphics) port to avoid conflicts with any VMs you already use
  3. customise the MAC address conflicts with any VMs you already use
  4. if you want a virtual disk larger than 30Gb customise that also

As root run the command below, with customisations as noted above

qemu-img create -f qcow2 devstack-fc21.qcow2 30G   # < --- creates a 30Gb virtual disk
virt-install --name devstack-fc21 \
 --virt-type kvm \
 --connect=qemu:///system \
 --ram 4096 \
 --vcpus=1,maxvcpus=2 \
 --description "OpenStack devstack instance" \
 --cdrom=./Fedora-Live-Workstation-x86_64-21-5.iso \
 --os-type=linux \
 --boot cdrom,hd,menu=on \
 --disk=devstack-fc21.qcow2,size=30,format=qcow2,error_policy=enospace,serial=WD-WMAP00000008 \
 --graphics vnc,port=5905 \
 --noautoconsole \
 --noreboot \
 --network bridge=br0,mac=52:54:00:95:5f:bb

Then as any user connect to the VM with the command below (if you changed the port in the install script change here also).

remote-viewer vnc://localhost:5905 --display :0 &

Use the icon on the Live desktop to install to local disk, with the following setup; well you may want to changethe passwords, for my VM I keep it simple.

  1. Disk format should be just swap (size your choice) and / , plus the / filesystem should be ext4 and use all remaining space
  2. create a user named “stack”, password stack
  3. set the root password as “stack”
  4. let the install complete, reboot when prompted at the end of the install

In the rebooted VM, logon as root

  1. vi /etc/selinux/config and set SELINUX to permissive or disabled
  2. use ifconfig to locate the name of your interface card
  3. set a static ip-address suitable for your home network by editing /etc/sysconfig/network-scripts/ifup-eth0 (assuming eth0 was your interface name, if not change eth0 to your interface name in the filename and NAME= parameter), sample contents are below; and the file will already initially exist as a dhcp config if you used the correct interface name
TYPE="Ethernet"
BOOTPROTO="static"
BROADCAST=192.168.1.255
DNS1=127.0.0.1
DNS2=192.168.1.1
GATEWAY=192.168.1.1
IPADDR=192.168.1.172
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="16271b24-6f06-45e8-968d-096ddfa52fa1"
ONBOOT="yes"
HWADDR="52:54:00:95:5F:BB"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
SEARCH=localhost

Reboot the VM again to make sure the ip-address change works.

Install the DevStack implementation

  1. Log into the VM as the root user
  2. enter the command ‘ yum -y install git ‘, if the command fails check /etc/resolv.conf and if needed add the line ‘nameserver 192.168.1.1’ and repeat the yum command (if you have to add the nameserver something is wrong in your network config file
  3. a temporary requirement for package install is adding the stach user to the sudoers file, use the command ‘ echo “stack ALL=(ALL) NOPASSWD: ALL” >> /etc/sudoers ‘
  4. logoff from the root user
  5. Login to the VM as the stack user
  6. enter the command ‘ git clone https://git.openstack.org/openstack-dev/devstack ‘ to install the packages needed (this is where the sudoers entry is needed)
  7. edit devstack/local.conf and customise to suit your network (floating ip-range etc), as a mininimum set the admin password, ip-address of the VMs interface, and the floating ip-range. As always, an example is below
[[local|localrc]]
ADMIN_PASSWORD=mark
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50
FIXED_RANGE=10.31.1.0/24
FLOATING_RANGE=192.168.200.0/25
HOST_IP=192.168.1.172
DEST=/opt/stack
LOGDAYS=3
SCREEN_LOGDIR=$DEST/logs/screen

Once the local.conf is setup, still as the stack user and still in the devstack directory

  1. run the command ‘ ./stack.sh ‘

The ./stack.sh command can take a long time complete as it will download all the repository packages needed for OpenStack to run as well as sample image files etc for devstack (I would recomend allowing it to run overnight, or longer if needed).

Once installed, make it work

The OpenStack environment is running at this point; glance and nova commands will work, you can logon to the web interface to define users and projects, everything looks great right.

Wrong, if you shutdown the VM it all stops working, the rejoin-script.sh will not work unless the additional steps are done, that is because services required for OpenStack to run are either not started on reboot or ones we do not want running are.

So , logoff the stack user, logon as the root user and enter the commands below to ensure that OpenStack services are available again after the rejoin-stack.sh after reboots.

  1. systemctl disable firewalld.service
  2. systemctl enable mariadb.service
  3. systemctl enable httpd.service
  4. systemctl enable rabbitmq-server.service

Also now would be a good time to (optional)

  • edit /etc/sodoers and remove the line added earlier to allow the stack user all sudo access; it is no longer needed unless you want to reclone
  • vi /home/stack/devstack/local.conf, add to the end a line containing RECLONE=no

Once you have done all that reboot again to make sure the mariadb and httpd services start, and the firewalld does not.

Reactivating Devstack/OpenStack after a reboot

This needs to be done after each reboot.

  1. Logon as the stack user
  2. cd devstack
  3. ./rejoin-stack.sh

It should all be available again if you followed all the customisation steps throughout this post.

Post-Install customisation

To let the stack user issue nova and glance commands you need to set environment variables for the stack user (and any other user). For the stack user it is best to issue the commands interactively rather than have them in the user profile (.bashrc) to avoid issues in running the rejoin-stack.sh command.

For the stack user use the commands

source /home/stack/devstack/functions
source /home/stack/devstack/openrc admin
source /home/stack/devstack/eucarc admin

You will want to create your own OpenStack projects and add users to them, I would recomend creating a unix user with the same name as the user that will be added as an OpenStack user in teh stack group; and customise that users profile so it can issue OpenStack commands against the default project for the user. I of course use the user mark :-)… change references to mark to the user you create and marks-projects to the project you will create.
As the root user

NEWUSER=mark
NEWPROJ="marks-projects"
chmod 750 /home/stack   # so new user can run stack environment scripts
useradd -g stack ${NEWUSER}
cat < < EOF >> ~${NEWUSER}/.bashrc
source /home/stack/devstack/functions
source /home/stack/devstack/openrc ${NEWUSER} ${NEWPROJ}
source /home/stack/devstack/eucarc ${NEWUSER} ${NEWPROJ}
EOF

Before logging on as that new user go to http://static-ip-addr-you-chose; logon to OpenStack as the admin user (password is what you set in local.conf before you ran stack.sh); create the new project and when creating the project use the option on the project user field to create the new user matching the unix user you created.

If that is not done when you logon as the new user you created the source commands will fail with authorisation errors as there is no user defined to openstack that can return the requested credentials.

Trouble Shooting

  • the web interface does not load. You either did not disable firewalld or did not enable httpd; or both
  • the glance command, nova command, and wem interface return getway errors. You did not enable the mariadb database
  • the keyboard keymapping is all screwed up; welcome to Fedora 21. Synergy changes @ to omega, a physical console on a F21 machine flips @ and ” around, and various other wierd changes depending on access method to a F21 machine. I have keycode mapping changes I use for the console and synergy but they are not usefull here. Keyboard keys becoming remapped in random ways is a F21 feature I hope they fix one day, but it is not an openstack issue it is a F21 issue

Additionally if you want to allow ssh into a Fedora instance (as well as opening port tcp/22 to it in the instance configuration) when you create the instance in the post configuration options use the below; changing apaswd to a passwork you will remember of course

#cloud-config
password: apasswd
ssh_pwauth: True

The above I required in earlier version of DevStack/OpenStack which had broken the console interface to instances, so allowing direct root login was the only way to get into the instance; it is handy for troubleshooting just don’t allow it on anything publically facing.

Summary

The install instructions at http://docs.openstack.org/developer/devstack/guides/single-machine.html are extremely basic install onto anything. They don’t cover OS specific customisations not should they.

This post is for F21 customisation should I need to redo it all again later. It will produce a stable VM image that works OK after reboots.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in Virtual Machines. Bookmark the permalink.