First steps, “Hello cloud!”

To install the Command Line Interface (CLI) client, please follow the instructions below.

  1. install the packages python2-openstackclient, python2-novaclient, python2-glanceclient, python2-cinderclient, python2-neutronclient. They are available for most of the Linux systems,

  2. copy the available credentials in CC-IN2P3 HOME ~/.novacreds/novarc.sh in a local environment file,

  3. source the file.

  • Built-in help:

    % openstack help
    
  • Get help on a particular command (example server create):

    % openstack help server create
    

Once the client is functional, using a cloud instance is done in 4 steps:

  1. provide the cloud an SSH key pair to access the instances;

  2. instantiate a server;

  3. (optional) add a public IP to the instance;

  4. connect to the instance.

Provide an SSH key pair

This is a standard SSH private/public key pair. It will be used to establish the SSH session to the instances.

For details of how to use it, please follow the instructions on the following page:

Start an instance

To run the instance:

% openstack server create --key-name cloudkey --image Rocky-9-GenericCloud-Base.x86_64 --flavor m1.tiny mavm
[...]

Note

You can list the available images and flavors respectively with the commands:

% openstack image list
% openstack flavor list

If the projet has several networks it may be necessary specify a network to use with the parameter --network.

  • Check VM status:

    % openstack server list
    
  • Limit to a particular VM with its name:

    % openstack server show mavm
    +--------------------------------------+----------+--------+--------------------------------------+
    | ID                                   | Name     | Status | Networks                             |
    +--------------------------------------+----------+--------+--------------------------------------+
    | b87775cc-5dad-4de7-a84e-84e2cdf50c2a | mavm     | ACTIVE | mynet=172.17.15.4                    |
    +--------------------------------------+----------+--------+--------------------------------------+
    

(optional) Add a public IP

Depending on the network type the Openstack project is configured, it may be necessary (or discouraged) to associate a floating IP (NAT) to the VM to have it connected on the network.

To create a floating IP address:

% openstack floating ip create floating
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-10-24T09:22:35Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 134.158.246.17                       |
| floating_network_id | 8358e0b1-cc39-490a-a86e-a141094b5c95 |
| id                  | 41ee109f-f702-4095-a208-448cb6126145 |
| name                | 134.158.246.17                       |
| port_id             | None                                 |
| project_id          | 0223bc1968bc4e46932c5d87012aaf14     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-10-24T09:22:35Z                 |
+---------------------+--------------------------------------+

It’s possible to list floatings IPs already created in the projet with:

% openstack floating ip list
+-----------+---------------------+------------------+-----------+-------------------+
| ID        | Floating IP Address | Fixed IP Address | Port      | Floating Network  |
+-----------+---------------------+------------------+-----------+-------------------+
| 564...b6b | 134.158.246.17      | 172.17.15.4      | c85...690 | 835...c95         | => Used floating IP
| a33...a2a | 134.158.246.18      | None             | None      | 835...c95         | => Available floating IP
+-----------+---------------------+------------------+-----------+-------------------+

The IP address must then be assigned to the machine:

% openstack server add floating ip mavm 134.158.246.17
% openstack server show mavm
+--------------------------+------------+--------+-----------------------+
|            ID            |    Name    | Status |        Networks       |
+--------------------------+------------+--------+-----------------------+
| b3741a0d-e5cd-411c-abe8  | mavm       | ACTIVE | mynet=172.17.15.4,
134.158.246.17 |
+--------------------------+------------+--------+-----------------------+

Use your instance

  • Say hello:

    % ssh -i ~/.novacreds/cloudkey root@134.158.246.25 echo "hello world"
    hello world
    
  • Delete the instance:

    % openstack server delete mavm