OpenStack with devstack in Ubuntu

Introduction

To play with OpenStack using devstack, I chose Ubuntu Server 12.04 LTS as the base operating system. To make things even easier, I decided to deploy the complete OpenStack stack inside a virtual machine under VMware (in my case, Fusion). Make sure you enable the following options, which are reachable under Virtual Machine > Settings … > Processors & Memory (tab), section Advanced options:

  • Enable hypervisor applications in this virtual machine: Enables running modern virtualisation applications by providing support for Intel VT-x/EPT inside the virtual machine.
  • Enable code profiling applications in this virtual machine: Enables running modern code profiling applications by providing support for CPU performance monitoring counters inside this virtual machine.

In addition, a custom VMware vmnet3 network interface is being used, configured to do NAT and to use the 192.168.100.0/24 subnet.

The actual deployment of OpenStack will use Neutron for networking and will install Ceilometer for monitoring and instrumentation.

Installing Ubuntu Server

The only relevant part is the partition scheme. I decided to use a 500MiB /boot partition formatted as Ext4, and to create an LVM volume group named cinder-volumes. Make sure this volume group is big enough to store the root file system, plus the swap file and other logical volumes that will be used by Cinder.

Upon a running system, make sure to apply any updates and security fixes and to install some dependencies, like Git:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install git

Network configuration

I prefer to use static IP addresses rather than relying on static leases via DHCP:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  address 192.168.100.10
  netmask 255.255.255.0
  gateway 192.168.100.2
  dns-servers 192.168.100.2

Prepare devstack

First, clone the devstack repository and switch to the proper branch. In this post, the stable/havana branch is used, but feel feee to use something else:

git clone https://github.com/openstack-dev/devstack.git
cd devstack
git checkout stable/havana

Customize devstack

Devstack provides some sane defaults, but I prefer to use Neutron networking and to install Ceilometer. Next, an example of a possible localrc configuration file (which must be placed in the root of the devstack repository):

# MySQL
MYSQL_PASSWORD=nova

# RabbitMQ
RABBIT_PASSWORD=nova

# Keystone
ADMIN_PASSWORD=nova
SERVICE_PASSWORD=nova
SERVICE_TOKEN=nova

# Glance
# Nothing to config

# Nova
disable_service n-net

# Neutron
HOST_IP=192.168.100.10
Q_PLUGIN=ml2
Q_AGENT_EXTRA_OVS_OPTS=(tenant_network_type=local)
OVS_VLAN_RANGE=physnet1
PHYSICAL_NETWORK=physnet1
OVS_PHYSICAL_BRIDGE=br-eth0
enable_service neutron,q-svc,q-agt,q-dhcp,q-meta

# Ceilometer
enable_service ceilometer-acompute,ceilometer-acentral,ceilometer-anotification,ceilometer-collector
enable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier
enable_service ceilometer-api

# Heat
enable_service heat,h-api,h-api-cfn,h-api-cw,h-eng

# Others
LOGFILE=$DEST/logs/stack.sh.log

 Install devstack

# ./stack.sh

This takes a very long time, specially on slow Internet connections.

Post-installation

Remove any bridges created by libvirtd that are not going to be used:

virsh net-destroy default
virsh net-undefine default

Next step is to configure the Open VSwitch interface that will be used to provide access to the real physical network (and to the Internet). The steps to follow are to add the eth0 interface to the br-eth0 bridge:

# ovs-vsctl add-port br-eth0 eth0
# ifconfig br-eth0 promisc up

Then, move the static IP address from the eth0 into the br-eth0 bridge interface:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  up ifconfig $IFACE 0.0.0.0 up
  up ip link set $IFACE promisc on
  down ip link set $IFACE promisc off
  down ifconfig $IFACE down

# The Open VSwitch network interface
auto br-eth0
iface br-eth0 inet static
  address 192.168.100.10
  netmask 255.255.255.0
  gateway 192.168.100.2
  dns-nameservers 192.168.100.2
  up ip link set $IFACE promisc on
  down ip link set $IFACE promisc off

Authentication

In order to easy authentication when using command-line tools in OpenStack, I suggest that you create script files, one for each tenant and user, each one exporting the right environment variables to operate as a particular tenant and user:

# cat keystone-admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=nova
PS1="\u@\h:\w (keystone-$OS_USERNAME)\$ "
source openrc

This file can be sourced anytime you want to operate as that user and tenant:

# source keystone-admin

Configuring a flat network

A flat network is such as that OpenStack instances attached to it share a physical network, using a flat address space. Commonly, this flat network corresponds to a physical LAN segment that usually allows public connectivity or Internet connectivity.

# neutron net-create --tenant-id admin sharednet1 --shared --provider:network_type flat --provider:physical_network physnet1
# neutron subnet-create --tenant-id admin sharednet1 192.168.100.0/24 --gateway 192.168.100.2 --dns-nameserver 192.168.100.2 --allocation-pool start=192.168.100.150,end=192.168.100.200

Allow any traffic to/from the OpenStack instances

From now on, let’s use the “demo” tenant and “demo” user:

# source keystone-demo

The security group of the demo user in the demo tenant will be changed to allow any ingress and egress IP traffic:

# Obtain TenantA's default security group ID
# neutron --os-tenant-name demo --os-username demo security-group-list

# Enable ICMP and TCP ports
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol icmp --direction ingress {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol icmp --direction egress {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol tcp --direction egress --port-range-min 1 --port-range-max 65535 {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol tcp --direction ingress --port-range-min 1 --port-range-max 65535 {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol icmp --direction ingress {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol udp --direction egress --port-range-min 1 --port-range-max 65535 {TenantA security group ID}
# neutron --os-tenant-name demo --os-username demo security-group-rule-create --protocol udp --direction egress --port-range-min 1 --port-range-max 65535 {TenantA security group ID}

References

http://wiki.stackinsider.com/index.php/DevStack_-_Single_Node_using_Neutron_FLAT_-_Havana

http://wiki.stackinsider.com/index.php/Native_Stack_-_Single_Node_using_Neutron_FLAT_-_Havana#Prepare_Tenant_Network

3 thoughts on “OpenStack with devstack in Ubuntu

  1. It’s hard to find your articles in google.
    I found it on 18 spot, you should build quality backlinks , it will help you to increase traffic.
    I know how to help you, just search in google – k2 seo tips

  2. Do you want to copy articles from other pages rewrite them
    in seconds and post on your page or use for contextual backlinks?
    You can save a lot of writing work, just type in gogle:
    rheumale’s rewriter

  3. You write that you installed everything in a VMWare virtual machine.
    It would be great to outline which commands are to be executed inside the machine and which on the host…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s