devstack

2015/01/10 openstack

devstack is a very good tool for developing and testing OpenStack.

Minimize the required resource

The default settings may not meet everyone’s environment, especially when you run it in virtual machines. This post records how to minimize the resources consumed by devstack.

On my environment, Nova, Keystone, Glance, Cinder and Ceilometer are enabled. Other services will be added if I use them in future.

The main part is reducing the workers created by the services, by default, there will be X workers if you have X CPUs. You’ll need only one worker if you don’t need to do performance test.

Note that, even though we cut down the workers to minimum 1, but there still be multiple processes for some services, here is the list:

  • nova-api: 4
  • cinder-api: 2
  • cinder-volume: 2

You can set API_WORKERS=1 in local.conf to minimize api workers, but there is more work to do. By doing this and with the following steps, you can reduce more than 1GB memory with a default devstack setup!

Nova

Edit /etc/nova/nova.conf, change or add the following lines

[DEFAULT]
metadata_workers = 1
ec2_workers = 1
osapi_compute_workers = 1

[conductor]
workers = 1

Keystone

The Keystone service is hosted by Apache2, its cost is very low, you can leave the default setting there. But if you do want to reduce it, modify /etc/apache2/sites-available/keystone.conf and set the processes=1 (there are two places need to set), then restart the apache2 service.

Horizon

The same as Keystone, this time is the /etc/apache2/sites-available/horizon.conf.

Glance

Edit /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf

[DEFAULT]
workers = 0

Note, if set workers=1, then glance-api and glance-registry will have two processes. The behavior for workers=0 is to spawn a eventlet thread, which means if it dies, then the service is terminated. workers=1 means to ensure there is at least one worker. See source code

Cinder

Edit /etc/cinder/cinder.conf

[DEFAULT]
osapi_volume_workers = 1

Ceilometer

[DEFAULT]
collector_workers = 1

Trouble Shoot

Cannot attach to screen sessions

If you come across such error:

stack:devstack$ ./rejoin-stack.sh
Attaching to already started screen session..
Cannot open your terminal '/dev/pts/2' - please check.

you need to run this command:

stack:devstack$ script /dev/null
Script started, file is /dev/null

“Why this works is invoking script has a side effect of creating a pseudo-terminal for you at /dev/pts/X.”, see Why does redirecting ‘script’ to /dev/null/ allow ‘screen’ to work while su’ed as another user?

Keystone doesn’t start after ./rejoin-stack.sh

After running ./rejioin-stack.sh under devstack directory, keystone service fail to start, I check with:

ls -l /etc/apache2/sites-enabled/

to see if keystone.conf presents, it doesn’t, that can be the reason why keystone does not start, run:

sudo cp /etc/apache2/sites-available/keystone.conf /etc/apache2/sites-enabled/keystone.conf
sudo service apache2 restart

then it should be fine. Note that ln -s will not work because next time you ./unstack.sh then it will disappear again!

License: (CC 3.0) BY-NC-SA

Search

    Table of Contents