OpenStack

OpenStack is a toolkit for building private and public clouds. This application adds support for managing OpenStack deployments - tenants, instances, security groups and networks.

/api/openstack/

Supported actions and methods:

/api/openstack/

Methods: GET, POST

Supported fields for creation:

  • project – link to /api/projects/<uuid>/
  • customerlink to /api/customers/<uuid>/
  • settingslink to /api/service-settings/<uuid>/
  • backend_urlURL (Keystone auth URL (e.g. http://keystone.example.com:5000/v3))
  • usernamestring (Administrative user)
  • passwordstring
  • domain – string (Domain name. If not defined default domain will be used.)
  • available_for_all – boolean (Service will be automatically added to all customers projects if it is available for all)
  • scope – link to any: /api/openstack-tenants/<uuid>/, /api/openstacktenant-volumes/<uuid>/, /api/openstacktenant-snapshots/<uuid>/, /api/openstacktenant-instances/<uuid>/, /api/openstacktenant-backup-schedules/<uuid>/, /api/openstacktenant-snapshot-schedules/<uuid>/ (VM that contains service)
  • create_ha_routers – string (Create highly available Neutron routers.)
  • external_network_id – string (ID of OpenStack external network that will be connected to tenants)
  • availability_zone – string (Default availability zone for provisioned instances)
  • latitude – string (Latitude of the datacenter (e.g. 40.712784))
  • tenant_namestring ( (default: “admin”))
  • access_url – string (Publicly accessible OpenStack dashboard URL)
  • flavor_exclude_regex – string (Flavors matching this regex expression will not be pulled from the backend.)
  • dns_nameservers – string (Default value for new subnets DNS name servers. Should be defined as list.)
  • longitude – string (Longitude of the datacenter (e.g. -74.005941))

To create a service, issue a POST to /api/openstack/ as a customer owner.

You can create service based on shared service settings. Example:

POST /api/openstack/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "Common OpenStack",
    "customer": "http://example.com/api/customers/1040561ca9e046d2b74268600c7e1105/",
    "settings": "http://example.com/api/service-settings/93ba615d6111466ebe3f792669059cb4/"
}

Or provide your own credentials. Example:

POST /api/openstack/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "My OpenStack",
    "customer": "http://example.com/api/customers/1040561ca9e046d2b74268600c7e1105/",
    "backend_url": "http://keystone.example.com:5000/v2.0",
    "username": "admin",
    "password": "secret"
}

/api/openstack/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • available_for_all – boolean (Service will be automatically added to all customers projects if it is available for all)

To update OpenStack service issue PUT or PATCH against /api/openstack/<service_uuid>/ as a customer owner. You can update service’s name and available_for_all fields.

Example of a request:

PUT /api/openstack/c6526bac12b343a9a65c4cd6710666ee/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "My OpenStack2"
}

To remove OpenStack service, issue DELETE against /api/openstack/<service_uuid>/ as staff user or customer owner.

/api/openstack/<uuid>/link/

Methods: GET, POST

To get a list of resources available for import, run GET against /<service_endpoint>/link/ as an authenticated user. Optionally project_uuid parameter can be supplied for services requiring it like OpenStack.

To import (link with NodeConductor) resource issue POST against the same endpoint with resource id.

POST /api/openstack/08039f01c9794efc912f1689f4530cf0/link/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "backend_id": "bd5ec24d-9164-440b-a9f2-1b3c807c5df3",
    "project": "http://example.com/api/projects/e5f973af2eb14d2d8c38d62bcbaccb33/"
}

/api/openstack/<uuid>/managed_resources/

Methods: GET

/api/openstack/<uuid>/unlink/

Methods: POST

Unlink all related resources, service project link and service itself.

/api/openstack-tenants/

Supported actions and methods:

/api/openstack-tenants/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • tags – TagListSerializerField
  • service_project_linklink to /api/openstack-service-project-link/<pk>/
  • availability_zone – string (Optional availability group. Will be used for all instances provisioned in this tenant)
  • user_username – string
  • subnet_cidr – string

/api/openstack-tenants/import_resource/

Methods: POST

/api/openstack-tenants/importable_resources/

Methods: GET

/api/openstack-tenants/<uuid>/

Methods: GET, POST, PUT, PATCH, DELETE

/api/openstack-tenants/<uuid>/change_password/

Methods: POST

/api/openstack-tenants/<uuid>/create_floating_ip/

Methods: POST

/api/openstack-tenants/<uuid>/create_network/

Methods: POST

/api/openstack-tenants/<uuid>/create_security_group/

Methods: POST

Example of a request:

{
    "name": "Security group name",
    "description": "description",
    "rules": [
        {
            "protocol": "tcp",
            "from_port": 1,
            "to_port": 10,
            "cidr": "10.1.1.0/24"
        },
        {
            "protocol": "udp",
            "from_port": 10,
            "to_port": 8000,
            "cidr": "10.1.1.0/24"
        }
    ]
}

/api/openstack-tenants/<uuid>/pull/

Methods: POST

/api/openstack-tenants/<uuid>/pull_floating_ips/

Methods: POST

/api/openstack-tenants/<uuid>/pull_quotas/

Methods: POST

/api/openstack-tenants/<uuid>/pull_security_groups/

Methods: POST

/api/openstack-tenants/<uuid>/set_quotas/

Methods: POST

A quota can be set for a particular tenant. Only staff users can do that. In order to set quota submit POST request to /api/openstack-tenants/<uuid>/set_quotas/. The quota values are propagated to the backend.

The following quotas are supported. All values are expected to be integers:

  • instances - maximal number of created instances.
  • ram - maximal size of ram for allocation. In MiB.
  • storage - maximal size of storage for allocation. In MiB.
  • vcpu - maximal number of virtual cores for allocation.
  • security_group_count - maximal number of created security groups.
  • security_group_rule_count - maximal number of created security groups rules.
  • volumes - maximal number of created volumes.
  • snapshots - maximal number of created snapshots.

It is possible to update quotas by one or by submitting all the fields in one request. NodeConductor will attempt to update the provided quotas. Please note, that if provided quotas are conflicting with the backend (e.g. requested number of instances is below of the already existing ones), some quotas might not be applied.

Example of a valid request (token is user specific):

POST /api/openstack-tenants/c84d653b9ec92c6cbac41c706593e66f567a7fa4/set_quotas/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: example.com

{
    "instances": 30,
    "ram": 100000,
    "storage": 1000000,
    "vcpu": 30,
    "security_group_count": 100,
    "security_group_rule_count": 100,
    "volumes": 10,
    "snapshots": 20
}

Response code of a successful request is 202 ACCEPTED. In case tenant is in a non-stable status, the response would be 409 CONFLICT. In this case REST client is advised to repeat the request after some time. On successful completion the task will synchronize quotas with the backend.

/api/openstack-subnets/

Supported actions and methods:

/api/openstack-subnets/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • tags – TagListSerializerField
  • cidr – string

/api/openstack-subnets/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • description – string
  • tags – TagListSerializerField

/api/openstack-subnets/<uuid>/pull/

Methods: POST

/api/openstack-security-groups/

Supported actions and methods:

/api/openstack-security-groups/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • tags – TagListSerializerField
  • ruleslist of [{to_port: integer, cidr: string, from_port: integer, protocol: choice('icmp', 'tcp', 'udp')}]

/api/openstack-security-groups/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • description – string
  • tags – TagListSerializerField

/api/openstack-security-groups/<uuid>/pull/

Methods: POST

/api/openstack-security-groups/<uuid>/set_rules/

Methods: POST

WARNING! Auto-generated HTML form is wrong for this endpoint. List should be defined as input.

Example: [

{
“protocol”: “tcp”, “from_port”: 1, “to_port”: 10, “cidr”: “10.1.1.0/24”

}

]

/api/openstack-networks/

Supported actions and methods:

/api/openstack-networks/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • tags – TagListSerializerField

/api/openstack-networks/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • description – string
  • tags – TagListSerializerField

/api/openstack-networks/<uuid>/create_subnet/

Methods: POST

/api/openstack-networks/<uuid>/pull/

Methods: POST

/api/openstack-images/

Supported actions and methods:

/api/openstack-images/

Methods: GET

/api/openstack-images/<uuid>/

Methods: GET

/api/openstack-floating-ips/

Supported actions and methods:

/api/openstack-floating-ips/

Methods: GET, POST

Supported fields for creation:

  • tags – TagListSerializerField

To get a list of all available floating IPs, issue GET against /api/floating-ips/. Floating IPs are read only. Each floating IP has fields: ‘address’, ‘status’.

Status DOWN means that floating IP is not linked to a VM, status ACTIVE means that it is in use.

/api/openstack-floating-ips/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • tags – TagListSerializerField

/api/openstack-floating-ips/<uuid>/pull/

Methods: POST

/api/openstack-flavors/

VM instance flavor is a pre-defined set of virtual hardware parameters that the instance will use: CPU, memory, disk size etc. VM instance flavor is not to be confused with VM template – flavor is a set of virtual hardware parameters whereas template is a definition of a system to be installed on this instance.

Supported actions and methods:

/api/openstack-flavors/

Methods: GET

VM instance flavor is a pre-defined set of virtual hardware parameters that the instance will use: CPU, memory, disk size etc. VM instance flavor is not to be confused with VM template – flavor is a set of virtual hardware parameters whereas template is a definition of a system to be installed on this instance.

/api/openstack-flavors/<uuid>/

Methods: GET

VM instance flavor is a pre-defined set of virtual hardware parameters that the instance will use: CPU, memory, disk size etc. VM instance flavor is not to be confused with VM template – flavor is a set of virtual hardware parameters whereas template is a definition of a system to be installed on this instance.