Managing the instances

List the running instances

% openstack server list
+------+-------------+--------+----------------------+
|  ID  |     Name    | Status |       Networks       |
+------+-------------+--------+----------------------+
| 2064 | Server 2064 | ACTIVE | vlan5=134.158.246.8  |
| 2065 | Server 2065 | ACTIVE | vlan5=134.158.246.12 |
| 2078 | Server 2067 | ACTIVE | vlan5=134.158.246.13 |
| 2079 | Server 2068 | ACTIVE | vlan5=134.158.246.10 |
+------+-------------+--------+----------------------+

Note

Remember to normalize the names of your instances, it will be easier to find them using a regular expression and the parameter --name.

Instantiate and delete

  • To boot a basic instance:

    % openstack server create --flavor cc.basic --image cc-sl6.x86_64 --network ccdev-public --key_name mykey myserver
    +--------------+--------------------------------------+
    |   Property   |                Value                 |
    +--------------+--------------------------------------+
    | accessIPv4   |                                      |
    | accessIPv6   |                                      |
    | adminPass    | XXXXXXXXXXXXXXXX                     |
    | config_drive |                                      |
    | created      | 2012-07-06T09:30:22Z                 |
    | flavor       | cc.basic                             |
    | hostId       |                                      |
    | id           | 2079                                 |
    | image        | cc-sl6.x86_64                        |
    | key_name     | mykey                                |
    | metadata     | {}                                   |
    | name         | myserver                             |
    | progress     | 0                                    |
    | status       | BUILD                                |
    | tenant_id    | demotenant                           |
    | updated      | 2012-07-06T09:30:23Z                 |
    | user_id      | demouser                             |
    | uuid         | e455d901-510c-4a37-86a3-e7458cadd3ab |
    +--------------+--------------------------------------+
    
    • cc-sl6.x86_64: name of the image to be instantiated (list the available images with euca- describe-images)

    • mykey: name of the SSH key created previously

    • cc.basic: chosen instance type

    • ccdev-public: chosen network (list the available networks with openstack network list)

    For more information, check the Available flavors page.

  • Deleting an instance is like turning off the virtual machine. Changes made to the image will be lost (unless you make a snapshot beforehand).

    % openstack server delete myserver
    

Pause and restart

  • Pause a VM is like freezing it, like a STOP signal for a Unix process. Memory resources are still used:

    % openstack server pause myserver
    
    % openstack server list
    +--------------+------------+--------+------------------------------------+
    |      ID      |    Name    | Status |              Networks              |
    +--------------+------------+--------+------------------------------------+
    | ad4c5a21c5e5 | myserver   | PAUSED | ccin2p3=172.17.0.14, 134.158.246.4 |
    +--------------+------------+--------+------------------------------------+
    
  • To restart a paused instance:

    % openstack server unpause myserver
    
    % openstack server list
    +--------------+------------+--------+------------------------------------+
    |      ID      |    Name    | Status |              Networks              |
    +--------------+------------+--------+------------------------------------+
    | ad4c5a21c5e5 | myserver   | ACTIVE | ccin2p3=172.17.0.14, 134.158.246.4 |
    +--------------+------------+--------+------------------------------------+
    

Suspend and restart

  • Once a VM is suspended, a snapshot of its memory and disk is taken and the machine is deleted. With the exception of the stored snapshots, the instance is not consuming any resource:

    % openstack server suspend myserver
    
    % openstack server list
    +--------------+------------+-----------+------------------------------------+
    |      ID      |    Name    | Status    |              Networks              |
    +--------------+------------+-----------+------------------------------------+
    | ad4c5a21c5e5 | myserver   | SUSPENDED | ccin2p3=172.17.0.14, 134.158.246.4 |
    +--------------+------------+-----------+------------------------------------+
    
  • To restart a suspended instance

    % openstack server resume myserver
    
    % openstack server list
    +--------------+------------+--------+------------------------------------+
    |      ID      |    Name    | Status |              Networks              |
    +--------------+------------+--------+------------------------------------+
    | ad4c5a21c5e5 | myserver   | ACTIVE | ccin2p3=172.17.0.14, 134.158.246.4 |
    +--------------+------------+--------+------------------------------------+
    

Instances metadata

When booting, an information file (key/values, yamls, scripts…) may be transferred to the instances:

% nova boot --user-data $FILE [...]

This file may then be accessed from thhe instance by using the Nova metadata service:

% curl http://169.254.169.254/2009-04-04/user-data

Attention

Metadata are not encrypted during transfer or when stored and their access is not secured. It is thus not recommended to use it to store sensible information.