Commit Graph

7703 Commits

Author SHA1 Message Date
Zuul a5997aa10f Merge "Attach Manila shares via virtiofs (API)" 2024-12-06 18:38:52 +00:00
Zuul 693515bc16 Merge "api: Add response body schemas for assisted volume snapshots APIs" 2024-12-06 16:15:45 +00:00
Zuul 6269da1968 Merge "api: Add response body schemas for versions APIs" 2024-12-05 23:22:09 +00:00
Zuul d3b5080483 Merge "api: Add response body schemas for extensions API" 2024-12-02 15:31:10 +00:00
Zuul 0764b80f44 Merge "api: Add response body schemas for host aggregate APIs" 2024-12-02 15:04:02 +00:00
Zuul c1039cbd35 Merge "api: Add response body schemas for host aggregate actions API" 2024-11-30 04:02:30 +00:00
René Ribaud 5e508a09b3 Attach Manila shares via virtiofs (API)
This patch introduce the REST API modifications to attach/detach a share
and list/show share mappings.

Manila is the OpenStack Shared Filesystems service.
These series of patches implement changes required in Nova to allow the shares
provided by Manila to be associated with and attached to instances using
virtiofs.

Implements: blueprint libvirt-virtiofs-attach-manila-shares

Change-Id: I0255a5697cd4ea148bd91c4f6fd183841d69a333
2024-11-27 14:09:42 +01:00
Zuul d9f9b3abb3 Merge "api: Add response body schemas for remaining server action APIs" 2024-11-26 20:24:35 +00:00
Stephen Finucane 277d98433c api: Add response body schemas for assisted volume snapshots APIs
Change-Id: Ic8553d936e3ba558b9e5fddc5f91308ba4e47adc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 23:01:52 +00:00
Stephen Finucane fde3f5cce6 api: Add response body schemas for versions APIs
We move a check for unset microversions to after the check for a min or
max version filter. If we're not filtering, we don't need to fail.

Change-Id: Ic3b11b8233b3bb3e5016bce6653bb86908ef8874
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 23:01:42 +00:00
Stephen Finucane 9797183494 api: Add response body schemas for extensions API
Change-Id: I52a3c9b9eff86044033fb199421a7d6ce6d7d1d3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 23:01:29 +00:00
Stephen Finucane 14bb8ff237 api: Add response body schemas for host aggregate APIs
We already tackled the action APIs for this resource. Now tackle the
remaining APIs.

Change-Id: I62de0e325d86f761a09c5a70e80d8d8209ed4bf1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 23:01:16 +00:00
Stephen Finucane eec975c063 api: Add response body schemas for host aggregate actions API
Change-Id: Id6644a943c7ac735e3abf072bdc78674645945a4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 23:00:59 +00:00
Stephen Finucane b967f2a693 api: Add response body schemas for remaining server action APIs
This demonstrates far more complex response schemas, including the
response to the rebuild action which is effectively the response to the
server show API.

Change-Id: I6dc355f3c3f164d0bc7887a58e8b13979f0b476e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 14:23:48 -08:00
Zuul 15a10c6ccd Merge "api: Add response body schemas for server action APIs" 2024-11-22 22:06:46 +00:00
Balazs Gibizer bee0a5c54a Use client token when talking to manila
When a user asks nova to attach a manila share to the user's instance
nova should use the user's keystone token to talk to manila so that
manila can verify if the user has access to the share.

Manila is the OpenStack Shared Filesystems service.  These series
of patches implement changes required in Nova to allow the shares
provided by Manila to be associated with and attached to instances
using virtiofs.

Implements: blueprint libvirt-virtiofs-attach-manila-shares
Change-Id: I793f0518dcfffd2286e7bc685cab76794aece91d
2024-11-22 15:39:57 +01:00
Stephen Finucane 908d9263ee api: Add response body schemas for server action APIs
At least those that don't return bodies (plus rescue, which is easy)
since they're tedious but simple, thus providing a good test ground for
this effort.

Change-Id: I78003b1d2c1515e5fd5e17405df6a219878bdb8a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-22 12:40:45 +00:00
Sylvain Bauza 31accd37c8 doc: mark the maximum microversion for 2024.2 Dalmatian
We need it for this release.

Change-Id: I92a881a8e29c0736f5598018be911d623c38b624
2024-09-09 17:40:41 +02:00
Zuul 145ca33805 Merge "Handle neutron-client conflict" 2024-09-02 09:28:15 +00:00
Zuul 92442bfaf1 Merge "api: Add remaining missing query parameter schema" 2024-07-20 08:50:32 +00:00
Zuul cff73f518b Merge "api: Don't do version check if nothing required" 2024-07-04 23:12:18 +00:00
Zuul e4aaddc607 Merge "api: Add 'removed' decorator" 2024-07-04 23:12:11 +00:00
Stephen Finucane 64ac67fd19 api: Correct bug in flavors schema
The 'rxtx_factor' is a float, not an integer, and should allow values <
1 so long as they are > 0. Correct this.

Change-Id: I3567f13d7a1bb6f42755e3f5739fa9ecd827aa49
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-01 11:18:06 +01:00
Stephen Finucane 41b436bff7 api: Add remaining missing query parameter schema
We already handled request bodies. Now we tackle query parameters. Note
that we're only handling GET requests currently since these are the APIs
where query parameters are most likely to be present. A future change
will add a test to verify that all methods handling GET requests have
schemas present.

This patch might look huge but every one of these schemas is effectively
a no-op since they're empty and have 'additionalProperties = True'. This
means there are lots of TODOs left in here which would be nice to tackle
in a future API microversion.

Change-Id: I80fc84df7c2be908856e6d4033b4922d7b0e9af1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-24 11:40:48 +01:00
Stephen Finucane ff040ada4f api: Don't do version check if nothing required
There's no reason to inspect the API version requested (and reject
things if unset) if we don't have version constraints on the API
resource. This lets us add schema decorators to unversioned API
resources (i.e. the "versions" API at '/').

Change-Id: Ib4d4585e3e4664eba8cd3daa47b4349eb2bfed74
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-24 11:38:55 +01:00
Stephen Finucane b1824c5c97 api: Add 'removed' decorator
For APIs and resource actions that have been wholly removed and now
return a HTTP 4xx request regardless of microversion.

Change-Id: Ie3e90f4628dab4cc3e5983e0e8d8799dcf0465d8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-24 11:38:27 +01:00
Stephen Finucane 7491417323 api: Migrate to JSON Schema Draft 2020-12
OpenAPI 3.1 is a superset of JSON Schema Draft 2020-12. As a result, we
wish to migrate our current schemas to this. There are a couple of
issues to address:

- 'exclusiveMinimum' is now an integer and allows you to define an
  minimum for an exclusive range, to complement 'minimum' which is used
  for an inclusive range. We can drop it and use 'minimum' with a larger
  number (since draft 6 [1]).

- 'integer' types can now accept a fractional part but only if it's zero
  (i.e. '1.0' is permissible, '1.1' is not) (since draft 6 [1]).

- 'items' has been replaced with 'prefixItems' for describing the format
  of an array item (since draft 2020-12 [2])

[1] https://json-schema.org/draft-06/json-schema-release-notes
[2] https://json-schema.org/draft/2020-12/release-notes

Change-Id: I1486701786960eef95c5c42674bff1b2d7d686e2
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-17 16:19:17 +00:00
Stephen Finucane 7e78623ac5 api: Fix bugs in schemas
None of these should affect us at runtime but they are not technically
valid against JSON Schema Draft 4.

Change-Id: Iaae8998a34ff812b9f76a0cd1fa9be4555c89b98
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-17 16:19:03 +00:00
Stephen Finucane f86cd38dfe api: Add remaining missing request body schemas
This provides us a path to generate OpenAPI schemas for the nova API.
Thankfully most of the API documentation is pretty darn simple. Note
that we need to fix a lot of unit tests so that they pass correct bodies
to the controller methods under test. Also note that the
'reset_server_state' module in 'nova.api.openstack.compute.schemas' is
renamed to 'admin_actions' to match the name of the module containing
the controller itself, as is the case for all other schemas.

Change-Id: I39098fb621b120589ed6a923ce64207ee26e91aa
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-17 16:18:51 +00:00
Stephen Finucane 847608e75a api: Add request body schemas for SG APIs
These are deprecated but there's value in having a proper - if loose -
schema in place for API documentation purposes. Also, doing things this
way allows us to remove a whole load of hand-rolled stuff.

Change-Id: I4106cfa2a09d135f12892ed6d1f42f4151dc72e4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-06-17 17:18:25 +01:00
Rajesh Tailor 88b661b078 Handle neutron-client conflict
When user tries to add stateless and stateful security
groups on same port, neutron raises SecurityGroupConflict (409),
but nova doesnot handle it and raises InternalServerError (500).

As it appears to be invalid operation from user, so user should get
the message that they are doing wrong.

This changes catches SecurityGroupConflict from neutron
client and raises newly added nova exception
SecurityGroupConnectionStateConflict with 409 error code.

Closes-Bug: #2056195
Change-Id: Ifad28fdd536ff0a4b30e786b2fcbc5a55987a13a
2024-05-30 11:30:48 +05:30
Zuul 7096423b34 Merge "Reject AZ changes during aggregate add / remove host" 2024-05-09 20:17:32 +00:00
Balazs Gibizer 3c0eadae0b Reject AZ changes during aggregate add / remove host
After this patch nova rejects the add host to aggregate API action
if the host has instances and the new aggregate for the host would
mean that these instances need to move from one AZ (even from the
default one) to another. Such AZ change is not implemented in nova
and currently leads to stuck instances.

Similarly nova will reject remove host from aggregate API action if the
host has instances and the aggregate removal would mean that the
instances need to change AZ.

Depends-On: https://review.opendev.org/c/openstack/tempest/+/821732

Change-Id: I19c4c6d34aa2cc1f32d81e8c1a52762fa3a18580
Closes-Bug: #1907775
2024-05-08 14:56:56 +02:00
Stephen Finucane 233fe1865f api: Keep track of action controllers
We need to be able to resolve the original, unversioned methods.
Register these things slightly differently. It would likely be better to
fold these action controllers into the main controllers, but that's a
lot of code motion that I don't really want to do right now.

Change-Id: Iee37500e6b2dbacf0c1514bfc52ef2dfe8ceb94f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-12 00:56:21 +01:00
Stephen Finucane e504b76508 api: Remove FlavorManageController
This is an odd child, registering standard REST operations as actions
(in the '/action' API sense of the term). There's no reason for this
delineation these days so simply remove it. This makes auto-generation
much easier down the road.

Change-Id: Ia45013fc988acb9517aea42c3caa1fa45d63892e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-12 00:56:21 +01:00
Stephen Finucane cabb6999a3 api: Add missing Controller inheritance
This has many of the attributes of the 'Controller' class but does not
subclass it. This means we are missing attributes like 'wsgi_actions'
as well as helper methods like 'version_select', 'api_version',
'is_valid_body', and 'check_for_versions_intersection'. We correctly
subclass for every other controller and there's no reason for us not to
do so here, so correct this oversight.

Change-Id: Ib89e2e02e8c85cc27f5b55caca5711e773959288
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-04-12 00:56:21 +01:00
Zuul 818f0cd4a3 Merge "Remove nova.wsgi module" 2024-03-19 19:42:00 +00:00
Sylvain Bauza 6f199b6b0c doc: mark the maximum microversion for 2024.1 Caracal
We need it for this release.

Change-Id: I17fbd9523067b0c19982499e66c314d47e9ee4bb
2024-03-12 19:06:08 +01:00
Rajesh Tailor c98c8d84ee Add support for showing requested az in output
As of now, the server show and server list --long output
shows the availability zone, that is, the AZ to which the
host of the instance belongs. There is no way to tell from
this information if the instance create request included an
AZ or not.

This change adds a new api microversion to add support for
including availability zone requested during instance create
in server show and server list --long responses.

Change-Id: If4cf09c1006a3f56d243b9c00712bb24d2a796d3
2024-03-01 21:39:04 +05:30
Ghanshyam Mann 0c1e1ccf03 HyperV: Remove RDP console API
RDP console was only for HyperV driver so removing the
API. As API url stay same (because same used for other
console types API), RDP console API will return 400.

Cleaning up the related config options as well as moving its
API ref to obsolete seciton.

Keeping RPC method to avoid error when old controller is used
with new compute. It can be removed in next RPC version bump.

Change-Id: I8f5755009da4af0d12bda096d7a8e85fd41e1a8c
2024-02-13 12:24:38 -08:00
Ghanshyam Mann 3e47439a68 HyperV: Remove RDP console connection information API
The RDP console was only available for HyperV driver, therefore its
connection information via API ``os-console-auth-tokens`` will now return
HTTP ``400 (BadRequest)`` error.

Starting from 2.31 microversion, this API return connection info
for all other console type.

Change-Id: I94e590eb4cbe3b2d8eff7fe881f7b98af8979be2
2024-02-13 19:28:07 +00:00
Zuul d5726a81b8 Merge "Remove deprecated [api] use_forwarded_for" 2023-12-20 03:47:46 +00:00
Zuul d28a55959e Merge "Fixed an error when caching multiple images in aggregate" 2023-12-19 08:18:06 +00:00
Sean Mooney f4852f4c81 [codespell] fix final typos and enable ci
This chnage adds the pre-commit config and
tox targets to run codespell both indepenetly
and via the pep8 target.

This change correct all the final typos in the
codebase as detected by codespell.

Change-Id: Ic4fb5b3a5559bc3c43aca0a39edc0885da58eaa2
2023-12-15 12:32:42 +00:00
Takashi Kajinami a5f68d355c Remove deprecated [api] use_forwarded_for
This option was deprecated in favor of the HTTPProxyToWSGI middleware
in 26.0.0 release[1].

[1] cf906cdcc2

Related-Bug: #1967686
Change-Id: Iad8880127531dc2788d646f8a05b5c17fd9d0969
2023-12-14 14:41:00 +09:00
Zuul 8644855533 Merge "Use SDK for deprecated baremetal proxy API" 2023-12-14 00:07:25 +00:00
Stephen Finucane 4e182a664e Remove nova.wsgi module
We want this module for use elsewhere. Given there's only a single
caller (nova.service) we can simply move the code to the caller.

Change-Id: I2c3887db8b3f6833bf24f5114fd955e1af590d03
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-06 09:50:58 +00:00
Stephen Finucane 259b646afa Use SDK for deprecated baremetal proxy API
We had indicated that we would never switch this over to SDK, however,
this is the sole remaining user of ironicclient which means users would
continue needing to install that just for this little API. Better to
switch this holdout over and finally delete all the things.

Change-Id: I880523935d73ca94c83e618f10c2e587362c53be
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-12-05 12:09:36 +00:00
Sean Mooney 7402822f0b [codespell] start fixing all the typos
this is the inital patch of applying codespell to nova.
codespell is a programing focused spellchecker that
looks for common typos and corrects them.

i am breaking this into multiple commits to make it simpler
to read and will automate the execution of codespell
at the end of the series.

Change-Id: If24a6c0a890f713545faa2d44b069c352655274e
2023-10-03 00:51:35 +01:00
Zuul 11843f249c Merge "Fix pep8 errors with new hacking" 2023-09-22 17:34:40 +00:00