Skip to content

Setting_up_Openstack

movitto edited this page Jan 14, 2013 · 6 revisions

Setting up Openstack

Back to presentations / demo portal

These are complete end-to-end instruction on how to setup openstack on a Fresh Fedora 17 system, for use in demoing Aeolus

Prereqs

Openstack can be run in a vm or baremetal, it cannot be run off a live cd though.

Openstack does not require too much in terms of resources, but for my vm I dedicated 1 CPU w/ 2GB of memory and 20GB of disk

Installation:

Mysql:

yum install mysql-server
mysqladmin -uroot password “cloudpass”
service mysqld restart
yum install  --enablerepo=updates-testing openstack-utils
openstack-nova openstack-glance openstack-keystone openstack-dashboard
qpid-cpp-server-daemon
openstack-db --service nova --init-y--rootpw cloudpass
openstack-db --service glance--init-y --rootpw cloudpass
openstack-db --service keystone --init-y--rootpw cloudpass

Preq Services:

systemctl start qpidd.service
systemctl enable qpidd.service
systemctl start libvirtd.service
systemctl enable libvirtd.service

Volume Group

dd if=/dev/zero of=/var/lib/nova/nova-volumes.img bs=1M seek=2k count=0
vgcreate nova-volumes $
openstack-config --set /etc/nova/nova.conf DEFAULT volume_group
nova-volumes

Authentication

openstack-config --set /etc/keystone/keystone.conf DEFAULT admin_token

openstack-config --set /etc/nova/api-paste.ini filter:authtoken admin_tenant_name service

openstack-config --set /etc/nova/api-paste.ini filter:authtoken admin_user nova
openstack-config --set /etc/nova/api-paste.ini filter:authtoken admin_password servicepass
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone

openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor  keystone
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_user glance
openstack-config --set /etc/glance/glance-api-paste.ini filter:authtoken admin_password servicepass
openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance
openstack-config --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_password servicepass

Only if running in a vm:

openstack-config --set /etc/nova/nova.conf DEFAULT libvirt_type qemu
openstack-config --set /etc/nova/nova.conf DEFAULT
scheduler_default_filters AllHostsFilter
setsebool -P virt_use_execmem on

Openstack services

systemctl start openstack-glance-api.service
systemctl enable openstack-glance-api.service
systemctl start openstack-glance-registry.service
systemctl enable openstack-glance-registry.service

systemctl start openstack-nova-api.service
systemctl enable openstack-nova-api.service
systemctl start openstack-nova-objectstore.service
systemctl enable openstack-nova-objectstore.service
systemctl start openstack-nova-compute.service
systemctl enable openstack-nova-compute.service
systemctl start openstack-nova-network.service
systemctl enable openstack-nova-network.service
systemctl start openstack-nova-volume.service
systemctl enable openstack-nova-volume.service
systemctl start openstack-nova-scheduler.service
systemctl enable openstack-nova-scheduler.service

systemctl start openstack-keystone.service
systemctl enable openstack-keystone.service

Users

export OS_USERNAME=admin
export OS_PASSWORD=cloudpass
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://127.0.0.1:5000/v2.0/
export SERVICE_ENDPOINT=http://openstack:5000/v2.0/ # <= note this is ‘openstack’ on purpose

export SERVICE_TOKEN=$ADMIN_TOKEN
ADMIN_PASSWORD=cloudpass SERVICE_PASSWORD=servicepass openstack-keystone-sample-data

Network

nova-manage network create demonet 10.0.0.0/24 1 256  --bridge=demonetbr0
modprobe nbd 
nova-manage user admin admin ABCDEF FEDCBA
virsh net-destroy default

Add image to glance:

wget http://syracloud.net/~mmorsi/f16-x86_64-openstack-sda.qcow2
glance add name=f16-jeos is_public=true disk_format=qcow2
container_format=bare < f16-x86_64-openstack-sda.qcow

Using openstack

Now openstack is setup and you can launch instances. As a regular user:

export OS_USERNAME=‘admin’
export OS_PASSWORD=‘ABCDEF’
export OS_TENANT_NAME=‘admin’
export OS_AUTH_URL=‘http://localhost:5000/v2.0’

nova keypair-add mykey > oskey.priv
chmod 600 oskey.priv
Helper script to restart openstack services:
# cat restart-nova 
  #!/bin/bash
  service qpidd restart
  service openstack-keystone restart
  service openstack-glance-api restart
  service openstack-glance-registry restart
  service openstack-nova-api restart
  service openstack-nova-compute restart
  service openstack-nova-volume restart
  service openstack-nova-network restart
  service openstack-nova-objectstore restart
  service openstack-nova-scheduler restart
Helper script to stop openstack services:
# cat stop-nova 
   #!/bin/bash
   service openstack-nova-api stop
   service openstack-nova-compute stop
   service openstack-nova-volume stop
   service openstack-nova-network stop
   service openstack-nova-objectstore stop
   service openstack-nova-scheduler stop
   service openstack-glance-api stop
   service openstack-glance-registry stop
   service openstack-keystone stop
Helper script to list instances
# cat /home/clouduser/list-instances 
  export OS_USERNAME=‘admin’
  export OS_PASSWORD=‘cloudpass’
  export OS_TENANT_NAME=‘admin’
  export
  OS_AUTH_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’
  nova list
Helper script to start instance
# cat /home/clouduser/start-instance
   export OS_USERNAME=‘admin’
   export OS_PASSWORD=‘cloudpass’
   export OS_TENANT_NAME=‘admin’
   export
   OS_AUTH_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’
   nova boot myserver$1 --flavor 2 --key_name pkey--image $(glance
   index | grep f16-jeos | awk ‘{print $1}’)

Invoke with a string/number to append to instance name, eg ./start-instance 50

Helper script to stop instances
# cat /home/clouduser/stop-instances 
   export OS_USERNAME=‘admin’
   export OS_PASSWORD=‘cloudpass’
   export OS_TENANT_NAME=‘admin’
   export
   OS_AUTH_URL=‘http://localhost:5000/v2.0’
   arr=$(nova list | grep myserver)
   echo “Stopping instances”
   for x in $arr ; do
    if [[ “$x” =~ myserver.* ]] ; then
    echo “Stopping $x”
    nova delete $x
    fi
   done
   echo “Instances Stopped”
Clone this wiki locally