OpenStack Essex and Quantum Installation using OpenvSwitch from Scratch

Here is a walkthrough for the Quantum Network Manager Plugin for OpenStack. It is still in dev so expect weird things and stability issues. For a guy with a networking bread and butter this is the extremely exciting piece of OpenStack for me. I will do a followup and try and breakdown the OpenvSwitch components but the data path is using the same call into the kernel as of 3.2 as Linux bridging is so the performance is in the kernel. It has a control plane component in the way of an OpenFlow controller which executes in user land which has incredible potential. This is Nicira’s pony.  I used some of the StackOps guide and scripts for this, great work everyone is doing here.

 

 

 

 

 

 

 

 

 

Figure 1. Two NICs on a host. Note* If you have one NIC you can use a vNIC i.e. eth0 & eth0:1

System Dependency Preparations

The Host looks like this.
$apt-get update

/*If not FQDN
$nano /etc/hosts

127.0.0.1	localhost
127.0.1.1 	openstack1

$apt-get install ntp

/*Edit the NTP config to survive an Internet/Network outage:
$nano /etc/ntp.conf

server ntp.ubuntu.com iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

/*Restart the service
$service ntp restart

/*More packages
$apt-get install tgt
$apt-get install open-iscsi open-iscsi-utils
$apt-get install bridge-utils

/*Restart Networking
$/etc/init.d/networking restart

$apt-get install rabbitmq-server memcached python-memcache
$apt-get install kvm libvirt-bin
$apt-get install -y mysql-server python-mysqldb

/* Log into MySQL
$mysql -u root -p

/*Create the Nova database with a password ‘password’
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'password';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password';
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'password';
CREATE DATABASE ovs_quantum;
GRANT ALL PRIVILEGES ON ovs_quantum.* TO 'ovs_quantum'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

/*Edit my.cnf
$nano /etc/mysql/my.cnf

/*from
bind-address = 127.0.0.1
/*to
bind-address = 0.0.0.0

/*Restart mysql
$/etc/init.d/mysql restart

KeyStone Identity Management

/*More packages
$apt-get install keystone python-keystone python-keystoneclient

/*Edit keystone.conf
$nano /etc/keystone/keystone.conf

/*Replace or comment this:
connection = sqlite:////var/lib/keystone/keystone.db
/*With this:
connection = mysql://keystone:password@128.163.188.8:3306/keystone
/* Change ‘admin_token’ FROM
#bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
admin_token = ADMIN
/*TO
#bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
admin_token = password

/*Change the catalog values FROM:

[catalog]
driver = keystone.catalog.backends.sql.Catalog
TO:
[catalog]
# driver = keystone.catalog.backends.sql.Catalog
driver = keystone.catalog.backends.templated.TemplatedCatalog
template_file = /etc/keystone/default_catalog.templates

/*Restart Keystone
$service keystone restart
/*Synch Keystone to MySQL.
$ keystone-manage db_sync

/* Edit keystone_data.sh to have the proper password and token
ADMIN_PASSWORD=${ADMIN_PASSWORD:-password}
SERVICE_PASSWORD=${SERVICE_PASSWORD:-$ADMIN_PASSWORD}
export SERVICE_TOKEN="password"
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}

/*Save and run the keytone.sh script.
$chmod +x keystone.sh
$./keystone.sh

/*This should return a ‘0’ for success.
$echo $?

/* Restart Keystone
$/etc/init.d/keystone restart

/*Install Glance packages
$apt-get install glance glance-api glance-client glance-common glance-registry python-glance

/* Go ahead and add these to the end of /root/.bashrc

export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export OS_AUTH_KEY=password

/*Then refresh the shell. You can also use source novarc but keep it simple to start.
$bash

Glance Image Management

/etc/glance/glance-registry-paste.ini (privs)
/etc/glance/glance-api-paste.ini (privs)
/etc/glance/glance-registry.conf (sql conn and flavor)
/etc/glance/glance-api.conf (flavor)

/*Change the values to match below at the bottom of glance-registry-paste.ini
$nano /etc/glance/glance-registry-paste.ini

admin_tenant_name = admin
admin_user = admin
admin_password = password

/*Change the values to match below at the bottom of glance-api-paste.ini
$nano /etc/glance/glance-api-paste.ini
admin_tenant_name = admin
admin_user = admin
admin_password = password

$nano /etc/glance/glance-registry.conf

/*Adjust mysql with privileges
$nano /etc/glance/glance-registry.conf

sql_connection = mysql://glancedbadmin:password@128.163.188.8/glance
/*and add this to the bottom of the file
[paste_deploy]
flavor = keystone

/*Add flavors to /etc/glance/glance-api.conf at the bottom
$nano /etc/glance/glance-api.conf

[paste_deploy]
flavor = keystone

/* Restart for funzys
$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

/* Version control fix for 12.04
$glance-manage version_control 0
/*If you get errors on the following db_sync verify your variable by typing ‘export’.
$glance-manage db_sync

/* Again for good measure
$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

/* 11.10 image
wget http://uec-images.ubuntu.com/releases/11.10/release/ubuntu-11.10-server-cloudimg-amd64-disk1.img

/* 12.04 image
wget https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img

$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

/*List Images
$glance index (Should be empty)

/* Add images to Glance
$glance add name="Ubuntu 11.10" is_public=true container_format=ovf disk_format=qcow2 < ubuntu-11.10-server-cloudimg-amd64-disk1.img 

/*Uploading image 'Ubuntu 11.10'
==========================================================================================[100%] 167.139407M/s, ETA  0h  0m  0s
Added new image with ID: 3a2404f6-0a4f-44db-b1cd-a81401dd6015
*/
$glance add name="Ubuntu 12.04" is_public=true container_format=ovf disk_format=qcow2 < precise-server-cloudimg-amd64-disk1.img

Uploading image 'Ubuntu 12.04'
==========================================================================================[100%] 143.583705M/s, ETA  0h  0m  0s
Added new image with ID: 92ca562e-bb18-425a-94ac-eb292fbcabec
*/

/* If your image is well above 220Mb you have the wrong image and not a Ostack compatible one.
$glance index

Nova Installation

$apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-vncproxy nova-volume
$apt-get install nova-consoleauth novnc python-nova python-novaclient novnc

/*Add to /etc/libvirt/qemu.conf at the top.
/*If you copy/paste make sure the quotes are not formatted from browser

clear_emulator_capabilities = 0
user = "root"
group = "root"
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet", "/dev/net/tun",
]

/* Edit /etc/nova/api-paste.ini and add

admin_tenant_name = admin
admin_user = admin
admin_password = password

/* Fix Permissions (if still needed in your release)
chown -R nova:nova /etc/nova

/*sync with mysql
$nova-manage db sync

/* UP/Down Startup Script

for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" stop; done 
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" start; done
$chmod +x

/* Edit /etc/nano.conf Pull files from Github and replace.

Install Quantum Network Plugin

$apt-get install -y quantum-server quantum-plugin-openvswitch
$apt-get install -y openvswitch-datapath-source
$apt-get install module-assistant

/*Add OVS DP module
$module-assistant auto-install openvswitch-datapath

/*Change the default plugin for Quantum in /etc/quantum/plugins.ini

[PLUGIN]
provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin

Install OpenvSwitch

$apt-get install -y openvswitch-switch quantum-plugin-openvswitch-agent

/*Load the ovs module:
$modprobe openvswitch_mod

/*Add to the module startup file:
$echo “openvswitch_mod”>>/etc/modules

/*Edit /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini and change the SQL

connection FROM:
sql_connection = sqlite://
TO
sql_connection = mysql://ovs_quantum:password@128.163.188.8:3306/ovs_quantum

Copy “quantum-agent.sh” to /etc/init.d. directory download-script here

/*Make executable
$chmod +x /etc/init.d/quantum-agent.sh

/*Add to startup directories:
$update-rc.d quantum-agent.sh defaults

/*Restart
$/etc/init.d/quantum-server start

/* Create an OVS “integration” bridge, to which all VMs will connect:
$ovs-vsctl add-br br-int

/*If you want to tie your machine to a physical interface which I am in this.
/*That adds our connector bridge to an interface.

/*Warning- do not add two physical interfaces unless they are bonded or you may be explaining a bridging loops to your VP the next morning. I highly recommend something like BPDUguard on your interfaces connecting you OpenStack nodes to protect the network and cranky network guys.

$ ovs-vsctl add-port br-int eth0

/*Start with the ‘&’ to run in bg.
$/etc/init.d/quantum-agent.sh &

/*One more reboot for good measure

for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" stop; done 
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" start; done

/*Check Services
$nova-manage service list
4nova-manage network list

/*Should see something along these lines:

$ ps -ea | grep nov
11176 ?        00:00:03 nova-cert
14282 ?        00:00:00 nova-network
14293 ?        00:00:00 nova-compute
14303 ?        00:00:01 nova-api
14313 ?        00:00:00 nova-objectstor
14323 ?        00:00:00 nova-scheduler
14353 ?        00:00:00 nova-xvpvncprox
$ps –ea | grep libvirt
pre>2665 ?        00:00:00 libvirtd

/*Good
$nova-manage service list
Binary           Host                                 Zone             Status     State Updated_At
nova-scheduler   openstack-dev                             nova             enabled    :-)    2012-05-10 06:39:29
nova-compute     openstack-dev                             nova             enabled    :-)    2012-05-10 06:39:09
nova-network     openstack-dev                              nova             enabled    :-)    2012-05-10 06:39:29
/*Bad most of the time. Compute can come in and out of that state and recover. 
/*I have never seen network recover, it is normally down hard and time to start scouring the logs.
$nova-manage service list
Binary           Host                                 Zone             Status     State Updated_At
nova-scheduler   openstack-dev                             nova             enabled    :-)    2012-05-10 07:26:29
nova-compute     openstack-dev                            nova             enabled    XXX   2012-05-10 07:19:20
nova-network     openstack-dev                             nova             enabled    XXX   2012-05-10 07:21:06

/*Add your vNIC “Flat Network” as defined in nova.conf
/*Note the difference from the nova-network creation with Quantum Manager.
$ nova-manage network create –label=public –fixed_range_v4=172.31.252.0/24

/*To delete files you need to use the ID found in ‘nova-manage network list’

$nova-manage network delete –uuid 6ec716d0-1b22-497e-be6c-2017b268af1d <–ID

/*(Optional) Create a floating pool. Can be any address you want to assign. Essentially NAT.
/*Quantum Manager uses the same ‘nova-manage floating’ command.
$nova-manage floating create –ip_range=128.163.188.240/28

/*Floating Commands (Optional)
$nova-manage floating list
$nova-manage floating create 128.163.188.248/29

/*Virtual Machines from CLI-Skip if only interested in dashboard.
/*Make sure your nova db has been synced if you skip:

/*If not synced or sure if synced, sync.
$nova-manage db sync

/*Iptables is e.g. ‘ nova secgroup-add-rule ‘ is not supported in OpenvSwitch v1.4

/*Create security keys
$ nova keypair-add ssh_key > ssh_key.pem

/*Set Permissions
$chmod 0600 ssh_key.pem
$ssh -i ssh_key.pem ubuntu@172.31.248.2
/*e.g.
$ssh -i ssh_key.pem ubuntu@

/*One more reboot for good measure

for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" stop; done 
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" start; done

/*List your images
$glance index
/*List or edit your flavors
$nova flavor-list

/*If things get squirrely on you restart everything.
/etc/init.d/quantum-server restart
./restart-nova.sh <scripted>

/*Boot a VM from CLI or skip to the Dashboard frontend.
/*Ubuntu 11.10
$nova boot –flavor 1 –image 3a2404f6-0a4f-44db-b1cd-a81401dd6015 –key_name ssh_key dem11.10
/* Ubuntu 12.04
$nova boot –flavor 1 –image 92ca562e-bb18-425a-94ac-eb292fbcabec –key_name ssh_key demo12.04

/*Windows 2008 R2
$nova boot –flavor 1 –image 13fdbdb7-0800-4c70-9b6a-73656ca62432 –key_name ssh_key demoWin2k8

Quicky on building a windows image
/*Create the raw logical disk
kvm-img create -f raw windowsserver.img 20G
/*Boot windows iso along with
kvm -m 1024 -cdrom win2k8_dvd.iso -drive file=windowsserver.img,if=virtio,boot=on -fda virtio-win-1.1.16.vfd -boot d -nographic -vnc :0

/*Here is the command used for this image using the virtio iso.

kvm -smp 2 -m 2048 -no-reboot -boot order=d -drive file=win2k8r2_dc.img,if=virtio,boot=off -drive file=windows2k8_dvd.iso,media=cdrom,boot=on -drive file=virtio-win-0.1-22.iso,media=cdrom,boot=off -net nic,model=virtio -nographic -vnc :1

/*Watch your machine boot or error ☺
$nova show demo1

/*View all VMs in your Project (Project you have creds in ENV for only)
$nova list

Some quick commands to start leveraging a true vSwitch as opposed to Linux bridging.

ovs-vsctl list sflow
ovs-ofctl dump-flows
ovs-dpctl dump-flows br0
ovs-vsctl list-br
ovs-vsctl list-ports
ovs-vsctl show
ovs-dpctl show

ovs-ofctl dump-tables br-int
ovs-appctl fdb/show br-int


Figure 2. Example of the Data Path flow dump from ‘ovs-dpctl show br-int’.

Networking command outputs.

/*Notice there are not any bridges defined in /etc/network/interfaces. I was guessing the brcompat_mod.ko kernel was building that but that module isn’t loaded. Must either be loaded into openvswitch_mod.ko or calling brctl. You used to need to unload bridge.ko but I had not used OpenvSwitch since v1.2.

$brctl show
bridge name bridge id STP enabled interfaces br-int 0000.782bcb16b22b no eth0 gw-2f0f9de6-a6 tap027e8414-f6 tap1cac52ac-9f tap2089130c-f6 tap222dd07b-c0 tap2b4b3ce5-10 tap3118ba42-8a tap3be9a323-08 tap46b69b9a-9d tap50320595-90 tap50a61e01-f1 tap534f2d0b-e0 tap535fc0be-15 tap57d53138-87 tap5e2d64ee-cb tap60eff348-6c tap8b77a5eb-a1 tap92315342-89 tap9a5b3f2a-34 tap9ffbdcf6-9e tapa7666617-ae tapb30fc838-f5 tapbde52bbf-34 tapc2d57ab0-b8 tapd11d6b5a-d3 tape010beb0-83 tape93935a1-4d tape9757942-ad tapf1fdbff3-3f tapf3fea029-f9 tapfd620308-16 virbr0 8000.000000000000 yes

/*View the OpenFlow Controller and classifier tables.

$ovs-ofctl dump-tables br-int
OFPST_TABLE reply (xid=0×1): 255 tables 0: classifier: wild=0x3fffff, max=1000000, active=6 lookup=192391, matched=192391

/Show the forwarding tables

$ovs-appctl fdb/show br-int
port VLAN MAC Age 36 1 fa:16:3e:32:fc:72 47 29 1 fa:16:3e:0c:ae:f6 41 33 1 fa:16:3e:46:2b:7d 41 18 1 fa:16:3e:64:fa:1e 39 26 1 fa:16:3e:71:71:ee 35 34 1 fa:16:3e:4b:21:43 33 28 1 fa:16:3e:2d:fb:59 32 15 1 fa:16:3e:10:da:95 32 37 0 00:12:80:b9:a4:d5 31 32 1 fa:16:3e:7c:9f:76 31 17 1 fa:16:3e:63:e3:53 29 5 1 fa:16:3e:16:95:dc 26 20 1 fa:16:3e:46:21:93 25 7 1 fa:16:3e:20:49:9c 19 19 1 fa:16:3e:65:53:39 19 31 1 fa:16:3e:54:e5:af 17 6 1 fa:16:3e:6a:64:da 13 23 1 fa:16:3e:30:78:77 13 25 1 fa:16:3e:11:8a:41 12 14 1 fa:16:3e:49:ac:70 12 35 1 fa:16:3e:61:5c:20 12 24 1 fa:16:3e:08:e5:27 10 21 1 fa:16:3e:25:f2:f4 8 22 1 fa:16:3e:57:bb:aa 4 8 1 fa:16:3e:19:88:48 3 30 1 fa:16:3e:22:fa:28 3 27 1 fa:16:3e:70:33:a4 1 37 0 00:00:0c:07:ac:01 1 16 1 fa:16:3e:39:14:67 0 3 1 fa:16:3e:2c:db:db 0

Dashboard

/*Install packages
$apt-get install libapache2-mod-wsgi openstack-dashboard

/*Restart Apache
$restart apache
$service apache2 restart

/*Connect to the Dashboard web page.
http://localhost or http://x.x.x.x

Posted in OpenStack, OpenvSwitch, quantum | Tagged , , , , | 2 Comments

Troubleshooting Common OpenStack Errors

##############General Tips##############

/*Check all services
$nova-manage service list (check for XXX or smiley face)
Binary Host Zone Status State Updated_At
nova-scheduler openstack1 nova enabled :-) 2012-05-12 22:42:14
nova-compute openstack1 nova enabled :-) 2012-05-12 22:42:12
nova-network openstack1 nova enabled :-) 2012-05-12 22:42:14

$ ps -ea | grep nova
11448 ? 00:02:54 nova-cert
12072 ? 00:02:57 nova-network
12083 ? 00:10:31 nova-compute
12093 ? 00:06:40 nova-api
12117 ? 00:02:26 nova-scheduler
12154 ? 00:00:00 nova-xvpvncprox
55746 ? 00:00:00 nova-objectstor

If you are missing services or an XXX check the logs and look for errors i.e.
nova-compute openstack1 nova enabled XXX 2012-05-12 22:42:12
$tail –n 400 /var/log/nova-compute

################Common Errors##############

Errors:
thon2.7/dist-packages/nova/virt/libvirt/connection.py”, line 338, in _connect
2012-05-09 17:05:42 TRACE nova return libvirt.openAuth(uri, auth, 0)
2012-05-09 17:05:42 TRACE nova File “/usr/lib/python2.7/dist-packages/libvirt.py”, line 102, in openAuth
2012-05-09 17:05:42 TRACE nova if ret is None:raise libvirtError(‘virConnectOpenAuth() failed’)
2012-05-09 17:05:42 TRACE nova libvirtError: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: No such file or directory
012-05-09 22:05:41.909+0000: 12466: info : libvirt version: 0.9.8
2012-05-09 22:05:41.909+0000: 12466: error : virNetServerMDNSStart:460 : internal error Failed to create mDNS client: Daemon not running
Look in:
root@:/home/brent/openstack# cat /var/log/libvirt/libvirtd.log

Solution:
libvirt-bin service will not start without dbus installed.

Make sure dbus is running ps –ea |grep dbus
And
sudo apt-get install lxc

https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/918343

##############################################

Error
Failed to add image. Got error:
The request returned 500 Internal Server Error

Solution:
Fix the OS ENV variables (insert your values from your API configs.)
e.g.
declare -x OS_AUTH_KEY=”openstack”
declare -x OS_AUTH_URL=”http://localhost:5000/v2.0/”
declare -x OS_PASSWORD=”openstack”
declare -x OS_TENANT_NAME=”admin”
declare -x OS_USERNAME=”admin”

###############################################

Error:
2012-05-09 17:58:08 TRACE nova raise exception.InstanceNotFound(instance_id=instance_name)
2012-05-09 17:58:08 TRACE nova InstanceNotFound: Instance instance-00000002 could not be found.
2012-05-09 17:58:08 TRACE nova

either delete the instance in MySQL or drop the database and start a new one

mysql –u root –p
DROP DATABASE nova;

CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO ‘novadbadmin’@'%’
IDENTIFIED BY ‘openstack’;
Quit

Resync
nova-manage db sync
Restart Nova
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service “$a” stop; done
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service “$a” start; done

Regen keys
nova keypair-add ssh_key > ssh_key.pem

re-apply security policy.
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

Add network back. nova-manage add etc.

###############################################

Error
root@openstack-dev-r910:/home/brent/openstack# ./keystone_data.sh
No handlers could be found for logger “keystoneclient.client”
Unable to authorize user
No handlers could be found for logger “keystoneclient.client”
Unable to authorize user
No handlers could be found for logger “keystoneclient.client”
Unable to authorize user

Fix:
Adjust the admin token to be the same as your script

Error:
ERROR: string indices must be integers, not str

Fix
/etc/nova/nova-api.con
Add acocunts at bottom

##############Rebuilding Nova################

Deleting Nova and re-installing along with some of the file locations.
apt-get purge nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-vncproxy nova-volume python-nova python-novaclient

nova-manage project scrub nova (or) drop database nova

mysqlshow –count glance

rm -rf /root/.novaclient/
rm -rf /var/lib/nova
rm -rf /var/lib/mysql/nova
rm -rf /etc/libvirt/nwfilter/nova*

MySQL –u name -r
Drop database nova;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO ‘novadbadmin’@'%’
IDENTIFIED BY ‘openstack’;

killall dnsmasq
service nova-network restart

ps -ea | grep key
ps -ea | grep nova
ps -ea | grep gl root@openstack1:/home/brent/openstack# apt-get install -y mysql-server python-mysqldb mysql-common

ance
ps -ea | grep libv

/var/log/nova/nova-api.log
/var/log/nova/nova-cert.log
/var/log/nova/nova-compute.log
/var/log/nova/nova-dhcpbridge.log
/var/log/nova/nova-manage.log
/var/log/nova/nova-network.log
/var/log/nova/nova-objectstore.log
/var/log/nova/nova-scheduler.log
/var/log/nova/nova-volume.log
/var/log/nova/nova-xvpvncproxy.log
/var/log/upstart/nova-api.log
/var/log/upstart/nova-cert.log
/var/log/upstart/nova-compute.log
/var/log/upstart/nova-network.log
/var/log/upstart/nova-objectstore.log
/var/log/upstart/nova-scheduler.log
/var/log/upstart/nova-vncproxy.log
/var/log/upstart/nova-volume.log
/var/crash/_usr_bin_nova-api.114.crash
/var/crash/_usr_bin_nova-compute.114.crash
/var/crash/_usr_bin_nova-network.114.crash
/var/crash/_usr_bin_nova-objectstore.114.crash
/var/crash/_usr_bin_nova-scheduler.114.crash
/var/crash/_usr_bin_nova-xvpvncproxy.114.crash

##############Clean Up Scripted##############
#!/bin/bash
mysql -uroot -popenstack -e “drop database nova;”
mysql -uroot -popenstack -e “drop database glance;”
mysql -uroot -popenstack -e “drop database keystone;”
apt-get purge nova-api nova-cert nova-common nova-compute \
nova-compute-kvm nova-doc nova-network nova-objectstore \
nova-scheduler nova-vncproxy nova-volume python-nova python-novaclient
apt-get autoremove
rm -rf /var/lib/glance
rm -rf /var/lib/keystone/
rm -rf /var/lib/nova/
rm -rf /var/lib/mysql

###########Instance not found###############

Sometimes things go screwy as you are testing things and compute can crash leaving a headless instance out there. Track down the instance files and delete them and drop the database and rebuild it.

Errors:

Invalid: Instance has already been created
InstanceNotFound: Instance instance-00000001 could not be found.

/var/lib/nova/instances/instance-000000ed/libvirt.xml
/var/lib/nova/instances/instance-000000f5/console.log
/var/lib/nova/instances/instance-000000f5/disk
/var/lib/nova/instances/instance-000000f5/libvirt.xml
/var/log/libvirt/qemu/instance-00000001.log
/var/log/libvirt/qemu/instance-00000002.log
/var/log/libvirt/qemu/instance-00000003.log
/var/log/libvirt/qemu/instance-00000004.log
/etc/libvirt/nwfilter/nova-instance-instance-000000bd-fa163e668ec9.xml
/etc/libvirt/nwfilter/nova-instance-instance-000000c3-fa163e5b0541.xml
/etc/libvirt/nwfilter/nova-instance-instance-000000c9-fa163e77d2c5.xml

rm –f /var/log/libvirt/qemu/instance*
rm –f /etc/libvirt/nwfilter/nova*
rm –f /var/lib/nova/instances/instance-*
rm –f /var/log/libvirt/qemu/inst*
rm -f /etc/libvirt/nwfilter/nova-*

mysql -u root -p
drop database nova;
Then recreate the DB.

/*Re-create the Nova database
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO ‘novadbadmin’@'%’
IDENTIFIED BY ‘password’;

nova-manage db sync

Posted in OpenStack | Tagged , , , | 2 Comments

OpenStack Essex Installation Walkthrough from Scratch (Part3)

Dashboard Installation

/*Install packages
$apt-get install libapache2-mod-wsgi openstack-dashboard

/*Restart Apache
$restart apache
$service apache2 restart

/*Connect to the Dashboard web page.
http://localhost or http://x.x.x.x

So easy a caveman (me) can do it. Not really it is a pain to get it working smoothly but mainly for me was lack of good directions and learning the pieces and parts to something a vast as this project.

For troubleshooting refer to the troubleshooting this post.
See a post for how to operate Dashboard visit here.

Posted in essex, OpenStack | Tagged , , , , , , | 4 Comments

OpenStack Essex Installation Walkthrough from Scratch (Part2)

/*Upload Images
/* 11.10 image
wget http://uec-images.ubuntu.com/releases/11.10/release/ubuntu-11.10-server-cloudimg-amd64-disk1.img

/* 12.04 image
wget https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img

$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

/*List Images
$glance index (Should be empty)

<pre)/* Add images to Glance
$glance add name=”Ubuntu 11.10″ is_public=true container_format=ovf disk_format=qcow2 < ubuntu-11.10-server-cloudimg-amd64-disk1.img

/*Uploading image ‘Ubuntu 11.10′
==========================================================================================[100%] 167.139407M/s, ETA 0h 0m 0s
Added new image with ID: 3a2404f6-0a4f-44db-b1cd-a81401dd6015
*/
$glance add name=”Ubuntu 12.04″ is_public=true container_format=ovf disk_format=qcow2 < precise-server-cloudimg-amd64-disk1.img

Uploading image ‘Ubuntu 12.04′
==========================================================================================[100%] 143.583705M/s, ETA 0h 0m 0s
Added new image with ID: 92ca562e-bb18-425a-94ac-eb292fbcabec*/

/* If the image over  ~220Mb you have the wrong image and not Ostack compatible one.
$glance index

Nova Installation

apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-vncproxy nova-volume python-nova python-novaclient

/*Restart Script
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" stop; done
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" start; done

$chmod +x <script>

/*Add this to /etc/network/interfaces
#Bridged Interfaces
auto br100
iface br100 inet static
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address 172.31.252.7
netmask 255.255.254.0

/*Add Bridge br100
brctl addbr br100

/*bring br100 up
ifconfig br100 up

/* Edit /etc/nova/api-paste.ini and add
admin_tenant_name = admin
admin_user = admin
admin_password = openstack

/* Fix Permissions
chown -R nova:nova /etc/nova

/* Edit /etc/nano.conf See File in blog http://networkstatic.net

#sync with mysql
nova-manage db sync

/*Restart process. Hot key this guy.

for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" stop; done
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service "$a" start; done

/*Add your vNIC “Flat Network” as defined in nova.conf
$nova-manage network create private –fixed_range_v4=172.31.252.0/23 –num_networks=1 –bridge=br100 –bridge_interface=eth0 –network_size=500

/*(Optional) Create a floating pool. Can be any address you want to assign. Essentially NAT.
$nova-manage floating create –ip_range=128.163.188.240/28

/*Check Services
$nova-manage service list
$nova-manage network list
$ps –ea | grep nova

/*Should see something along these lines:
$ ps -ea | grep nov
11176 ? 00:00:03 nova-cert
14282 ? 00:00:00 nova-network
14293 ? 00:00:00 nova-compute
14303 ? 00:00:01 nova-api
14313 ? 00:00:00 nova-objectstor
14323 ? 00:00:00 nova-scheduler
14353 ? 00:00:00 nova-xvpvncprox

/*Good
$nova-manage service list
Binary Host Zone Status State Updated_At
nova-scheduler openstack-dev nova enabled  :-)  2012-05-10 06:39:29
nova-compute openstack-dev nova enabled :-)  2012-05-10 06:39:09
nova-network openstack-dev nova enabled :-)  2012-05-10 06:39:29
/*Bad most of the time. Compute can come in and out of that state and recover.
/*I have never seen network recover, it is normally bad or overburdened and time to start scouring the logs.

$nova-manage service list
Binary Host Zone Status State Updated_At
nova-scheduler openstack-dev nova enabled :-)  2012-05-10 07:26:29
nova-compute openstack-dev nova enabled XXX 2012-05-10 07:19:20
nova-network openstack-dev nova enabled XXX 2012-05-10 07:21:06

/*Virtual Machines from CLI. Skip if only interested in dashboard.
/*Make sure your nova db has been synced if you skip:

/*If not synced or sure if synced, sync.
$nova-manage db sync

/*Create rules for the project
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

/*Windows image
nova secgroup-add-rule default tcp 3389 0.0.0.0/0

/*Create security keys
$ nova keypair-add ssh_key > ssh_key.pem

/*Set Permissions
$chmod 0600 ssh_key.pem

/*One more reboot for good measure
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service “$a” stop; done
for a in libvirt-bin nova-network nova-compute nova-api nova-objectstore nova-scheduler nova-volume nova-vncproxy; do service “$a” start; done

/*List your images
$glance index

/*List or edit your flavors
$nova flavor-list

/*Boot a VM from CLI or skip to the Dashboard frontend.
/*Ubuntu 11.10
$nova boot –flavor 1 –image 3a2404f6-0a4f-44db-b1cd-a81401dd6015 –key_name ssh_key demo

/* Ubuntu 12.04
$nova boot –flavor 1 –image 92ca562e-bb18-425a-94ac-eb292fbcabec –key_name ssh_key demo1

/*Watch your machine boot or error ☺
$nova show demo1

/*View all VMs in your Project (Project you have creds in ENV for only)
$nova list

SSH to your new host. If you get public key errors you didn’t set your permissions on the key a few steps back.

$ssh -i ssh_key.pem ubuntu@172.31.248.2
or
$ssh -i ssh_key.pem ubuntu@<your IP>

The final part 3 is here. My colleague Cody Bumbgardner joins me and we talk about some of our use cases for OpenStack.

Posted in essex, OpenStack, Uncategorized | Tagged , , , , , , | 1 Comment

OpenStack Essex Installation and Configuration Screencast from Scratch (Part 1)

OpenStack Essex Install on 12.04 LTS

Many hours, days, nights and poor defenseless VMs were destroyed in preparing this how-to. There are some great scripts out there but for most engineers and architects we need to tear it apart look at the guts and put it back together. You are in luck. There are a lot of moving parts on the current OpenStack Essex release, so be prepared to drop MySql tables and rebuild. There is a troubleshooting post following this one to refer to as problems arise.

The OpenStack core components we are installing in this demo are Nova, Glance, Keystone and Dashboard. This will be the standard build for future design scenarios. This is killer software out of the box for data center orchestration built on top of killer modules.

Download the configuration files used for this how-to here.

Figure 1. Two NICs on a host. Note* If you have one NIC you can use a vNIC i.e. eth0 & eth0:1

System Dependencies

$apt-get update

/*If not FQDN
$nano /etc/hosts

127.0.0.1 localhost
127.0.1.1 openstack1

apt-get install ntp

/*Edit the NTP config to survive an Internet/Network outage:
$nano /etc/ntp.conf

server ntp.ubuntu.com iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

/*Restart the service
$service ntp restart

/*More packages
$apt-get install tgt
$apt-get install open-iscsi open-iscsi-utils
$apt-get install bridge-utils

/*Restart Networking
$/etc/init.d/networking restart

$apt-get install rabbitmq-server memcached python-memcache
$apt-get install kvm libvirt-bin
$apt-get install -y mysql-server python-mysqldb

/* Log into MySQL
$mysql -u root -p

/*Create the Nova database with a password ‘openstack’
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%'
IDENTIFIED BY 'openstack';

/*Create Glance database database with a password ‘openstack’
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%'
IDENTIFIED BY 'openstack';
quit;

/*Edit my.cnf
$nano /etc/mysql/my.cnf

/*from
bind-address = 127.0.0.1
/*to
bind-address = 0.0.0.0$/etc/init.d/mysql restart

Keystone Identity Management

/*More packages
$apt-get install keystone python-keystone python-keystoneclient

/*Edit keystone.conf

$nano /etc/keystone/keystone.conf

/* Change ‘admin_token’ FROM
#bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
admin_token = ADMIN
/*TO
#bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
admin_token = openstack

/*Also in Keystone.conf change the catalog values FROM:
[catalog]
driver = keystone.catalog.backends.sql.Catalog
TO:
[catalog]
# driver = keystone.catalog.backends.sql.Catalog
driver = keystone.catalog.backends.templated.TemplatedCatalog
template_file = /etc/keystone/default_catalog.templates

/* Edit keystone_data.sh to have the proper password and token. 9Download all files at the beginning) of the post and /*plugin your values.AMIN_PASSWORD:-yourpassword –and– /*SERVICE_TOKEN=YouPassword

ADMIN_PASSWORD=${ADMIN_PASSWORD:-openstack}
SERVICE_PASSWORD=${SERVICE_PASSWORD:-$ADMIN_PASSWORD}
export SERVICE_TOKEN="openstack"
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}

/*Save and run the keytone.sh script. Thanks to devstack for the script.

/*Download the script here

$chmod +x keystone.sh
$./keystone.sh

/*This should return a ‘0’ for success.
$echo $?

/* Restart Keystone
$/etc/init.d/keystone restart

Installing Glance Image Management

$apt-get install glance glance-api glance-client glance-common glance-registry python-glance

/* Go ahead and add these to the end of /root/.bashrc

export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export OS_AUTH_KEY=openstack

/*Then refresh the shell. You can also use source novarc but keep it simple to start.
$bash

/etc/glance/glance-registry-paste.ini (privs)
/etc/glance/glance-api-paste.ini (privs)
/etc/glance/glance-registry.conf (sql connection and flavor)
/etc/glance/glance-api.conf (flavor)

/*Change the values to match below at the bottom of glance-registry-paste.ini
$/etc/glance/glance-registry-paste.ini

admin_tenant_name = admin
admin_user = admin
admin_password = openstack

/*Change the values to match below at the bottom of glance-api-paste.ini
$nano /etc/glance/glance-api-paste.ini

admin_tenant_name = admin
admin_user = admin
admin_password = openstack

nano /etc/glance/glance-registry.conf

/*Adjust mysql with privileges
$nano /etc/glance/glance-registry.conf

sql_connection = mysql://glancedbadmin:openstack@128.163.188.8/glance

/*Add this to the bottom of the file

[paste_deploy]
flavor = keystone

/*Add flavors to /etc/glance/glance-api.conf at the bottom
$nano /etc/glance/glance-api.conf

[paste_deploy]
flavor = keystone

/* Restart for funzys
$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

/* Version control fix for 12.04
$glance-manage version_control 0
/*If you get errors on the following db_sync verify your variable by typing ‘export’.

/*Sync Glance with MySQL.
$glance-manage db_sync

/* Again for good measure
$/etc/init.d/glance-api restart
$/etc/init.d/glance-registry restart

Continue with part2

Posted in essex, OpenStack | Tagged , , , , , | Leave a comment

OpenStack Essex Operational Demo

This is the first in some configuration and deployment guides for OpenStack Essex. This clearly has potential well beyond hyper-scale cloud and content providers. If VMware execs are not concerned about enterprise market share today, I expect they will be sooner, rather than later. It represents consumerism driving the market. ‘Ecosystem’, is the new, fun buzzword in the cloudy, smokey industry today. That is nothing new. We have always looked for more comprehensive forms of orchestration and typically that equates to yet another layer of abstraction. That is not a bad thing. That rise up the stack typically reduces operational cost and boosts productivity.

OpenStack today is a few core components couple together with a scheduler, sounds familiar, something along the lines of vCloud. As this matures over the next couple software life cycles (Ubuntu model of every 6 months), this has a very good chance, of likely becoming the kingpin Open Source alternative and possibly the gold standard of cloud efficiency.

That said it is raw and a beast in its current fashion. I have relied on scouring random anonymous posts from user ‘anonoymous529′ and friends to help debug issues and code that come up, along the all night battles in a build with so many moving parts such as this. This will develop over time, into a single, distributable package that is like everything else, abstracted to hide the underpinning pieces and parts that create the ecosystem. Leaders and executives with vision, which I am fortunately exposed to, (that really sounded like a suck up but hey, its true) will early adopt, with not too much risk. The reasons why are fairly apparent, it has very good parents, loads of industry heavy weights keeping it upright and very high priced, proprietary and closed alternatives.

Starting the series with an overview of what can be done with this code, which can orchestrate fantastics projects, like KVM, Nagios, OpenvSwitch to name a few, by providing a layer of abstraction. The next parts will be installation casts to hopefully save someone the many nights of being a zombie, grinding out a deployment in its current state. It is going to be a fun next few years.

 

 

 

 

 

 

 

 

 

 

Figure 1. Topology for this demo

Deployment guide and cast later this week!

Posted in OpenStack | Tagged , , | 2 Comments

Floodlight OpenFlow Controller Screencast with HP Switches

Quick how-to on installing the Floodlight OpenFlow controller and a slick http UI fronted someone put up on GutHub. Floodlight is probably the easiest of all controllers to setup. It is built in Java and based on the Beacon controller project. It is a great way to get your feet wet in SDN. I will work on a post showing some of the capabilities in the next few days.
The switches in the post are a couple HP3500yl running the OpenFlow v1.0 agent. I think the TCAM on that box allows for maybe a 5-tuple in HW. None of the HP switches I am aware of support any layer 2 header rewrites due to TCAM size limitations. Just not enough rows, but maybe the bigger 5400 but I havent dug in. That limits manipulation of the ethertype, L2 src address and L2 dst address. Thanks to the gentleman who shared his code on GitHub with the nifty web UI. It was needed. It looks very much like the Beacon web UI.

Figure 1. Here is the topology.
Kick the tires on a very simple controller install and see what you think. No C compiler errors in this project which can be nice depending on how much you like or dislike Java :)

Install dependencies, apt-get for UB and yum for RH:
apt-get install build-essential default-jdk ant python-dev eclipse git
Clone the Github project and build the jar and start the controller:
git clone https://github.com/thewmf/floodlight
cd floodlight
ant
java -jar target/floodlight.jar
Connect the switch to the OpenFlow controller:
vlan 1 openflow controller tcp:192.168.1.171 enable
Here is what the HP config looks like.
vlan 1
name "Native Path to Controller"
ip address 192.168.1.211 255.255.255.0
tagged 1-3,5

vlan 3
name "OF Controlled Vlan"
untagged 48
ip address 10.1.1.3 255.255.255.0
tagged 2-3
exit

vlan 3
enable
controller "tcp:192.168.1.171:6633"
exit
Later this week I will breakdown some of the datapaths and flows and we can see what they look like in action.
Posted in OpenFlow | Tagged , , , , | Leave a comment