Compute

Last updated: 24/08/2023

Note

This documentation is under development, therefore it may not be complete or have incorrect information and it will be regularly updated.

Resize a disk

To perform a disk resize it is necessary to ensure that the volume is detached/disconnected from any instance (VM). The following procedure can be performed on the VMCloud portal:

  1. Shut down the instance (VM);

  2. Detach volume from instance (Project -> Volumes -> Volumes -> Manage Attachments);

  3. Resize the volume (Project -> Volumes -> Volumes -> Extend Volume);

  4. Attach the volume back to the instance.

If the volume in question is the boot/root volume where the operating system is installed it is expected that you will not be able to detach it from the instance.

Warning

It should be noted that this procedure implies the creation of a new instance with a new IP and identifier!

Warning

Deleting the instance should only be considered if the “Delete Volume on Instance Delete” configuration defined by default (default = NO) at the initial VM creation was not changed. Either way, we safely recommend that a volume snapshot should be first performed to safeguard the volume content!

In that case you will need to:

  1. Shut down the instance (VM);

  2. Delete the instance (Project -> Compute -> Instances -> Delete Instance);

  3. Resize the volume (Project -> Volumes -> Volumes -> Extend Volume);

  4. Create a new instance choosing the resized volume as the “Boot Source” for the new instance.

Resize an instance

The flavor of a running instance can be changed at any given time. This can be done on the Project -> Compute -> Instances page by choosing the Resize Instance option on the desired instance. This action involves at least one instance reboot.

Here are the steps for a flavor resize:

  1. Choose the new flavor. Beware that if the instance has an ephemeral main disk, i.e. it is not a volume, resizing to a flavor that has a lower sized disk will not work and the operation will not continue, although no error is displayed.

  2. The instance is rebooted with the new flavor and the Confirm Resize/Migrate and Revert Resize/Migrate buttons will be available. You can login into the instance and check if it is working correctly with the new vCPu and RAM values. Additionally, if the instance has an ephemeral main disk, i.e. it is not a volume, then you’ll check that the disk was resized as well.

  3. Confirm the operation by clicking on the Confirm Resize/Migrate button or reject it by clicking on the Revert Resize/Migrate button, which will reboot the instance again into the previous flavor.

Download an instance

The export of virtual machines (VMs) can be done by the user through the OpenStack command-line client (CLI). To create the file with the variables needed to use the OpenStack CLI you should follow the instructions provided here.

It should be noted that the process of downloading an instance will depend on how the VMs were created, that is, with or without volume (ephemeral or persistent storage).

Case A - For VMs without volumes:

For VMs that were created without volumes, it will be necessary to create a snapshot of each of the instances and then download the corresponding images. After stopping the instances, snapshots can be taken through the VMCloud web interface at Project -> Compute -> Instances -> Create Snapshot.

Case B - For VMs with volumes:

For VMs that were created with volumes, it will be necessary to transform each of the volumes into images and only then download each of the respective images. To make it possible to transform volumes into images, it will be necessary to ensure that each volume is not associated (attached) to any VM. If this condition is verified, the images of each volume can be created through the VMCloud web interface in Project -> Volumes -> Volumes -> Upload to Image, to later be downloaded. If it is not possible to satisfy the previous condition (separate/detach the volumes from the respective VMs since it’s a root volume), it will be necessary to carry out an intermediate step, that is, create a snapshot of each of the volumes (Project -> Volumes -> Volumes -> Create Snapshot) and then turn each of the snapshots back into volumes (Project -> Volumes -> Snapshots -> Create Volume). All these steps can only be performed through the VMCloud web interface after stopping the instances. At the end of this process, it will then be possible to create the images of each of the volumes (Project -> Volumes -> Volumes -> Upload to Image), to be downloaded later.

After creating the images, they can be downloaded using the OpenStack CLI. After installing the python-openstackclient package via pip, just follow these instructions:

  1. Create the file with the variables needed to use the CLI. Follow the instructions provided here.

  2. Check status and image ID

$ openstack image list
  1. Download the image.
$ openstack image save --file <-FILENAME->.raw <-IMAGE-ID->

Upload an instance

To import a new image to the VMCloud project, the OpenStack CLI must be used as follows:

  1. Create the file with the variables needed to use the CLI. Follow the instructions provided here.

  2. To upload the image to the project run the following command:

$ openstack image create --file <-FILENAME-> <-IMAGE-NAME->

After this process, you will now be able to see that the new image is already listed in Project -> Compute -> Images. This image can now be used to launch a new VM.

Server Groups

You can create server groups that have a policy that defines where the instances will be launched. For example, if you want to launch multiple instances and guarantee that they are on the same host or not, you can assign one server group with the desired policy. On the Project -> Compute Server Groups page, you can manage them.

Each server group must have one of the following policies and instances will be launched and organized according to it:

  • Affinity - All instances/servers launched in this group will be hosted on the same compute node or fail if the same compute node is not available.

  • Anti-affinity - All instances/servers launched in this group will be hosted on different compute nodes or fail if it not possible.

  • Soft-affinity - All instances/servers launched in this group will be hosted on the same compute node if possible, but if not possible they still will be scheduled instead of failure.

  • Soft-anti-affinity - All instances/servers launched in this group will be hosted on different compute nodes if possible, but if not possible they still will be scheduled instead of failure.

GPU usage

Flavors of “g” type have GPUs available, however the available operating system images available do not have those GPUs configured. The following steps configured GPUs on a instance with g1.small flavor and Ubuntu-Bionic-Latest image:

  1. Download the NVIDIA driver available in https://www.nvidia.com/Download/driverResults.aspx/160182/en-us into the instance. Beware that this link might not be the most recent one, therefore search the driver according to the specifications indicated on the Flavor page.
  2. Run sudo lspci to check if the output indicates the GPU.
  3. Install the corresponding kernel headers with sudo apt install linux-headers-4.15.0-124-generic. Change the package version according to the output in uname -a
  4. Deactivate the default Ubuntu driver for the GPU with sudo modprobe -r nouveau.
  5. Run the installer that was downloaded with sudo ./NVIDIA-Linux-x86_64-390.138.run. In this step, select the option to install the driver with “dkms” in future kernel changes and select “OK” on the messages related to “X org” and 32bit installation.

    Beware that the installation might fail and only show errors on the interactive mode, so read carefully every message. The last message should be “Installation of the kernel module for the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version 390.138) is now complete.”

  6. Afterwards run the nvidia-smi command that should list the GPU, like this:
    # nvidia-smi
    Tue Nov 24 17:20:42 2020
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 390.138                Driver Version: 390.138                   |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  Tesla M2075         Off  | 00000000:00:05.0 Off |                    0 |
    | N/A   N/A    P0    79W /  N/A |      0MiB /  5301MiB |      0%      Default |
    +-------------------------------+----------------------+----------------------+
    
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |  No running processes found                                                 |
    +-----------------------------------------------------------------------------+
    

    If this command is not available or the output does not list the GPU, then confirm that the instance has a flavor of g type, also if there is a more recent driver and that the installed linux headers package has the exact version as the kernel and re-run the steps.