Make the switch... to the openstack CLI

Blog Post created by agentle on Dec 1, 2016

Just like waiting on a cake to bake to perfection, I got a little impatient sometimes for the OpenStack client to have enough features to switch over all the documentation. Well, I'm here to say, that cake is baked and ready to frost.

The switchover is fairly painless. You can keep the same credentials script, either created by you or downloaded from the Dashboard. And, instead of having to remember the project name for every OpenStack service, like nova, glance, and keystone, you remember one command: openstack.

And when you're wondering what to put for most commands, the conversion pattern has been to use a space instead of a dash. For example, instead of nova service-list, use openstack service list.


The key verbs to learn are: create, list, show, set, plus these verbs are used with a space instead of a hyphen between the object and verb.

The object names are standardized nicely: server, volume, flavor, image, and so on. It's fairly easy to remember openstack server list, openstack volume list, openstack image list, and openstack flavor list.


So, instead of reaching for the "nova boot" command, use the openstack server create command.

Another pro-tip for some of the parameters passed in: change the underscore (_) to a hyphen (-). For example:

openstack server create --availability-zone zone:HOST,NODE

Note how the command uses --availability-zone instead of --availability_zone.

Also look for singular rather than plural, such as --security-groups becoming --security-group in the openstack server create command.

It's also great to see the use of "property" consistently rather than "meta" or "metadata" since different project CLIs had varied different interpretations for metadata. For example, you can add a description for your server by providing the --property description="Dev Server" parameter.

Another nice feature is that you can always fall back on the old commands if you simply cannot get your fingers to stop typing "nova list" as soon as you source your credentials. The python-novaclient remains as the underlying dependency with the python-openstackclient pip install.

You want to upgrade to the latest version of the python-openstackclient. Today I was able to get a copy of 3.3.0. To find out what version you have, run: pip freeze | grep python-openstackclient. To upgrade, in a virtual environment, run: pip install -U python-openstackclient.


The upstream docs are converting over now, by substituting project client commands with openstack client commands, and testing the parameters, arguments, and parameters. More than forty changes have been merged already and we are counting down to that frosted cake slice.


For Metacloud, we have documented how to install the python-openstackclient on Windows and on Mac OSX. You can also learn about providing your Metacloud credentials to use the CLI with ease.