Commit Graph

644 Commits

Author SHA1 Message Date
Stephen Finucane c63a2bba9d api: Add response body schemas for quota class sets API
We replace the use of 'test_class' in a variety of places with
'default', since nova only supports the 'default' quota class set. We
also start using the quota fixture in the policy tests to ensure we
return "valid" responses.

Change-Id: I6df0ec741f355e71c359c4e94bb32caacf9b1fab
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-11-26 10:58:03 +00:00
Stephen Finucane 78498e7d89 api: Add response body schemas for server usage audit log APIs
Change-Id: I20b7fec44149fd97049cd1f8602d084c45a690f5
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-29 10:16:49 +01:00
Stephen Finucane 8d8edf73fc api: Add response body schemas for security group APIs
We also tackle the server security group and security group rules
controllers at the same time since they are so similar.

Change-Id: I7a039cdc172de59392215e9d6a9a24d03144cb85
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-29 10:16:49 +01:00
Stephen Finucane 2a546a8645 tests: Use valid UUIDs for cinder resources
This necessitates adding some missing return values for various mocks.
Combined, this brings our tests closer to reality and will be needed
once we add response schemas for these.

Change-Id: I1ff23082d257f98e4f63b84b287a3c374a62bf0b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-08-26 13:54:47 +01: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
Zuul 3dbbe830a4 Merge "only show standard image properties in server show." 2025-08-19 16:39:30 +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 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
Stephen Finucane 4520a058c8 doc: Add missing API samples
These have been introduced at some point and now appear when running the
API samples test with GENERATE_SAMPLES=True. Add them.

Change-Id: Ic4b6b685f17e8d411776e20f239daa0736ae9a0b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-05-13 12:04:50 +01:00
Ghanshyam Mann 7a00971b8f Fix microversion 2.98 doc/tests for update/rebuild APIs
microversion 2.98 changed the GET and GET list details
API response to expand the image field
- https://review.opendev.org/c/openstack/nova/+/939649

but when we change the views/servers.py then update server
and rebuild server API response also gets updated.
- https://review.opendev.org/c/openstack/nova/+/939649/12/nova/api/openstack/compute/views/servers.py#595

The microversion change actually changed the response for
the update and rebuild API but did not update the documentation
about this change. Neither added test for rebuild and update
which verify the response change.

Since microversion 2.75, we have made all these 4 APIs response
consistent.

Implements: blueprint image-properties-in-server-show

Change-Id: Ifc2edc59c601391a31fd8953c742969e5b368767
2025-02-28 17:13:59 +00:00
Ghanshyam Mann f9e89bc0d1 Fix microversion 2.96 for update/rebuild APIs
microversion 2.96 changed the GET and GET list details
APi response to add a new field 'pinned_availability_zone'
- https://review.opendev.org/c/openstack/nova/+/904568

but when we change the views/servers.py then update server
and rebuild server API response also gets updated.
- https://review.opendev.org/c/openstack/nova/+/904568/17/nova/api/openstack/compute/views/servers.py#309

The microversion change actually changed the response for
the update and rebuild API but did not update the documentation
about this change. Neither added test for rebuild and update
which verify the response change.

Since microversion 2.75, we have made all these 4 APIs response
consistent.

Change-Id: I31fbb3c5e689302713bfb7a254c5d0cc12de2dc4
2025-02-28 17:06:18 +00:00
Douglas Viroel 2db8af71dd Add support for showing scheduler_hints in server details
Nova currently lacks a straightforward way to expose scheduler hints
associated with a server. This change extends existing Nova's
API to allow users to retrieve this information when it is available.
It adds a new API microversion to support returning the associated
scheduler_hints in ``GET /servers/{server_id}``, `GET /servers/detail``,
``PUT /servers/{server_id}`` and ``POST /server/{server_id}/action``
(rebuild) responses.

Implements: blueprint show-scheduler-hints-in-server-details
Change-Id: If0070cfbc218e0515bf3b58fc8c5067ae22c7072
2025-02-26 17:50:25 -03:00
Michael Still cbc263f6bc libvirt: allow direct SPICE connections to qemu
This patch adds a new console type, "spice-direct", which provides
the connection information required to talk the native SPICE protocol
directly to qemu on the hypervisor. This is intended to be fronted
by a proxy which will handle authentication separately.

A new microversion is introduced which adds the type "spice-direct"
to the existing "spice" protocol.

An example request:

POST /servers/<uuid>/remote-consoles
{
  "remote_console": {
    "protocol": "spice",
    "type": "spice-direct"
  }
}

An example response:

{
  "remote_console": {
    "protocol": "spice",
    "type": "spice-direct",
    "url": "http://localhost:13200/nova?token=XXX";
  }
}

This token can then be used to lookup connection details for the
console using a request like this:

GET /os-console-auth-tokens/<consoletoken>

Which returns something like this:

{
  "console": {
    "instance_uuid": <uuid>,
    "host": <hypervisor>,
    "port": <a TCP port number>,
    "tls_port": <another TCP port number>,
    "internal_access_path": null
  }
}

APIImpact

Change-Id: I1e701cbabc0e2c435685e31465159eec09e3b1a0
2025-02-22 08:25:38 +11:00
Rajesh Tailor 05c6b6cdbb Add support for showing image properties in server show response
This change adds a new api microversion to add support for
including image properties in ``server show`` and ``server list
--long`` responses as well as in response for ``server rebuild``
instance action.

Implements: blueprint image-properties-in-server-show
Change-Id: Ic135389954e43e6478288c0cdcffd780915cdb40
2025-02-12 10:57:03 +05:30
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
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
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 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
Sahid Orentino Ferdjaoui 1d707a72fc fup: support evacuate target state
This fix minors comments that have been noticed.

Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Iee6c224aa0f26d8550b38a8f69b28d8648b1da70
2023-02-06 14:25:33 +01:00
Sahid Orentino Ferdjaoui d732ee38a1 api: extend evacuate instance to support target state
Start to v2.95 any evacuated instances will be stopped a destination

Implements: bp/allowing-target-state-for-evacuate
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: I141b6f057cc4eb9c541c2bc6eddae27270ede08d
2023-01-31 18:16:00 +01:00
Artom Lifshitz 9980b9ad52 Microversion 2.94: FQDN in hostname
Extend microversion 2.90 to allow FQDNs in the hostname parameter.
Multi-create with --hostname continues to be refused, returning error
400 to the user. This simplifies the code by not needing to handle any
sort of suffix or prefix mangling of the FQDN to handle multiple
instances. No other changes are made - not Neutron integration,
metadata API changes (the FQDN will appear as-is in places where the
hostname currently appears), etc.

Change-Id: I47e397dc6da8263762479cc8ae4f8777a6d9d811
Implements: bp/fqdn-in-hostname
2023-01-17 10:59:37 -05:00
Dan Smith 45c5b80fd0 Add API support for rebuilding BFV instances
This adds a microversion and API support for triggering a rebuild
of volume-backed instances by leveraging cinder functionality to
do so.

Implements: blueprint volume-backed-server-rebuild
Closes-Bug: #1482040

Co-Authored-By: Rajat Dhasmana <rajatdhasmana@gmail.com>

Change-Id: I211ad6b8aa7856eb94bfd40e4fdb7376a7f5c358
2022-08-31 18:05:03 +05:30
Lee Yarwood 794d2f98d9 scheduler: Add an ephemeral encryption pre filter
Change-Id: I20b21f39c46895448b172f79a3e4603d124f2c53
2022-08-02 21:25:47 +00:00
Sylvain Bauza a755e5d9f2 api: Drop generating a keypair and add special chars to naming
As agreed in the spec, we will both drop the generation support for a keypair
but we'll also accept @ (at) and . (dot) chars in the keyname, all of them in
the same API microversion.

Rebased the work from I5de15935e83823afa545a250cf84f6a7a37036b4

APIImpact

Implements: blueprint keypair-generation-removal
Co-Authored-By: Nicolas Parquet <nicolas.parquet@gandi.net>

Change-Id: I6a7c71fb4385348c87067543d0454f302907395e
2022-07-28 11:05:50 +02:00
René Ribaud 09239fc2ea Allow unshelve to a specific host (REST API part)
This adds support to the REST API, in a new microversion, for specifying
a destination host to unshelve server action when the server
is shelved offloaded.
This patch also supports the ability to unpin the availability_zone of an
instance that is bound to it.

Note that the functional test changes are due to those tests using the
"latest" microversion 2.91.

Implements: blueprint unshelve-to-host
Change-Id: I9e95428c208582741e6cd99bd3260d6742fcc6b7
2022-07-22 10:22:34 +02:00
Stephen Finucane 5e2c31ab78 api: Add support for 'hostname' parameter
Add microversion 2.90, which allows allows users to configure the
hostname that will be exposed via the nova metadata service when
creating their instance.

Change-Id: I95047c1689ac14fa73eba48e19dc438988b78aad
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-01-14 11:42:43 +00:00
Lee Yarwood ac21c6674c api: Introduce microversion 2.89 adjusting os-volume_attachments
This microversion adds attachment_id and bdm_uuid as stored in the
underlying bdm record while also removing the duplicate id field from
the responses of ``GET /servers/{server_id}/os-volume_attachments`` and
``GET /servers/{server_id}/os-volume_attachments/{volume_id}``.

To accomidate this within the _translate_attachment_summary_view helper
is folded into _translate_attachment_detail_view with the remaining
caller in the now deprecated os-volumes API now replaced with a static
dictionary.

Blueprint: add-attachmentid-to-responses-of-the-os-volume-attachments-api
Change-Id: I977c3fd9bbb1e1d42e6979222137e7366d2815e8
2021-08-24 12:07:41 +01:00
Stephen Finucane 1f67ce2496 api: Drop statistics-style fields from os-hypervisors
Introduce API microversion 2.88, which makes the following changes to
a number of 'os-hypervisors'. Specifically, the following fields are
dropped from both the '/os-hypervisors/detail' (detailed list) and
'/os-hypervisors/{hypervisor_id}' (show) APIs:

- current_workload
- cpu_info
- vcpus
- vcpus_used
- free_disk_gb
- local_gb
- local_gb_used
- disk_available_least
- free_ram_mb
- memory_mb
- memory_mb_used
- running_vms

In addition, the '/os-hypervisors/statistics' API, which provided a
summary of the above stats but for all hypervisors in the deployment, is
dropped entirely.

Finally, the '/os-hypervisors/{hypervisor}/uptime' API, which provided a
similar response to the '/os-hypervisors/{hypervisor}' API but with an
additional 'uptime' field, has been removed in favour of including this
field in the primary '/os-hypervisors/{hypervisor}' API.

A small tweak to 'tox.ini' that allows us to share some venvs is
included.

Part of blueprint modernize-os-hypervisors-api

Change-Id: I515e484ade6c6455f82a3067940a418a0d7d965a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-01-08 10:10:21 +00:00
Stephen Finucane 8750c4e173 functional: Enable real policy fixture by default
Enable the policy fixture by default, which should yield more realistic
functional tests. We need to update some tests to use admin APIs where
policy dictates they are necessary. Note that we're currently testing
the legacy policy - not the updated, scoped policy - since the legacy
policy is the default one currently.

Note that we also need to modify the 'SingleCellSimple' fixture in this
change to use the same project ID as the 'OSAPIFixture'.

Change-Id: Ia3dea78f16cb3c7081714c4db36e20d5ee76ed7d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-16 11:31:23 +01:00
Lee Yarwood 24106290e6 api: Introduce microverion 2.87 allowing boot from volume rescue
Building on Ic2ad1468d31b7707b7f8f2b845a9cf47d9d076d5, when requested
this microversion will allow boot from volume requests to proceed when
the COMPUTE_RESCUE_BFV trait is also reported by the compute the
instance currently resides on.

Implements: blueprint virt-bfv-instance-rescue
Change-Id: I3242fec1547693078cf36c3637116f8c41f1d0bc
2020-04-09 08:39:36 +01:00
Stephen Finucane d8e9daafe8 api: Add microversion for extra spec validation
Enable support for API-based extra spec validation. Since most of the
hard work has been done in previous patches, all that's necessary here
is to wire up the microversion handling and turn things on.

Part of blueprint flavor-extra-spec-validators

Change-Id: If67f0d924ea372746a6dc440ea7bdc655e4f0bea
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-04-08 13:20:02 +00:00
zhangbailin 733d4133df Allow PUT volume attachments API to modify delete_on_termination
Allow PUT /servers/{server_id}/os-volume_attachments/{volume_id}``
to support specifying ``delete_on_termination`` field in the request
body. This allows updating the attached volume's flag that controls
whether or not it is automatically deleted when the instance is deleted.

When we request 'volumeId' and 'delete_on_termination' in the requst
body to swap volume, since the new microversion it will be support
updating the swapping volume's delete flag.

Co-Authored-By: Dan Smith <dansmith@redhat.com>

Blueprint: destroy-instance-with-datavolume
Change-Id: I6ccac4e17f56b40e67c79d40f32558ef414685ea
2020-04-02 09:26:55 -07:00
zhangbailin 59156bdf01 Add instance actions v284 samples test
Implements blueprint action-event-fault-details
Change-Id: I8e8a5ca1efe4a3554038dcddc503c3030956e0b9
2020-03-30 03:02:31 +00:00
Matt Riedemann 8337bee4b5 Expose instance action event details out of the API
This adds a new microversion to expose the instance action
event details in the
GET /servers/{server_id}/os-instance-actions/{request_id} API.

With the new microversion the "details" key is always returned
with each event dict but the value may be null because of old
records or events that did not fail.

The details are not constrained by policy like the traceback
field since the details are like a fault message on the server
resource when the server is in ERROR status and the fault
message is likewise not constraint by policy unlike the fault
details which is a traceback like the event traceback field.

This commit add a SYSTEM_READER ('rule: system_reader_api') role
to the Show Server Action Details API. With this default policy,
events fault details can be displayed. And also add some nova and
non-nova exception functional tests for os-instance-actions API.

Co-Authored-By: Brin Zhang <zhangbailin@inspur.com>

Implements blueprint action-event-fault-details
Change-Id: I6fe4dd265b0030ce12f92771b255a3d795f03d01
2020-03-27 08:20:12 +00:00
Zuul df9195de72 Merge "Non-Admin user can filter their instances by more filters" 2020-03-26 14:29:46 +00:00
Victor Coutellier 4018d6fb71 Non-Admin user can filter their instances by more filters
Microversion bump to allow non-admin user to use more filters key
when listing instances.

In order to stay coherent, all existing instance filters who are
related to a field readable by default to non admin users when showing
instance details, should be allowed by default without policy
modification.

Implements: blueprint non-admin-filter-instance-by-az

Change-Id: Ia66d3a1ceb74ed521cf44922929b2a502f3ee935
2020-03-15 17:35:49 +01:00
Zuul f3abaf4bec Merge "trivial: Rename directory for os-keypairs samples" 2020-03-09 12:25:18 +00:00
Zuul d5b75845a6 Merge "Fix os-keypairs pagination links" 2020-03-09 12:25:11 +00:00
Zuul bb53370197 Merge "Fix hypervisors paginted collection_name." 2020-03-08 17:58:35 +00:00
Stephen Finucane f2a438aa9c trivial: Rename directory for os-keypairs samples
We have a custom of naming the directory after the API. Reinforce that
here.

Change-Id: I5bf68aacc1d987400a91467835c4b55f03c18beb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-03-06 16:57:46 +00:00
Stephen Finucane f31efe0a0e Fix os-keypairs pagination links
The API URL is '/os-keypairs', not '/keypairs'. Attempting to use these
pagination links as-is will result in a HTTP 404 (Not Found).

Change-Id: Ic04568caecc138e6016418f6878d031c4a0d3fb4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-bug: #1866373
2020-03-06 16:57:44 +00:00
Sundar Nadathur c6365f1b55 Define Cyborg ARQ binding notification event.
APIImpact: Adds 2.82 microversion for /os-server-external-events API.
DocImpact: Adds new version to doc/api_samples/versions/.

Change-Id: I7a626544d8221dc0eeb5672986ca897ce4718be8
Blueprint: nova-cyborg-interaction
2020-03-01 13:52:51 -08:00
Fan Zhang b68033ecc9 Fix hypervisors paginted collection_name.
Hypervisor view builder's _collection_name,
'hypervisors' is used to build next link that
sdk use as uri to do paginated query. But correct
API should be `GET /v2.1/os-hypervisors?<params>`
rather than `GET /v2.1/hypervisors?<params>`.

This patch fixes this bug.

Change-Id: Idc4f3fe54136a6bd3dbc7dc0efd3f62745991199
Closes-Bug: 1864428
Signed-off-by: Fan Zhang <zh.f@outlook.com>
2020-02-24 16:49:35 +08:00
Stephen Finucane 9009d56d21 trivial: Use recognized extra specs in tests
Tests were previously using arbitrary keys that weren't published
anywhere in the codebase. Switch to using meaningful ones.

Change-Id: I8da84b48e4d630eeb91d92346aa2323e25e28e3b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-19 08:24:31 +00:00
Stephen Finucane e10c6125f8 nova-net: Remove remaining nova-network quotas
The 'security_group_rules' [1], 'floating_ips' [2], 'fixed_ips' [3] and
'security_groups' [4] quotas are all nova-network only and can be
removed or, more specifically, set to unlimited and ignored until we
eventually bump our minimum API microversion.

[1] https://review.opendev.org/477700
[2] https://review.opendev.org/457862
[3] https://review.opendev.org/457861
[4] https://review.opendev.org/457860

Change-Id: I9a5362fdf29e3680c59f620c585f3d730e4f6adb
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-12-02 17:39:23 +00:00
Stephen Finucane e5e477c42a Remove '/os-tenant-networks' REST API
Like '/os-networks', we can't remove this in its entirety due to the
fact that some of these are proxy URLs that also work with neutron.
These are retained but everything else is nuked.

Note that this highlights a bug in the API, whereby a missing
'objects.Network.cidr' value results in a value of 'None' being output
over the API. Clearly this is incorrect, but it's probably not worth
fixing for this deprecated API.

Change-Id: I31cb0891144bdd7945479bb6692b0a533de4c5d0
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-22 16:03:11 +00:00
Stephen Finucane 1b71252a5f Remove (most) '/os-networks' REST APIs
Drop support for most of the 'os-networks' REST APIs excluding those
that proxy through to neutron.

This API now returns a 410 response for the non-proxy routes.

Unit tests are removed for removed APIs and the functional API sample
tests are just asserting the 410 response now same. The latter are also
expanded to cover APIs that weren't previously tested.

The API sample docs are left intact since the API reference still builds
from those and can be considered more or less branchless, so people
looking at the API reference can apply it to older deployments of nova
before these APIs were removed.

Note: yes, the API samples are correct. It really is a useless API when
used with neutron.

Change-Id: I68bfa77a520382317fc490a4f6c12dd62fc6dcda
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-18 16:25:47 +00:00
Zuul 81929c3c52 Merge "nova-net: Migrate 'test_floating_ips' functional tests" 2019-10-30 23:47:55 +00:00
Zuul 8075bd7bc8 Merge "fixtures: Add support for security groups" 2019-10-30 23:43:43 +00:00