DynamicFlavors
Blueprint: https://blueprints.launchpad.net/nova/+spec/no-flavors
Contents
Use Cases
As an OpenStack API user, I want to create servers using custom CPU, RAM, Disk, and extra_specs instead of a pre-configured flavor.
As an OpenStack API user, I want to resize a server using custom CPU, RAM, Disk, and extra_specs instead of a pre-configured flavor.
As an OpenStack Administrator, I want to control through policy the ability to use custom flavor during a create or resize operation.
Implementation
This functionality would be delivered as an extension to the existing create and resize APIs and authorized using a common extension authorizer. Default setting would be for admin-only access to maintain current behavior that only admins can create new flavors.
When a "flavor" element is encountered in the request, a MD5 hash is computed and a matching hash looked for among existing flavors. If no match is found, a new, non-public flavor is created. The flavor element is then replaced with a flavorRef element and processing continues as-is today.
External Interfaces
(Post the JSON or XML require to the URI below. Response is unchanged.)
Create Server
POST /v2/{tenant_id}/servers
JSON
{ "server" : { "name" : "new-server-test", "imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b", "flavor" : { "ram" : "1024", "vcpus" : "1", "disk" : "29" } } }
XML
<?xml version="1.0" encoding="UTF-8"?> <server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" name="new-server-test"> <flavor ram="1024" vcpus="1" disk="29"/> </server>
Resize Server
POST /v2/{tenant_id}/servers/{server_id}/action
JSON
{ "resize" : { "flavor" : { "ram" : "%(ram)s", "vcpus" : "%(vcpus)s", "disk" : "%(disk)s" } } }
XML
<?xml version="1.0" encoding="UTF-8"?> <resize xmlns="http://docs.openstack.org/compute/api/v1.1"> <flavor ram="%(ram)s" vcpus="%(vcpus)s" disk="%(disk)s"/> </resize>