Skip to content

Cloud Providers: Openstack

Matt Pryor edited this page Jan 10, 2018 · 7 revisions

This page details the configuration required for the JASMIN Cloud API to consume projects from an Openstack cloud.

The code for this implementation lives in the jasmin_cloud.provider.openstack module, and interacts with the Openstack API using the Openstack Python SDK.

Project configuration

The following networking configuration is required for each project:

  1. A project should have a single router.
  2. A project should have an internal network that is not shared with other projects, with a single subnet.
  3. The router's external gateway should be connected to an external network where floating IPs can be allocated.
  4. The router should have an interface connected to the network in (2).
  5. No other networks should be connected to the router.

All machines provisioned in a project will be attached to the network in (2) as their primary network. The network is located by finding the network attached to the first port where device_owner = 'network:router_interface'. This is only guaranteed to find the network from (2) if (1), (4) and (5) are true.

Image configuration

The following pieces of metadata can be set on an image. If they are not set, the default is used instead.

Name Description Default
jasmin:host_type The host type that the image is for. This is passed to the activator script.

This is useful if you want to use the same activator script in multiple images with only slight changes in behaviour.
UNKNOWN
jasmin:nat_allowed Indicates if machines provisioned from the image are permitted to have an external IP. Should be either 0 (not allowed) or 1 (allowed). 1

This metadata can be set in the Horizon UI by navigating to the image list and selecting "Update Metadata" for the image. In the resulting dialog, enter the metadata name in the box labelled "Custom" under "Available Metadata" and click "+". This will cause an entry to appear in the "Existing Metadata" section, where you can enter a value. Once you are happy click "Save".

Setting Openstack Image Metadata

Activator script

Each image for use with the JASMIN Cloud API should have an "activator script" baked into it that performs image-specific setup tasks. This script is called by the cloud-init script that is supplied as user data when a machine is deployed through the JASMIN Cloud API.

This script should live at /usr/local/bin/os-activator.sh, and receives the following arguments (in the listed order):

Name Description
ssh_key The SSH public key of the user that deployed the machine.
tenancy The name of the tenancy that the machine is deployed in.
vm_type The type of the machine. This is the value of the jasmin:host_type metadata for the image being used (see above).
uuid A randomly allocated UUID for the machine.
Clone this wiki locally