In this article we'll discuss remotely managing a Rackspace Cloud Server using the python-novaclient package running on Windows.
If you want to manage your servers from the command line without dealing directly with the API you can use an open-source client application called python-novaclient.
Note that the nova client is not maintained by Rackspace and should be considered software in development.
To run python-novaclient you'll need python 2.6 or later installed on your system (the nova client doesn't support python 3 at the time of this writing). You can run the client from either a desktop machine or from a remote system, like a Cloud Server.
The python installation will need to have the "setuptools" package installed as well. This is installed with a python distribution like ActiveState ActivePython, which we will discuss in the next section.
To run the nova client you'll need to have access to your Rackspace Cloud account's username and password.
If you don't already have a python installation on your Windows system, an easy way to get python on there is by downloading and installing the community (free) version of ActiveState ActivePython.
You can download the installer from their website:
After downloading, run the installer.
Once ActiveState Python is installed you can use the python package installer "pip" to automatically download and install the nova client.
Open a command window by going to the Start Menu and typing "cmd" into the Search box. In the command window enter the following command to install a metapackage that includes the latest version of python-novaclient and the Rackspace extensions all in one go:
pip install rackspace-novaclient
The "rackspace-novaclient" is a metapackage that causes pip to install the client and all Rackspace extensions for the client. If you have any problems with the metapackage you can instead use pip to install the "python-novaclient" and "rackspace-auth-openstack" packages individually for basic operation.
When the installs are done close the command window.
If you're using another python distribution (like the official python distribution), you can install the python setuptools package from pypi (if it isn't included with the distribution), then use easy_install to install pip:
From there you can follow the install instructions in the previous section.
Now that the nova client is installed we just need to set up the environment variables that will allow it to connect to your Rackspace Cloud account.
For most Windows versions you can set your environment variables through the "System" control panel.
Go to the Start Menu and choose "Control Panel". In the control panel go to the "System and Security" section, then choose "System". In the System control panel select the "Advanced" tab at the top. Then click the "Environment Variables..." button at the bottom.
If you have any trouble finding the System control panel you can also type "environment" into the Start Menu's search field. You'll get a link that lets you edit your environment variables. If given a choice between editing values for your user account or the system, choose the selection for your user account unless you know other users on your machine will need to be able to use the nova client.
Now you'll need to set five environment variables. For each, click the "New" button in the section for your user environment variables (the top pane, usually).
Each variable set will require a name and a value. These will be:
|Variable name||Value type||Description|
|OS_USERNAME||username||Set this value to your Rackspace Cloud username.|
|OS_TENANT_NAME||account number||Set this value to your Rackspace Cloud account number, visible in the upper right when logged in to the Cloud Control Panel.|
|OS_AUTH_SYSTEM||rackspace||Set this value to "rackspace" to connect to the Rackspace Cloud.|
|OS_PASSWORD||password or API key||Set this value to your Rackspace Cloud API key. You can retrieve your API key in the Cloud Control Panel. See this article for more information about generating your API key. With a non-Rackspace Openstack cloud, you will usually put the account password in this variable.|
|OS_AUTH_URL||identity endpoint||Set this value to the endpoint for the identity service the client will use to
authenticate for API operations. For the US and AUS Rackspace Cloud that should be
|OS_REGION_NAME||datacenter region||The code for the datacenter region containing the servers you want to manipulate.
You can check your server's datacenter by checking its details screen in the Cloud Control
Panel. The datacenter code is just the first three letters of the datacenter's identifier;
Once you've set all seven environment variables, "OK" your way out of those windows. Note that any command windows you already have open won't reflect the changes to your environment variables.
Now we'll run a quick query to make sure the nova client is ready to go. Open a new command window by going to the Start Menu and entering "cmd" in the search box.
Now to see if you can talk to the API server, run:
If all is well you'll get back a list of the images available to you when creating a server.
You can get a full list of commands by typing:
Note, however, that you won't be able to use every command listed. The nova client was written for use with recent development versions of OpenStack, so it includes support for some features that have not yet been implemented in the Rackspace Cloud.
You can get more help for a command this way too:
nova help create
We'll talk about some of the more commonly-used commands in a later article.
The client doesn't elaborate well on errors. A common problem is entering the username, tenant name, or password incorrectly, so be sure and double-check those settings.
Remember that if you change any environment variables you'll need to close your command window and open a new one to work with the new values.
You can also use the options that are listed at the end of the "nova help" output to override some environment variable settings. If you're unsure about the region, for example, you can substitute it with the "--os-region-name" option like so:
nova --os-region-name ORD image-list
You should have the nova client set up where you can access it, and it should be able to talk to your Rackspace Cloud account. In the next article in this series we'll look at some common operations you can perform with the client, like creating servers and taking snapshots.
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License