Devstack installation with VirtualBox

From MyWiki

Revision as of 14:10, 25 November 2014 by Admin (Talk | contribs)
Jump to: navigation, search

NOTE: this is still work in progress!

VM setup

Get CentOS 6.6 VM setup. Nothing fancy - Basic server, one interface.

After OS is installed, do yum upgrade

# yum upgrade

# yum install git

# git clone https://github.com/openstack-dev/devstack.git -b stable/icehouse /opt/devstack

# cd /opt/devstack/
# tools/create-stack-user.sh 
# chown -R stack:stack /opt/devstack

Switch off SELinux and iptables:

# vi /etc/sysconfig/selinux 
# setenforce 0
# getenforce 
# service iptables stop

Upgrade all packages to the latest (just to be up to date):

# yum upgrade
# sudo -i -u stack

Get and set devstack

Create /opt/devstack/local.conf file

[stack@devstack devstack] cd /opt/devstack
[stack@devstack devstack] vi local.conf

Below configuration file is based on this example

[[local|localrc]]

# Credentials
DATABASE_PASSWORD=devstack
ADMIN_PASSWORD=devstack
SERVICE_PASSWORD=devstack
SERVICE_TOKEN=devstack
RABBIT_PASSWORD=devstack

# Services
ENABLED_SERVICES=rabbit,mysql,key
ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch,n-novnc,n-cauth
ENABLED_SERVICES+=,neutron,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-lbaas
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
ENABLED_SERVICES+=,g-api,g-reg
ENABLED_SERVICES+=,cinder,c-api,c-vol,c-sch,c-bak
ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond
ENABLED_SERVICES+=,horizon

# Images
# Use this image when creating test instances
IMAGE_URLS+=",http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img"
# Use this image when working with Orchestration (Heat)
IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"

# Branches
KEYSTONE_BRANCH=stable/icehouse
NOVA_BRANCH=stable/icehouse
NEUTRON_BRANCH=stable/icehouse
SWIFT_BRANCH=stable/icehouse
GLANCE_BRANCH=stable/icehouse
CINDER_BRANCH=stable/icehouse
HEAT_BRANCH=stable/icehouse
TROVE_BRANCH=stable/icehouse
HORIZON_BRANCH=stable/icehouse

# Swift Configuration
SWIFT_REPLICAS=1
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5

# Enable Logging
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs

Let’s stack it now

[stack@devstack devstack] ./stack.sh 

You will see this error:

[stack@devstack devstack]$ ./stack.sh 
Loaded plugins: fastestmirror
Using mysql database backend
Traceback (most recent call last):
  File "/opt/devstack/tools/outfilter.py", line 24, in <module>
    import argparse
ImportError: No module named argparse

To fix it, install python-setuptools and argparse as was hinted in this post

[stack@devstack devstack] sudo yum install python-setuptools -y
[stack@devstack devstack] sudo easy_install argparse

It will eventually fail again with the below:

2014-11-25 11:22:20.797 | ERROR: openstack Unknown command ['project', 'create', 'admin']
2014-11-25 11:22:20.856 | + ADMIN_TENANT=
2014-11-25 11:22:20.857 | ++ grep ' id '
2014-11-25 11:22:20.857 | ++ get_field 2
2014-11-25 11:22:20.859 | ++ read data
2014-11-25 11:22:20.860 | ++ openstack user create admin --project '' --email admin@example.com --password devstack
2014-11-25 11:22:21.723 | ERROR: openstack Invalid command '--project'
2014-11-25 11:22:21.774 | + ADMIN_USER=
2014-11-25 11:22:21.776 | ++ get_field 2
2014-11-25 11:22:21.776 | ++ grep ' id '
2014-11-25 11:22:21.778 | ++ read data
2014-11-25 11:22:21.778 | ++ openstack role create admin
2014-11-25 11:22:22.643 | ERROR: openstack Unknown command ['role', 'create', 'admin']
2014-11-25 11:22:22.695 | + ADMIN_ROLE=
2014-11-25 11:22:22.696 | + openstack role add --project --user
2014-11-25 11:22:23.499 | ERROR: openstack Invalid command '--project'
2014-11-25 11:22:23.541 | + exit_trap
2014-11-25 11:22:23.541 | + local r=2
2014-11-25 11:22:23.541 | ++ jobs -p
2014-11-25 11:22:23.542 | + jobs=
2014-11-25 11:22:23.542 | + [[ -n '' ]]
2014-11-25 11:22:23.542 | + exit 2

Upgrade setuptools and try again. Hint came from here

[stack@devstack devstack] sudo pip install --upgrade requests setuptools
[stack@devstack devstack] ./unstack.sh
[stack@devstack devstack] ./stack.sh

Bongo!

Horizon is now available at http://10.0.2.15/
Keystone is serving at http://10.0.2.15:5000/v2.0/
Examples on using novaclient command line is in exercise.sh
The default users are: admin and demo
The password: devstack
This is your host ip: 10.0.2.15

Now run some tests:

[stack@devstack devstack] ./exercise.sh 

<...skipped loads of output...>

SKIP marconi
SKIP sahara
PASS aggregates
PASS bundle
PASS client-args
PASS horizon
PASS sec_groups
PASS swift
PASS trove
FAILED boot_from_volume
FAILED client-env
FAILED euca
FAILED floating_ips
FAILED neutron-adv-test
FAILED volumes

CLI environment variables.

If you try to engage CLI at this stage, this is what you get:

[stack@devstack devstack]$ glance image-list
You must provide a username via either --os-username or env[OS_USERNAME]

We need to setup environment variables to be able to use CLI.

If you scroll up after running the test script, you will see something like this:

++ export OS_TENANT_NAME=demo
++ OS_TENANT_NAME=demo
++ export OS_USERNAME=demo
++ OS_USERNAME=demo
++ export OS_PASSWORD=devstack
++ OS_PASSWORD=devstack
++ export OS_NO_CACHE=1
++ OS_NO_CACHE=1
++ HOST_IP=10.0.2.15
++ SERVICE_HOST=10.0.2.15
++ SERVICE_PROTOCOL=http
++ KEYSTONE_AUTH_PROTOCOL=http
++ GLANCE_HOST=10.0.2.15
++ export OS_IDENTITY_API_VERSION=2.0
++ OS_IDENTITY_API_VERSION=2.0
++ export OS_AUTH_URL=http://10.0.2.15:5000/v2.0
++ OS_AUTH_URL=http://10.0.2.15:5000/v2.0

Based on OpenStack docs we will need the below ones defined:

export OS_USERNAME=admin
export OS_PASSWORD=devstack
export OS_TENANT_NAME=demo
export OS_AUTH_URL=http://10.0.2.15:5000/v2.0

Open ~stack/.bashrc and add those line to the bottom of the file; save & exit; re-read .bashrc and off you go:

[stack@devstack devstack]$ vi ~/.bashrc 
[stack@devstack devstack]$ . ~/.bashrc 
[stack@devstack devstack]$ glance image-list

+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+
| ID                                   | Name                     | Disk Format | Container Format | Size      | Status |
+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+
| 5181ac8e-5f7b-4f61-a404-d30c4ff9db9f | cirros-0.3.2-x86_64-disk | qcow2       | bare             | 13167616  | active |
| 629e365d-09c5-46e8-bf6a-c0defb3672b2 | F17-x86_64-cfntools      | qcow2       | bare             | 476704768 | active |
+--------------------------------------+--------------------------+-------------+------------------+-----------+--------+
Personal tools