Zokahn -Personal Blog-

18Nov/130

Should i use openstack-config?

The answer is yes, you really should. The tool is part of the openstack-utils package in the Red Hat world, this package is not always installed as a dependency. It has two options, you can either set or delete items in a config file for OpenStack. The Openstack Config files follow a (ini) structure like we have seen in the MS Windows world. A config file has sections, each sections has parameter and value pairs.

Most of the OpenStack components a have DEFAULT section, some have additional sections. I must compliment the developers for the persistence of this structure throughout the OpenStack project and all of it's components. Here is a example:

example or partial /etc/nova/nova.conf

[DEFAULT]
verbose=True
auth_strategy=keystone
connection_type=libvirt

We could change this file manually to change the verbose item to False by opening the file in a text editor of choice, change the line and save the file. This action will just work... But is pretty hard to document or script. You could use elaborate sed commands to accomplish what openstack-config can do for you without much thought. Changing the same with openstack-config is:

openstack-config --set /etc/nova/nova.conf DEFAULT verbose False

That's it. Running the command will set the config item from True to false. Completely delete a item value pair is just as easy:

openstack-config --del nova.conf DEFAULT verbose

Note: openstack-config will delete this item and probably break your setup...

You could add a bunch of these items into a script or documentation. Openstack-config can only handle one item per line and it will not check any of your section, item or value input. If you make a mistake, it will add your mistake to the file. It will just create a new section if you misspell the section by typing DFAULT. Same is true for the parameter name or value. It will accept anything. Openstack-config will check it's own options, either --set or --del and it will also check if the file exists. If the file does not exist it will fail to open it and present a Python Exception, this is a bit rough to the eyes. It will also set the exit code to 1 signaling the failure, of course it will exit with 0 is successful.

So... Should you use openstack-config to edit OpenStack config files? Yes... Make it a habit! It will help you automate things with ease and write clear documentation.