5.2. Creating flavors

POST /flavors

Create a flavor.

Source: https://docs.openstack.org/api-ref/compute/?expanded=#create-flavor

5.2.1. Request

Name In Type Description
flavor body object The ID and links for the flavor for your server instance. A flavor is a combination of memory, disk size, and CPUs.
name body string The display name of a flavor.
description (Optional) body string

A free form description of the flavor. Limited to 65535 characters in length. Only printable characters are allowed.

New in version 2.55

id (Optional) body string The ID of the flavor. While people often make this look like an int, this is really a string. If not provided, this defaults to a uuid.
ram body integer The amount of RAM a flavor has, in MiB.
disk body integer

The size of the root disk that will be created in GiB. If 0 the root disk will be set to exactly the size of the image used to deploy the instance. However, in this case filter scheduler cannot select the compute host based on the virtual image size. Therefore, 0 should only be used for volume-booted instances or for testing purposes. Volume-backed instances can be enforced for flavors with zero root disk via the os_compute_api:servers:create:zero_disk_flavor policy rule.

Note

This platform supports only volume-booted instances, so this parameter value should be 0.

vcpus body integer The number of virtual CPUs that will be allocated to the server.
OS-FLV-EXT-DATA:ephemeral (Optional) body integer The size of the ephemeral disk that will be created, in GiB. Ephemeral disks may be written over on server state changes. So should only be used as a scratch space for applications that are aware of its limitations. Defaults to 0.
swap (Optional) body integer The size of a dedicated swap disk that will be allocated, in MiB. If 0 (the default), no dedicated swap disk will be created.
rxtx_factor (Optional) body float The receive / transmit factor (as a float) that will be set on ports if the network backend supports the QOS extension. Otherwise it will be ignored. It defaults to 1.0.
os-flavor-access:is_public (Optional) body boolean Whether the flavor is public (available to all projects) or scoped to a set of projects. Default is True if not specified.

5.2.1.1. Example

# curl -ks -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "flavor": {
        "name": "flavor1",
        "ram": 1024,
        "vcpus": 2,
        "disk": 0
    }
}' https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/flavors

5.2.2. Response

Name In Type Description
flavor body object The ID and links for the flavor for your server instance. A flavor is a combination of memory, disk size, and CPUs.
name body string The display name of a flavor.
description body string

The description of the flavor.

New in version 2.55

id body string The ID of the flavor. While people often make this look like an int, this is really a string.
ram body integer The amount of RAM a flavor has, in MiB.
disk body integer

The size of the root disk that will be created in GiB. If 0 the root disk will be set to exactly the size of the image used to deploy the instance. However, in this case filter scheduler cannot select the compute host based on the virtual image size. Therefore, 0 should only be used for volume-booted instances or for testing purposes. Volume-backed instances can be enforced for flavors with zero root disk via the os_compute_api:servers:create:zero_disk_flavor policy rule.

Note

This platform supports only volume-booted instances, so this parameter value should be 0.

vcpus body integer The number of virtual CPUs that will be allocated to the server.
links body array Links to the resources in question. See API Guide / Links and References for more info.
OS-FLV-EXT-DATA:ephemeral body integer The size of the ephemeral disk that will be created, in GiB. Ephemeral disks may be written over on server state changes. So should only be used as a scratch space for applications that are aware of its limitations. Defaults to 0.
OS-FLV-DISABLED:disabled (Optional) body boolean Whether or not the flavor has been administratively disabled. This is typically only visible to administrative users.
swap body integer The size of a dedicated swap disk that will be allocated, in MiB. If 0 (the default), no dedicated swap disk will be created. Currently, the empty string (‘’) is used to represent 0. As of microversion 2.75 default return value of swap is 0 instead of empty string.
rxtx_factor body float The receive / transmit factor (as a float) that will be set on ports if the network backend supports the QOS extension. Otherwise it will be ignored. It defaults to 1.0.
os-flavor-access:is_public body boolean Whether the flavor is public (available to all projects) or scoped to a set of projects. Default is True if not specified.
extra_specs (Optional) body object

A dictionary of the flavor’s extra-specs key-and-value pairs. This will only be included if the user is allowed by policy to index flavor extra_specs.

New in version 2.61

5.2.2.1. Status codes

5.2.2.1.1. Success

Code Reason
200 - OK Request was successful.

5.2.2.1.2. Error

Code Reason
400 - Bad Request Some content in the request was invalid.
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.
409 - Conflict This operation conflicted with another operation on this resource.

5.2.2.2. Example

{
  "flavor": {
    "links": [
      {
        "href": "https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/flavors/2ff017d3-55f0-4906-8908-8a1bb4e00e6d",
        "rel": "self"
      },
      {
        "href": "https://<node_IP_addr>:8774/f5d834d636c642c7bfe8af86139c6f26/flavors/2ff017d3-55f0-4906-8908-8a1bb4e00e6d",
        "rel": "bookmark"
      }
    ],
    "ram": 1024,
    "OS-FLV-DISABLED:disabled": false,
    "os-flavor-access:is_public": true,
    "rxtx_factor": 1,
    "disk": 0,
    "id": "2ff017d3-55f0-4906-8908-8a1bb4e00e6d",
    "name": "flavor1",
    "vcpus": 2,
    "swap": "",
    "OS-FLV-EXT-DATA:ephemeral": 0
  }
}