Multiple API cleanup changes

This microversion implements below API cleanups:

1. 400 for unknown param for query param and for request body.

2. Making server representation always consistent among all APIs
   returning the complete server representation.

3. Change the default return value of ``swap`` field from the empty string
   to 0 (integer) in flavor APIs.

4. Return ``servers`` field always in the response of GET
   hypervisors API even there are no servers on hypervisor

Details: https://specs.openstack.org/openstack/nova-specs/specs/train/approved/api-consistency-cleanup.html

Partial-Implements: blueprint api-consistency-cleanup

Change-Id: I9d257a003d315b84b937dcef91f3cb41f3e24b53
changes/89/666889/14
Ghanshyam Mann 2019-06-26 17:30:46 +00:00 committed by Eric Fried
parent 52b9359d6c
commit b26bc7fd7a
74 changed files with 2473 additions and 164 deletions

View File

@ -108,9 +108,9 @@ Response
- extra_specs: extra_specs_2_61
**Example Create Flavor (v2.61)**
**Example Create Flavor (v2.75)**
.. literalinclude:: ../../doc/api_samples/flavor-manage/v2.61/flavor-create-post-resp.json
.. literalinclude:: ../../doc/api_samples/flavor-manage/v2.75/flavor-create-post-resp.json
:language: javascript
List Flavors With Details
@ -158,9 +158,9 @@ Response
- os-flavor-access:is_public: flavor_is_public
- extra_specs: extra_specs_2_61
**Example List Flavors With Details (v2.61)**
**Example List Flavors With Details (v2.75)**
.. literalinclude:: ../../doc/api_samples/flavors/v2.61/flavors-detail-resp.json
.. literalinclude:: ../../doc/api_samples/flavors/v2.75/flavors-detail-resp.json
:language: javascript
Show Flavor Details
@ -201,9 +201,9 @@ Response
- os-flavor-access:is_public: flavor_is_public
- extra_specs: extra_specs_2_61
**Example Show Flavor Details (v2.61)**
**Example Show Flavor Details (v2.75)**
.. literalinclude:: ../../doc/api_samples/flavors/v2.61/flavor-get-resp.json
.. literalinclude:: ../../doc/api_samples/flavors/v2.75/flavor-get-resp.json
:language: javascript
Update Flavor Description
@ -258,9 +258,9 @@ Response
- extra_specs: extra_specs_2_61
**Example Update Flavor Description (v2.61)**
**Example Update Flavor Description (v2.75)**
.. literalinclude:: ../../doc/api_samples/flavor-manage/v2.61/flavor-update-resp.json
.. literalinclude:: ../../doc/api_samples/flavor-manage/v2.75/flavor-update-resp.json
:language: javascript
Delete Flavor

View File

@ -3074,6 +3074,8 @@ flavor_swap:
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.
in: body
required: true
type: integer
@ -3519,6 +3521,20 @@ host_status_body_in:
in: body
required: false
type: string
host_status_update_rebuild:
description: |
The host status. Values where next value in list can override the previous:
- ``UP`` if nova-compute up.
- ``UNKNOWN`` if nova-compute not reported by servicegroup driver.
- ``DOWN`` if nova-compute forced down.
- ``MAINTENANCE`` if nova-compute is disabled.
- Empty string indicates there is no host for server.
This attribute appears in the response only if the policy permits.
By default, only administrators can get this parameter.
in: body
required: false
type: string
min_version: 2.75
host_zone:
description: |
The available zone of the host.
@ -3650,8 +3666,10 @@ hypervisor_os_diagnostics:
hypervisor_servers:
description: |
A list of ``server`` objects.
This field has become mandatory in microversion 2.75. If no servers is on hypervisor
then empty list is returned.
in: body
required: false
required: true
type: array
min_version: 2.53
hypervisor_servers_name:
@ -4140,6 +4158,13 @@ key_name_resp:
in: body
required: true
type: string
key_name_resp_update:
description: |
The name of associated key pair, if any.
in: body
required: true
type: string
min_version: 2.75
key_pairs: &key_pairs
description: |
The number of allowed key pairs for each user.
@ -4730,6 +4755,13 @@ name_server_group:
in: body
required: true
type: string
name_update_rebuild:
description: |
The security group name.
in: body
required: true
type: string
min_version: 2.75
namespace:
description: |
A URL pointing to the namespace for this extension.
@ -4970,6 +5002,13 @@ OS-EXT-AZ:availability_zone_optional:
in: body
required: false
type: string
OS-EXT-AZ:availability_zone_update_rebuild:
description: |
The availability zone name.
in: body
required: true
type: string
min_version: 2.75
OS-EXT-SRV-ATTR:host:
description: |
The name of the compute host on which this instance is running.
@ -4977,6 +5016,14 @@ OS-EXT-SRV-ATTR:host:
in: body
required: true
type: string
OS-EXT-SRV-ATTR:host_update_rebuild:
description: |
The name of the compute host on which this instance is running.
Appears in the response for administrative users only.
in: body
required: true
type: string
min_version: 2.75
OS-EXT-SRV-ATTR:hypervisor_hostname:
description: |
The hypervisor host name provided by the Nova virt driver. For the Ironic driver,
@ -4984,6 +5031,14 @@ OS-EXT-SRV-ATTR:hypervisor_hostname:
in: body
required: true
type: string
OS-EXT-SRV-ATTR:hypervisor_hostname_update_rebuild:
description: |
The hypervisor host name provided by the Nova virt driver. For the Ironic driver,
it is the Ironic node uuid. Appears in the response for administrative users only.
in: body
required: true
type: string
min_version: 2.75
OS-EXT-SRV-ATTR:instance_name:
description: |
The instance name. The Compute API generates the instance name from the instance
@ -4991,6 +5046,14 @@ OS-EXT-SRV-ATTR:instance_name:
in: body
required: true
type: string
OS-EXT-SRV-ATTR:instance_name_update_rebuild:
description: |
The instance name. The Compute API generates the instance name from the instance
name template. Appears in the response for administrative users only.
in: body
required: true
type: string
min_version: 2.75
OS-EXT-STS:power_state:
description: |
The power state of the instance. This is an enum value that is mapped as::
@ -5004,18 +5067,46 @@ OS-EXT-STS:power_state:
in: body
required: true
type: integer
OS-EXT-STS:power_state_update_rebuild:
description: |
The power state of the instance. This is an enum value that is mapped as::
0: NOSTATE
1: RUNNING
3: PAUSED
4: SHUTDOWN
6: CRASHED
7: SUSPENDED
in: body
required: true
type: integer
min_version: 2.75
OS-EXT-STS:task_state:
description: |
The task state of the instance.
in: body
required: true
type: string
OS-EXT-STS:task_state_update_rebuild:
description: |
The task state of the instance.
in: body
required: true
type: string
min_version: 2.75
OS-EXT-STS:vm_state:
description: |
The VM state.
in: body
required: true
type: string
OS-EXT-STS:vm_state_update_rebuild:
description: |
The VM state.
in: body
required: true
type: string
min_version: 2.75
os-extended-volumes:volumes_attached:
description: |
The attached volumes, if any.
@ -5032,12 +5123,36 @@ os-extended-volumes:volumes_attached.delete_on_termination:
required: true
type: boolean
min_version: 2.3
os-extended-volumes:volumes_attached.delete_on_termination_update_rebuild:
description: |
A flag indicating if the attached volume will be deleted
when the server is deleted. By default this is False and
can only be set when creating a volume while creating a
server, which is commonly referred to as boot from volume.
in: body
required: true
type: boolean
min_version: 2.75
os-extended-volumes:volumes_attached.id:
description: |
The attached volume ID.
in: body
required: true
type: string
os-extended-volumes:volumes_attached.id_update_rebuild:
description: |
The attached volume ID.
in: body
required: true
type: string
min_version: 2.75
os-extended-volumes:volumes_attached_update_rebuild:
description: |
The attached volumes, if any.
in: body
required: true
type: array
min_version: 2.75
os-getConsoleOutput:
description: |
The action to get console output of the server.
@ -5151,6 +5266,24 @@ OS-SRV-USG:launched_at:
in: body
required: true
type: string
OS-SRV-USG:launched_at_update_rebuild:
description: |
The date and time when the server was launched.
The date and time stamp format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_:
::
CCYY-MM-DDThh:mm:ss±hh:mm
For example, ``2015-08-27T09:49:58-05:00``.
The ``hh±:mm`` value, if included, is the time zone as an offset from UTC.
If the ``deleted_at`` date and time stamp is not set, its value is ``null``.
in: body
required: true
type: string
min_version: 2.75
OS-SRV-USG:terminated_at:
description: |
The date and time when the server was deleted.
@ -5167,6 +5300,23 @@ OS-SRV-USG:terminated_at:
in: body
required: true
type: string
OS-SRV-USG:terminated_at_update_rebuild:
description: |
The date and time when the server was deleted.
The date and time stamp format is `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_:
::
CCYY-MM-DDThh:mm:ss±hh:mm
For example, ``2015-08-27T09:49:58-05:00``.
The ``±hh:mm`` value, if included, is the time zone as an offset from UTC.
If the ``deleted_at`` date and time stamp is not set, its value is ``null``.
in: body
required: true
type: string
min_version: 2.75
os-start:
description: |
The action to start a stopped server.
@ -5852,6 +6002,13 @@ security_groups_obj:
in: body
required: true
type: array
security_groups_obj_update_rebuild:
description: |
One or more security groups objects.
in: body
required: true
type: array
min_version: 2.75
security_groups_quota:
description: |
The number of allowed security groups for each tenant.
@ -6002,6 +6159,14 @@ server_hostname:
The hostname set on the instance when it is booted.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_hostname_update_rebuild:
in: body
required: false
type: string
description: |
The hostname set on the instance when it is booted.
By default, it appears in the response for administrative users only.
min_version: 2.75
# This is the hypervisor_hostname in a POST (create instance) request body.
server_hypervisor_hostname_create:
description: |
@ -6032,6 +6197,14 @@ server_kernel_id:
The UUID of the kernel image when using an AMI. Will be null if not.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_kernel_id_update_rebuild:
in: body
required: false
type: string
description: |
The UUID of the kernel image when using an AMI. Will be null if not.
By default, it appears in the response for administrative users only.
min_version: 2.75
server_launch_index:
in: body
required: false
@ -6041,6 +6214,15 @@ server_launch_index:
sequence in which the servers were launched.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_launch_index_update_rebuild:
in: body
required: false
type: integer
description: |
When servers are launched via multiple create, this is the
sequence in which the servers were launched.
By default, it appears in the response for administrative users only.
min_version: 2.75
server_links:
description: |
Links pertaining to the server. See `API Guide / Links and
@ -6070,6 +6252,14 @@ server_ramdisk_id:
The UUID of the ramdisk image when using an AMI. Will be null if not.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_ramdisk_id_update_rebuild:
in: body
required: false
type: string
description: |
The UUID of the ramdisk image when using an AMI. Will be null if not.
By default, it appears in the response for administrative users only.
min_version: 2.75
server_reservation_id:
in: body
required: false
@ -6080,6 +6270,16 @@ server_reservation_id:
create, that will all have the same reservation_id.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_reservation_id_update_rebuild:
in: body
required: false
type: string
description: |
The reservation id for the server. This is an id that can
be useful in tracking groups of servers created with multiple
create, that will all have the same reservation_id.
By default, it appears in the response for administrative users only.
min_version: 2.75
server_root_device_name:
in: body
required: false
@ -6088,6 +6288,14 @@ server_root_device_name:
The root device name for the instance
By default, it appears in the response for administrative users only.
min_version: 2.3
server_root_device_name_update_rebuild:
in: body
required: false
type: string
description: |
The root device name for the instance
By default, it appears in the response for administrative users only.
min_version: 2.75
server_status:
description: |
The server status.
@ -6169,6 +6377,14 @@ server_user_data:
The user_data the instance was created with.
By default, it appears in the response for administrative users only.
min_version: 2.3
server_user_data_update:
in: body
required: false
type: string
description: |
The user_data the instance was created with.
By default, it appears in the response for administrative users only.
min_version: 2.75
server_uuid:
description: |
The UUID of the server instance to which the API dispatches the event. You must

View File

@ -634,10 +634,31 @@ Response
- trusted_image_certificates: server_trusted_image_certificates_resp
- server_groups: server_groups_2_71
- locked_reason: locked_reason_resp
- OS-EXT-AZ:availability_zone: OS-EXT-AZ:availability_zone_update_rebuild
- OS-EXT-SRV-ATTR:host: OS-EXT-SRV-ATTR:host_update_rebuild
- OS-EXT-SRV-ATTR:hypervisor_hostname: OS-EXT-SRV-ATTR:hypervisor_hostname_update_rebuild
- OS-EXT-SRV-ATTR:instance_name: OS-EXT-SRV-ATTR:instance_name_update_rebuild
- OS-EXT-STS:power_state: OS-EXT-STS:power_state_update_rebuild
- OS-EXT-STS:task_state: OS-EXT-STS:task_state_update_rebuild
- OS-EXT-STS:vm_state: OS-EXT-STS:vm_state_update_rebuild
- OS-EXT-SRV-ATTR:hostname: server_hostname_update_rebuild
- OS-EXT-SRV-ATTR:reservation_id: server_reservation_id_update_rebuild
- OS-EXT-SRV-ATTR:launch_index: server_launch_index_update_rebuild
- OS-EXT-SRV-ATTR:kernel_id: server_kernel_id_update_rebuild
- OS-EXT-SRV-ATTR:ramdisk_id: server_ramdisk_id_update_rebuild
- OS-EXT-SRV-ATTR:root_device_name: server_root_device_name_update_rebuild
- os-extended-volumes:volumes_attached: os-extended-volumes:volumes_attached_update_rebuild
- os-extended-volumes:volumes_attached.id: os-extended-volumes:volumes_attached.id_update_rebuild
- os-extended-volumes:volumes_attached.delete_on_termination: os-extended-volumes:volumes_attached.delete_on_termination_update_rebuild
- OS-SRV-USG:launched_at: OS-SRV-USG:launched_at_update_rebuild
- OS-SRV-USG:terminated_at: OS-SRV-USG:terminated_at_update_rebuild
- security_groups: security_groups_obj_update_rebuild
- security_group.name: name_update_rebuild
- host_status: host_status_update_rebuild
**Example Rebuild Server (rebuild Action) (v2.73)**
**Example Rebuild Server (rebuild Action) (v2.75)**
.. literalinclude:: ../../doc/api_samples/servers/v2.73/server-action-rebuild-resp.json
.. literalinclude:: ../../doc/api_samples/servers/v2.75/server-action-rebuild-resp.json
:language: javascript
Remove (Disassociate) Floating Ip (removeFloatingIp Action) (DEPRECATED)

View File

@ -877,10 +877,33 @@ Response
- trusted_image_certificates: server_trusted_image_certificates_resp
- server_groups: server_groups_2_71
- locked_reason: locked_reason_resp
- OS-EXT-AZ:availability_zone: OS-EXT-AZ:availability_zone_update_rebuild
- OS-EXT-SRV-ATTR:host: OS-EXT-SRV-ATTR:host_update_rebuild
- OS-EXT-SRV-ATTR:hypervisor_hostname: OS-EXT-SRV-ATTR:hypervisor_hostname_update_rebuild
- OS-EXT-SRV-ATTR:instance_name: OS-EXT-SRV-ATTR:instance_name_update_rebuild
- OS-EXT-STS:power_state: OS-EXT-STS:power_state_update_rebuild
- OS-EXT-STS:task_state: OS-EXT-STS:task_state_update_rebuild
- OS-EXT-STS:vm_state: OS-EXT-STS:vm_state_update_rebuild
- OS-EXT-SRV-ATTR:hostname: server_hostname_update_rebuild
- OS-EXT-SRV-ATTR:reservation_id: server_reservation_id_update_rebuild
- OS-EXT-SRV-ATTR:launch_index: server_launch_index_update_rebuild
- OS-EXT-SRV-ATTR:kernel_id: server_kernel_id_update_rebuild
- OS-EXT-SRV-ATTR:ramdisk_id: server_ramdisk_id_update_rebuild
- OS-EXT-SRV-ATTR:root_device_name: server_root_device_name_update_rebuild
- OS-EXT-SRV-ATTR:user_data: server_user_data_update
- os-extended-volumes:volumes_attached: os-extended-volumes:volumes_attached_update_rebuild
- os-extended-volumes:volumes_attached.id: os-extended-volumes:volumes_attached.id_update_rebuild
- os-extended-volumes:volumes_attached.delete_on_termination: os-extended-volumes:volumes_attached.delete_on_termination_update_rebuild
- OS-SRV-USG:launched_at: OS-SRV-USG:launched_at_update_rebuild
- OS-SRV-USG:terminated_at: OS-SRV-USG:terminated_at_update_rebuild
- security_groups: security_groups_obj_update_rebuild
- security_group.name: name_update_rebuild
- host_status: host_status_update_rebuild
- key_name: key_name_resp_update
**Example Update Server (2.73)**
**Example Update Server (2.75)**
.. literalinclude:: ../../doc/api_samples/servers/v2.73/server-update-resp.json
.. literalinclude:: ../../doc/api_samples/servers/v2.75/server-update-resp.json
:language: javascript
Delete Server

View File

@ -0,0 +1,11 @@
{
"flavor": {
"name": "test_flavor",
"ram": 1024,
"vcpus": 2,
"disk": 10,
"id": "10",
"rxtx_factor": 2.0,
"description": "test description"
}
}

View File

@ -0,0 +1,26 @@
{
"flavor": {
"OS-FLV-DISABLED:disabled": false,
"disk": 10,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "10",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/10",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/10",
"rel": "bookmark"
}
],
"name": "test_flavor",
"ram": 1024,
"swap": 0,
"rxtx_factor": 2.0,
"vcpus": 2,
"description": "test description",
"extra_specs": {}
}
}

View File

@ -0,0 +1,5 @@
{
"flavor": {
"description": "updated description"
}
}

View File

@ -0,0 +1,26 @@
{
"flavor": {
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"ram": 512,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": "updated description",
"extra_specs": {}
}
}

View File

@ -0,0 +1,29 @@
{
"flavor": {
"OS-FLV-DISABLED:disabled": false,
"disk": 20,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "7",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/7",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/7",
"rel": "bookmark"
}
],
"name": "m1.small.description",
"ram": 2048,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": "test description",
"extra_specs": {
"key1": "value1",
"key2": "value2"
}
}
}

View File

@ -0,0 +1,178 @@
{
"flavors": [
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"ram": 512,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 20,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "2",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/2",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small",
"ram": 2048,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 40,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "3",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/3",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium",
"ram": 4096,
"swap": 0,
"vcpus": 2,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 80,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "4",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/4",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large",
"ram": 8192,
"swap": 0,
"vcpus": 4,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 160,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "5",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/5",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge",
"ram": 16384,
"swap": 0,
"vcpus": 8,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "6",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/6",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs",
"ram": 512,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": null,
"extra_specs": {
"hw:mem_page_size": "2048",
"hw:cpu_policy": "dedicated"
}
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 20,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "7",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/7",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/7",
"rel": "bookmark"
}
],
"name": "m1.small.description",
"ram": 2048,
"swap": 0,
"vcpus": 1,
"rxtx_factor": 1.0,
"description": "test description",
"extra_specs": {
"key1": "value1",
"key2": "value2"
}
}
]
}

View File

@ -0,0 +1,109 @@
{
"flavors": [
{
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny",
"description": null
},
{
"id": "2",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/2",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small",
"description": null
},
{
"id": "3",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/3",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium",
"description": null
},
{
"id": "4",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/4",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large",
"description": null
},
{
"id": "5",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/5",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge",
"description": null
},
{
"id": "6",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/6",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs",
"description": null
},
{
"id": "7",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/7",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/7",
"rel": "bookmark"
}
],
"name": "m1.small.description",
"description": "test description"
}
]
}

View File

@ -0,0 +1,89 @@
{
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "r-t61j9da6",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
"OS-SRV-USG:launched_at": "2019-04-23T15:19:10.855016",
"OS-SRV-USG:terminated_at": null,
"accessIPv4": "1.2.3.4",
"accessIPv6": "80fe::",
"addresses": {
"private": [
{
"OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
"OS-EXT-IPS:type": "fixed",
"addr": "192.168.0.3",
"version": 4
}
]
},
"adminPass": "seekr3t",
"config_drive": "",
"created": "2019-04-23T17:10:22Z",
"description": null,
"flavor": {
"disk": 1,
"ephemeral": 0,
"extra_specs": {},
"original_name": "m1.tiny",
"ram": 512,
"swap": 0,
"vcpus": 1
},
"hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
"host_status": "UP",
"id": "0c37a84a-c757-4f22-8c7f-0bf8b6970886",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/0c37a84a-c757-4f22-8c7f-0bf8b6970886",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/0c37a84a-c757-4f22-8c7f-0bf8b6970886",
"rel": "bookmark"
}
],
"locked": false,
"locked_reason": null,
"metadata": {
"meta_var": "meta_val"
},
"name": "foobar",
"os-extended-volumes:volumes_attached": [],
"progress": 0,
"security_groups": [
{
"name": "default"
}
],
"server_groups": [],
"status": "ACTIVE",
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-04-23T17:10:24Z",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
}
}

View File

@ -0,0 +1,14 @@
{
"rebuild" : {
"accessIPv4" : "1.2.3.4",
"accessIPv6" : "80fe::",
"OS-DCF:diskConfig": "AUTO",
"imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b",
"name" : "foobar",
"adminPass" : "seekr3t",
"metadata" : {
"meta_var" : "meta_val"
},
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi"
}
}

View File

@ -0,0 +1,9 @@
{
"server": {
"accessIPv4": "1.2.3.4",
"accessIPv6": "80fe::",
"OS-DCF:diskConfig": "AUTO",
"name": "new-server-test",
"description": "Sample description"
}
}

View File

@ -0,0 +1,88 @@
{
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "r-t61j9da6",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
"OS-SRV-USG:launched_at": "2019-04-23T15:19:10.855016",
"OS-SRV-USG:terminated_at": null,
"accessIPv4": "1.2.3.4",
"accessIPv6": "80fe::",
"addresses": {
"private": [
{
"OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
"OS-EXT-IPS:type": "fixed",
"addr": "192.168.0.3",
"version": 4
}
]
},
"config_drive": "",
"created": "2012-12-02T02:11:57Z",
"description": "Sample description",
"flavor": {
"disk": 1,
"ephemeral": 0,
"extra_specs": {},
"original_name": "m1.tiny",
"ram": 512,
"swap": 0,
"vcpus": 1
},
"hostId": "6e84af987b4e7ec1c039b16d21f508f4a505672bd94fb0218b668d07",
"host_status": "UP",
"id": "324dfb7d-f4a9-419a-9a19-237df04b443b",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/images/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"key_name": null,
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/servers/324dfb7d-f4a9-419a-9a19-237df04b443b",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/324dfb7d-f4a9-419a-9a19-237df04b443b",
"rel": "bookmark"
}
],
"locked": false,
"locked_reason": null,
"metadata": {
"My Server Name": "Apache1"
},
"name": "new-server-test",
"os-extended-volumes:volumes_attached": [],
"progress": 0,
"security_groups": [
{
"name": "default"
}
],
"server_groups": [],
"status": "ACTIVE",
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2012-12-02T02:11:58Z",
"user_id": "fake"
}
}

View File

@ -19,7 +19,7 @@
}
],
"status": "CURRENT",
"version": "2.74",
"version": "2.75",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}

View File

@ -22,7 +22,7 @@
}
],
"status": "CURRENT",
"version": "2.74",
"version": "2.75",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}

View File

@ -188,6 +188,14 @@ REST_API_VERSION_HISTORY = """REST API Version History:
in request body to ``POST /servers``. Allow users to specify which
host/node they want their servers to land on and still be
validated by the scheduler.
* 2.75 - Multiple API cleanup listed below:
- 400 for unknown param for query param and for request body.
- Making server representation always consistent among GET, PUT
and Rebuild serevr APIs response.
- Change the default return value of swap field from the empty
string to 0 (integer) in flavor APIs.
- Return ``servers`` field always in the response of GET
hypervisors API even there are no servers on hypervisor.
"""
# The minimum and maximum versions of the API supported
@ -196,7 +204,7 @@ REST_API_VERSION_HISTORY = """REST API Version History:
# Note(cyeoh): This only applies for the v2.1 API once microversions
# support is fully merged. It does not affect the V2 API.
_MIN_API_VERSION = "2.1"
_MAX_API_VERSION = "2.74"
_MAX_API_VERSION = "2.75"
DEFAULT_API_VERSION = _MIN_API_VERSION
# Almost all proxy APIs which are related to network, images and baremetal

View File

@ -46,7 +46,8 @@ class AgentController(wsgi.Controller):
http://wiki.openstack.org/GuestAgent
http://wiki.openstack.org/GuestAgentXenStoreCommunication
"""
@validation.query_schema(schema.index_query)
@validation.query_schema(schema.index_query_275, '2.75')
@validation.query_schema(schema.index_query, '2.0', '2.74')
@wsgi.expected_errors(())
def index(self, req):
"""Return a list of all agent builds. Filter by hypervisor."""

View File

@ -62,7 +62,10 @@ class AssistedVolumeSnapshotsController(wsgi.Controller):
raise exc.HTTPBadRequest(explanation=e.format_message())
@wsgi.response(204)
@validation.query_schema(assisted_volume_snapshots.delete_query)
@validation.query_schema(assisted_volume_snapshots.delete_query_275,
'2.75')
@validation.query_schema(assisted_volume_snapshots.delete_query, '2.0',
'2.74')
@wsgi.expected_errors((400, 404))
def delete(self, req, id):
"""Delete a snapshot."""

View File

@ -35,14 +35,16 @@ class FlavorsController(wsgi.Controller):
_view_builder_class = flavors_view.ViewBuilder
@validation.query_schema(schema.index_query)
@validation.query_schema(schema.index_query_275, '2.75')
@validation.query_schema(schema.index_query, '2.0', '2.74')
@wsgi.expected_errors(400)
def index(self, req):
"""Return all flavors in brief."""
limited_flavors = self._get_flavors(req)
return self._view_builder.index(req, limited_flavors)
@validation.query_schema(schema.index_query)
@validation.query_schema(schema.index_query_275, '2.75')
@validation.query_schema(schema.index_query, '2.0', '2.74')
@wsgi.expected_errors(400)
def detail(self, req):
"""Return all flavors in detail."""

View File

@ -50,7 +50,7 @@ class HypervisorsController(wsgi.Controller):
self.servicegroup_api = servicegroup.API()
def _view_hypervisor(self, hypervisor, service, detail, req, servers=None,
**kwargs):
with_servers=False, **kwargs):
alive = self.servicegroup_api.service_is_up(service)
# The 2.53 microversion returns the compute node uuid rather than id.
uuid_for_id = api_version_request.is_supported(
@ -89,6 +89,12 @@ class HypervisorsController(wsgi.Controller):
if servers:
hyp_dict['servers'] = [dict(name=serv['name'], uuid=serv['uuid'])
for serv in servers]
# The 2.75 microversion adds 'servers' field always in response.
# Empty list if there are no servers on hypervisors and it is
# requested in request.
elif with_servers and api_version_request.is_supported(
req, min_version='2.75'):
hyp_dict['servers'] = []
# Add any additional info
if kwargs:
@ -169,7 +175,8 @@ class HypervisorsController(wsgi.Controller):
context, hyp.host)
hypervisors_list.append(
self._view_hypervisor(
hyp, service, detail, req, servers=instances))
hyp, service, detail, req, servers=instances,
with_servers=with_servers))
except (exception.ComputeHostNotFound,
exception.HostMappingNotFound):
# The compute service could be deleted which doesn't delete
@ -312,7 +319,7 @@ class HypervisorsController(wsgi.Controller):
msg = _("Hypervisor with ID '%s' could not be found.") % id
raise webob.exc.HTTPNotFound(explanation=msg)
return dict(hypervisor=self._view_hypervisor(
hyp, service, True, req, instances))
hyp, service, True, req, instances, with_servers))
@wsgi.expected_errors((400, 404, 501))
def uptime(self, req, id):

View File

@ -160,7 +160,8 @@ class KeypairController(wsgi.Controller):
self._delete(req, id)
@wsgi.Controller.api_version("2.10") # noqa
@validation.query_schema(keypairs.delete_query_schema_v210)
@validation.query_schema(keypairs.delete_query_schema_v275, '2.75')
@validation.query_schema(keypairs.delete_query_schema_v210, '2.10', '2.74')
@wsgi.response(204)
@wsgi.expected_errors(404)
def delete(self, req, id):
@ -187,7 +188,8 @@ class KeypairController(wsgi.Controller):
return user_id
@wsgi.Controller.api_version("2.10")
@validation.query_schema(keypairs.show_query_schema_v210)
@validation.query_schema(keypairs.show_query_schema_v275, '2.75')
@validation.query_schema(keypairs.show_query_schema_v210, '2.10', '2.74')
@wsgi.expected_errors(404)
def show(self, req, id):
# handle optional user-id for admin only
@ -230,7 +232,8 @@ class KeypairController(wsgi.Controller):
return {'keypair': keypair}
@wsgi.Controller.api_version("2.35")
@validation.query_schema(keypairs.index_query_schema_v235)
@validation.query_schema(keypairs.index_query_schema_v275, '2.75')
@validation.query_schema(keypairs.index_query_schema_v235, '2.35', '2.74')
@wsgi.expected_errors(400)
def index(self, req):
user_id = self._get_user_id(req)

View File

@ -66,7 +66,8 @@ class LimitsController(wsgi.Controller):
@wsgi.Controller.api_version('2.57') # noqa
@wsgi.expected_errors(())
@validation.query_schema(limits.limits_query_schema)
@validation.query_schema(limits.limits_query_schema_275, '2.75')
@validation.query_schema(limits.limits_query_schema, '2.57', '2.74')
def index(self, req):
return self._index(req, FILTERED_LIMITS_2_57, max_image_meta=False)

View File

@ -120,7 +120,8 @@ class QuotaSetsController(wsgi.Controller):
def show(self, req, id):
return self._show(req, id, FILTERED_QUOTAS_2_57)
@validation.query_schema(quota_sets.query_schema)
@validation.query_schema(quota_sets.query_schema_275, '2.75')
@validation.query_schema(quota_sets.query_schema, '2.0', '2.74')
def _show(self, req, id, filtered_quotas):
context = req.environ['nova.context']
context.can(qs_policies.POLICY_ROOT % 'show', {'project_id': id})
@ -148,7 +149,8 @@ class QuotaSetsController(wsgi.Controller):
def detail(self, req, id):
return self._detail(req, id, FILTERED_QUOTAS_2_57)
@validation.query_schema(quota_sets.query_schema)
@validation.query_schema(quota_sets.query_schema_275, '2.75')
@validation.query_schema(quota_sets.query_schema, '2.0', '2.74')
def _detail(self, req, id, filtered_quotas):
context = req.environ['nova.context']
context.can(qs_policies.POLICY_ROOT % 'detail', {'project_id': id})
@ -179,7 +181,8 @@ class QuotaSetsController(wsgi.Controller):
def update(self, req, id, body):
return self._update(req, id, body, FILTERED_QUOTAS_2_57)
@validation.query_schema(quota_sets.query_schema)
@validation.query_schema(quota_sets.query_schema_275, '2.75')
@validation.query_schema(quota_sets.query_schema, '2.0', '2.74')
def _update(self, req, id, body, filtered_quotas):
context = req.environ['nova.context']
context.can(qs_policies.POLICY_ROOT % 'update', {'project_id': id})
@ -267,7 +270,8 @@ class QuotaSetsController(wsgi.Controller):
# +microversions because the resource quota-set has been deleted completely
# when returning a response.
@wsgi.expected_errors(())
@validation.query_schema(quota_sets.query_schema)
@validation.query_schema(quota_sets.query_schema_275, '2.75')
@validation.query_schema(quota_sets.query_schema, '2.0', '2.74')
@wsgi.response(202)
def delete(self, req, id):
context = req.environ['nova.context']