Commit Graph

4725 Commits

Author SHA1 Message Date
Stephen Finucane b4576bae06 api: Add response body schemas for volumes APIs
Change-Id: Ia40b1dcc637bca7b8fc48b486dab5cb4195aae67
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-29 10:16:49 +01:00
Ghanshyam Maan f914cb185c Add service role in Nova policy
RBAC community wide goal phase-2[1] is to add 'service'
role for the service APIs policy rule. This commit
defaults the service APIs to 'service' role. This way
service APIs will be allowed for service user only.

Tempest tests also modified to simulate the service-to-service
communication. Tempest tests send the user with service
role to nova API.
- https://review.opendev.org/c/openstack/tempest/+/892639>

Partial implement blueprint policy-service-role-default

[1] https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html#phase-2

Change-Id: I1565ea163fa2c8212f71c9ba375654d2aab28330
Signed-off-by: Ghanshyam Maan <gmaan@ghanshyammann.com>
2025-08-27 19:34:04 +00:00
Stephen Finucane a8651eaff3 api: Separate volume, snapshot and volume attachments
These all belong in separate files. Make it so.

We also rename the volume_attachment schema file to volume_attachments,
to better link it to the actual API code, and tweak an error message to
fix some capitalization.

Change-Id: Iffefc263bbf19d18137207c0432c16fdb3c513f9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-26 13:54:43 +01:00
Stephen Finucane 2e666e768a api: Address issues with images APIs
Populate missing 'required' values.

Change-Id: I4e1e00c3f7d4f2a581db42dae3535a5931e8f1cc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-21 16:09:06 +01:00
Zuul 3dbbe830a4 Merge "only show standard image properties in server show." 2025-08-19 16:39:30 +00:00
Zuul b0900e9185 Merge "restrict swap volume to cinder" 2025-08-19 01:00:41 +00:00
Sean Mooney 93c0f9bc74 restrict swap volume to cinder
This change tightens the validation around the attachment
update API to ensure that it can only be called if the source
volume has a non empty migration status.

That means it will only accept a request to swap the volume if
it is the result of a cinder volume migration.

This change is being made to prevent the instance domain
XML from getting out of sync with the nova BDM records
and cinder connection info. In the future support for direct
swap volume actions can be re-added if and only if the
nova libvirt driver is updated to correctly modify the domain.
The libvirt driver is the only driver that supported this API
outside of a cinder orchestrated swap volume.

By allowing the domain XML and BDMs to get out of sync
if an admin later live-migrates the VM the host path will not be
modified for the destination host. Normally this results in a live
migration failure which often prompts the admin to cold migrate instead.
however if the source device path exists on the destination the migration
will proceed. This can lead to 2 VMs using the same host block device.
At best this will cause a crash or data corruption.
At worst it will allow one guest to access the data of another.

Prior to this change there was an explicit warning in nova API ref
stating that humans should never call this API because it can lead
to this situation. Now it considered a hard error due to the
security implications.

Closes-Bug: #2112187
Depends-on: https://review.opendev.org/c/openstack/tempest/+/957753
Change-Id: I439338bd2f27ccd65a436d18c8cbc9c3127ee612
Signed-off-by: Sean Mooney <work@seanmooney.info>
2025-08-18 16:11:41 +00:00
Sean Mooney c7eac94fc5 only show standard image properties in server show.
nova stopped supporting custom image properties many years
ago with the introduction of ovo.

when the image property show feature was added it incorrectly
filtered the instance_system_metadata table for the image prefix
but didnt restrict the responce to only standard image properties

This change adds that filtering and fixes minor issues with the
responce schema validation.

Related-Bug: #2098384
Change-Id: I11a8783b02f35b7dfc964bf49f1a8a0a2469abc3
Signed-off-by: Sean Mooney <work@seanmooney.info>
2025-08-13 21:24:23 +01:00
Stephen Finucane df630cd1b2 api: Deprecate v2 API
Change-Id: Ie236cc001ddc6362b92119710ec1672ae733318e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-11 12:12:13 +01:00
Stephen Finucane b2451a74fc conf: Rename '[api] neutron_default_tenant_id'
Neutron has used the term project instead of tenant for a long time now.
Rename the option accordingly and drop deprecated group and deprecated
name aliases from other options in the '[api]' group.

Change-Id: I5a547c7b6232c24b3a0f0c6d0ac916229a91b038
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-11 12:12:13 +01:00
Zuul 0cd0a72227 Merge "Add project manager role in Nova API policy rule" 2025-07-30 21:28:19 +00:00
Stephen Finucane d8e1248b7e api: Add response body schemas for images APIs
This is mostly uneventful save for us needing to fix our API ref, which
indicated that the 'OS-EXT-IMG-SIZE:size' field shown in the 'show' and
'detail' views was a string rather than an int. You can confirm this is
*not* the case like so:

  >>> import openstack
  >>> conn = openstack.connect()
  >>> conn.conn.compute.get('https://example.com/compute/v2.1/images/detail').json()

(obviously replace 'https://example.com/' with a compute API host)

Change-Id: Ia318478dfdb50f8d57a74958b3555f6ad97351ec
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-29 15:02:13 +01:00
Zuul d699d771b1 Merge "api: Add response body schemas for networks API" 2025-07-24 20:19:30 +00:00
Zuul 940d85fc6b Merge "api: Add response body schemas for removed APIs" 2025-07-24 06:11:06 +00:00
Ghanshyam Mann 06699f26a5 Add project manager role in Nova API policy rule
Keystone project manager role can be used for the project-level
management APIs. Nova introduced the manager role in policy
defaults.

To introduced the manager role, we need to make migrations
policies more granular. Adding the separate policies for host
related operation allow us to open the migration operations
to project manager role. Existing policy is checked if migration
without specifying host and new policy is checked if host is
specified. Same will be applied to list migrations, new policy
will control to return the host info.

Also, Adding doc and releasenotes.

Partial implement blueprint policy-manager-role-default

Change-Id: Ie7d135e4d24ac6d53c46a4c69ade0b0bda554e71
Signed-off-by: Ghanshyam Mann <gmaan@ghanshyammann.com>
Signed-off-by: ghanshyam <gmaan@ghanshyammann.com>
2025-07-22 21:49:28 +00:00
Zuul 6053bb2722 Merge "api: Address issues with server group APIs" 2025-07-22 21:14:35 +00:00
Zuul 240c4a0605 Merge "api: Add response body schemas for server group APIs" 2025-07-22 18:13:13 +00:00
Zuul c741689878 Merge "api: Add response body schemas for server password APIs" 2025-07-22 13:48:35 +00:00
Zuul 2010536d12 Merge "api: Add response body schemas for server external events API" 2025-07-21 21:43:12 +00:00
Zuul 1b4b1d4e99 Merge "api: Address issues with keypairs APIs" 2025-07-10 13:15:07 +00:00
Stephen Finucane ce8faa8d74 api: Add response body schemas for networks API
Yet another proxy API documented, albeit very loosely. We also remove a
conditional that can never be reached: we will always have a network
from neutron by time we attempt to show it. If we didn't, we'd have
exited early due to an exception.

Change-Id: I008975b3eabf5f3552ebad7e5bbe847b9c7eaa16
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:39:22 +01:00
Stephen Finucane 8f9cbe0015 api: Add response body schemas for removed APIs
These are all empty and are purely here to satisfy the check for
schemas and to allow us to potentially populate them for documentation
purposes later.

Change-Id: Ia52bc78b3392ec69382f3427f5676d52f9abee6d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:39:22 +01:00
Stephen Finucane e249f5762d api: Address issues with server group APIs
* Set additionalProperties to False, as expected
* Correct copy calls (not that it matters)

Change-Id: I97d8206d2df5deee0521ae69a73a32a7136c37be
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:38:44 +01:00
Stephen Finucane 04589a4530 api: Add response body schemas for server group APIs
Another relatively trivial one.

Change-Id: I4a5ae398e141ff29db6888b5ace731c689c7d239
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:38:38 +01:00
Stephen Finucane 558a870e13 api: Add response body schemas for server password APIs
This must be the easiest one yet.

Change-Id: I57e359068215a91452fd5f4d9044c04ecfc83fc2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:38:38 +01:00
Stephen Finucane 8ed52a058a api: Add response body schemas for server external events API
We also fix some issues in the api-ref, since it'll be another while
before we can replace that.

Change-Id: If661e3af796475637c0e76b3dfbfd5b7a7f38c24
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-07-10 11:38:38 +01:00
Zuul 43d57ae63d Merge "api: Address issues with server diagnostics APIs" 2025-06-27 20:29:16 +00:00
Zuul bb71b953c7 Merge "api: Address issues with remote consoles APIs" 2025-06-27 17:32:18 +00:00
Zuul 76ad55da2e Merge "api: Add response body schemas for server diagnostics API" 2025-06-27 15:15:54 +00:00
Stephen Finucane c4f81a54d5 api: Address issues with remote consoles APIs
* Add a note explaining presence of xvpvnc console type
* Make 'url' mandatory in create response
* Remove unnecessary description fields: we will populate these later
* De-deuplcate request body schemas
* Re-add references to the rdp console to the api-ref

Change-Id: I5555b8cf7a83fad689e98522850b5550b49566ed
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-06-26 18:49:59 +01:00
Zuul 0d586ccca8 Merge "api: Add response body schemas for server topology API" 2025-06-26 13:31:51 +00:00
Zuul 3cc03f8a91 Merge "api: Add response body schemas for image metadata APIs" 2025-06-26 11:35:06 +00:00
Zuul b3d64d5f8f Merge "api: Add response body schemas for keypairs APIs" 2025-06-26 07:19:56 +00:00
Zuul d748e78486 Merge "api: Add response body schemas for remote consoles" 2025-06-26 02:23:22 +00:00
Zuul 5582ec2e69 Merge "api: Add response body schemas for server IPs APIs" 2025-06-24 16:56:16 +00:00
Zuul 64ca204c9c Merge "api: Address issues with instance actions API" 2025-06-16 15:05:21 +00:00
Stephen Finucane a0af4648b5 api: Address issues with hypervisors APIs
* Address an off-by-one error: the cpu_info field was modified in v2.28,
  not v2.27,
* Correct the api-ref to indicate that the 'servers' field is not
  actually required and will be missing if '?with_servers=false', while
  the 'name' and 'uuid' fields of servers entries *are* required.
* Clarify a comment about the above in the schemas.
* Uncouple the '_hypervisor_response' and '_hypervisor_detail_response'
  helper schemas. The minor increase in lines of code is worth it for
  the decrease in complexity.
* Add the 'host_ip', 'hypervisor_type', and 'hypervisor_version' fields
  to the list of required fields for "detail"-style responses (show and
  detailed list).
* Make the 'current_workload', 'disk_available_least', 'free_disk_gb',
  'free_ram_mb', 'host_ip' and 'running_vms' fields of the hypervisor
  "detail"-style responses nullable, and the 'current_workload',
  'disk_available_least', 'free_disk_gb', 'free_ram_mb' and
  'running_vms' fields of the deprecated statistics API nullable.

Change-Id: Ibe55b44e65fe17141c63cceae8a003816ffe4f23
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-06-11 13:07:54 +01:00
Stephen Finucane 3b08d60dc4 api: Address issues with server diagnostics APIs
Add some missing additionalProperties=False entries.

Change-Id: I4477dcb590392c189a2bd586ecd9ba4ccd35d89e
2025-06-11 10:17:10 +01:00
Stephen Finucane 33cf8fef38 api: Address issues with keypairs APIs
Change-Id: I84ea28fc3ee255dea207e373c7064e3231e777f7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-06-10 17:28:47 +01:00
Stephen Finucane f09904f62d api: Address issues with instance actions API
The user_id and project_id fields can be null. Explain why.

Change-Id: I34353ec7e55845a83f5e2f1dc4b41dead4ac5c81
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-06-10 11:50:50 +01:00
Stephen Finucane 0552350a3b api: Add response body schemas for server diagnostics API
Change-Id: Id54d4f397aee20007f5e52e855c1d755b6f17946
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 485ee768d6 api: Add response body schemas for remote consoles
Most of these were already tackled as part of the server actions. We add
a schema for the RDP console, even though it's deprecated, since it
allows us to complete validation.

Change-Id: If13541b47b2b35f5a352049add65ced35f91f216
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 22c372cbe0 api: Add response body schemas for server topology API
Change-Id: I2cd4086d7b348f6d7f1b93a956b8b25f3a60d07f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 5f70e0ef57 api: Add response body schemas for image metadata APIs
Change-Id: I41e68cf531cbf8ce8effbdcd83e20f1f41d162fd
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 64f70797d6 api: Add response body schemas for keypairs APIs
Quite a few test fixes need here in order to ensure our tests generate
valid output.

Change-Id: I33377c06f40aed70d574cdc8aada27a61128ea61
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 2b3eb6b015 api: Add response body schemas for server IPs APIs
We also resolve a small mishap that has led to some unused schemas.

Change-Id: Iad8ab646f5c14ec1396fd48616e09d4271ccb304
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane c918fcc587 api: Add response body schemas for hypervisors APIs (3/3)
We split this one up due to its size, which itself is mainly due to the
amount of aliasing that went on in early versions as well as the amount
of changes that have been made over the years.

This focuses on the statistics view. We also reorder the output fields
in the view alphabetically just to make reviewing the schema slightly
easier.

Change-Id: I950a7e2286d451b37b2f7cbd02c4a0a82ac64361
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane 2ca03367ad api: Add response body schemas for instance actions
Change-Id: Ie94af006d916456cba6f4e8ee9f9df385f6a1709
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Stephen Finucane f5d9e5cb2f api: Add response body schemas for hypervisors APIs (2/3)
We split this one up due to its size, which itself is mainly due to the
amount of aliasing that went on in early versions as well as the amount
of changes that have been made over the years.

This focuses on the show view as well as the closely related detailed
view.

Change-Id: I06b1a8f0a30e9260f118921a13e85c4c534d9c8f
2025-05-13 12:04:50 +01:00
Stephen Finucane f7a03e5834 api: Add response body schemas for hosts APIs
Change-Id: I9b045e9d8d344f2cd8caf7fcbd45f0d8b610da04
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00