First steps, “Hello cloud!”

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.

Create an SSH key pair

This key will allow to establish the SSH session to instances:

% ssh-keygen -t rsa -f ~/.novacreds/cloudkey
[...]

It is then necessary to provide Openstack the public key to be injected in the VMs for the root account:

% openstack keypair create --public-key $HOME/.novacreds/cloudkey.pub cloudkey

To verify the available key pairs:

% openstack keypair list
+----------+-------------------------------------------------+
|   Name   |                   Fingerprint                   |
+----------+-------------------------------------------------+
| cloudkey | 01:4a:cb:05:ff:6a:67:6e:c6:50:e8:a0:eb:ef:e7:95 |
+----------+-------------------------------------------------+

List the available images

% openstack image list
+--------------------------------------+-----------------------+--------+-------------------------+
| ID                                   | Name                  | Status | Server                  |
+--------------------------------------+-----------------------+--------+-------------------------+
| 1e6104b4-d915-4925-832b-798c3ea3b426 | scientific.linux-5.8  | ACTIVE |                         |
| b5a7711d-f0eb-4a31-98e6-69ef2ed09b6a | scientific.linux-6.2  | ACTIVE |                         |
+--------------------------------------+-----------------------+--------+-------------------------+

List the available flavors

Flavors represent the available types of virtual machines. They determine the virtual machines characteristics:

% openstack flavor list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
| 2  | m1.small  | 2048      | 10   | 20        |      | 1     | 1.0         | True      | {}          |
| 3  | m1.medium | 4096      | 10   | 40        |      | 2     | 1.0         | True      | {}          |
| 4  | m1.large  | 8192      | 10   | 80        |      | 4     | 1.0         | True      | {}          |
| 5  | m1.xlarge | 16384     | 10   | 160       |      | 8     | 1.0         | True      | {}          |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+

Start an instance

To run the instance:

% openstack server create --key-name cloudkey --image SL6.2-x86_64 --flavor m1.tiny mavm
[...]

The VM status can be checked with:

% openstack server list

It is possible to 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                 |
+---------------------+--------------------------------------+

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 | ccin2p3=134.158.246.5,
134.158.246.17 |
+--------------------------+------------+--------+-----------------------+

Say hello

% ssh -i ~/.novacreds/cloudkey root@134.158.246.25 echo "hello world"
hello world

Delete the instance

% openstack server delete mavm