Skip to content
shinjik edited this page Sep 13, 2010 · 6 revisions

RS-Tools

Purpose

Rs-tools is a set of CLI (command line interface) tools to control RackSpace cloud written keeping in mind similar gg-tools as a reference and offering similar CLI tools and API . It provides a Python module with the interface to the RackSpace API.

Latest release available at GitHub: 0.0.2

Installation

After you’ve downloaded rs-tools, just execute:

sudo python setup.py install

Now you are able to use bot Python module in your software and CLI from the console.

Configuration

All you need to do is to obtain your API key and password and put them in a file ~/.rackspacerc in a format:

    [account]
     username: your_user_name
     secret: your_secret

Usage

Server Images

In order to get a list of available images use rs-image-list tool. It doesn’t require you to specify any arguments and is just as simple as that:

14 Red Hat EL 5.4   ACTIVE     None
17 Fedora 12 (Constantine)   ACTIVE     None
19  Gentoo 10.1   ACTIVE     None
23 Windows Server 2003 R2 SP2 x64   ACTIVE     None

By example of the first line: here 14 is a numeric id of the image, Red Hat EL 5.4 is its name, ACTIVE is image status (available to use), and the last one is ‘None’ for pre-bundled images, and number of percents in image save progress for custom images.
In all RackSpace tools if you need specify some image, you should use its id, so remember ids of the images you’re interested in.

List possible configurations

In order to get a list of possible configurations for servers (‘flavor’ in RackSpace terms), you should use rs-flavor-list tool. The output will look like:

1       256 server      256       10
2       512 server      512       20
3       1GB server     1024       40
4       2GB server     2048       80
5       4GB server     4096      160
6       8GB server     8192      320
7    15.5GB server    15872      620

as the example from first line, 1 is flavor Id, ‘256 server’ is server description, 256 is RAM amount, and 10 is disk space available for this configuration (in GB).
You will have to pass flavor id as a parameter when creating servers.

Creating servers

To create a server you can use rs-server-add tool. It accepts the following arguments:

  • -n – name of the server, for example: my_new_server. It’s a required option and you cannot omit it.
  • -i – image to use for the server. This is options cannot be omitted as well.
  • -f – flavor id. Configuration variant for server you are creating. Required.
  • -d – server description, will be returned as additional information. This is optional parameter.

Attention: you’ll get server’s root password after creation, don’t forget to remember it.

Updating server

If you forget root password you are able to set the new one using rs-server-update tool.
You can also change display name of server.

Rebuilding server

You can rebuild your server using same (in order to restore ‘clean’ system) or different server image using rs-server-rebuild tool.

rs-server-rebuild -s serverId -i imageId

This operation saves IP addresses assigned to the server and may appear as useful for you.

Rebooting server

You can ‘reboot’ server using rs-sever-reboot tool. The syntax is similar to others:

rs-server-reboot -i 12345 [-h]

where 12345 is server id, and -h is an optional parameter forcing ‘hard reboot’ (simulating power off-on cycle)

Removing servers

You can remove servers using rs-server-delete tool:

rs-server-delete -i 12345

where 12345 is server’s id.

Image manipulation

You can create an image of currently running and tuned server in order to be able to create similar nodes quickly using rs-image-save utility.

rs-image-save -n name -i serverId

where ‘name’ is image’s textual name (it will display in image list) and serverId is id of server you wish to use as ‘master’ for image.

When image is not needed anymore, you can delete it typing rs-image-delete passing -i parameter with id of image to be erased.

rs-image-delete -i 12345

API Documentation

This section will be updated soon.