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
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
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>
A base is something that it's inherited by other things. If everything
is a base, nothing is. This is just noise so remove it.
Change-Id: I9e2d3c37650465d0748852f8cdb82fbeba7b3f4c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This better reflects its actual meaning.
The 'hostname_or_ip_address' parameter type is removed as it has been
unused since support for support for the 'os-cells' API was removed in
change Iddb519008515f591cf1d884872a5887afbe766f2.
Change-Id: Ia99aeb37785284e129b01d336da17ea907db95b7
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
At some point in the past, there was only nova-network and its code
could be found in 'nova.network'. Neutron was added and eventually found
itself (mostly!) in the 'nova.network.neutronv2' submodule. With
nova-network now gone, we can remove one layer of indirection and move
the code from 'nova.network.neutronv2' back up to 'nova.network',
mirroring what we did with the old nova-volume code way back in 2012
[1]. To ensure people don't get nova-network and 'nova.network'
confused, 'neutron' is retained in filenames.
[1] https://review.opendev.org/#/c/14731/
Change-Id: I329f0fd589a4b2e0426485f09f6782f94275cc07
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Also update some outdated URLs at the same time, e.g. defcore is now
interop.
Unfortunately unlike GitHub, gitea doesn't yet support URLs with
shortened SHA1s; however this is being worked on:
https://github.com/go-gitea/gitea/issues/6450
Change-Id: I6e6b63619f1138cc961b61be548453361d01f73c
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
Add a new microversion that adds two new params to create
server named 'host' and 'hypervisor_hostname'.
Part of Blueprint: add-host-and-hypervisor-hostname-flag-to-create-server
Change-Id: I3afea20edaf738da253ede44b4a07414ededafd6
This one's actually important since it will be an error in future
versions of Python.
Change-Id: Ib9f735216773224f91ac7f49fbe2eee119670872
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This patch adds a new parameter ``locked_reason`` to
``POST /servers/{server_id}/action`` request where the
action is lock. It enables the user to specify a reason when locking
a server.
The locked_reason will be exposed through ``GET servers/{server_id}``,
``GET /servers/detail``, ``POST /servers/{server_id}/action`` where
the action is rebuild and ``PUT servers/{server_id}`` requests' responses.
The InstanceActionNotification will emit the locked_reason
along with the other instance details. This patch hence changes the
payload object to include the "locked_reason" field.
Note that "locked" will be allowed as a valid filtering/sorting parameter
for ``GET /servers/detail`` and ``GET /servers`` from this new microversion.
Implements blueprint add-locked-reason
Change-Id: I46edd595e7417c584106487123774a73c6dbe65e
Add a new microversion 2.67 to support specify ``volume_type``
when boot instances.
Part of bp boot-instance-specific-storage-backend
Change-Id: I13102243f7ce36a5d44c1790f3a633703373ebf7
This adds the changes-before filter to the servers,
os-instance-actions and os-migrations APIs for
filtering resources which were last updated before
or equal to the given time. The changes-before filter,
like the changes-since filter, will return deleted
server resources.
Part of bp support-to-query-nova-resources-filter-by-changes-before
Change-Id: If91c179e3823c8b0da744a9363906b0f7b05c326
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for user data
extensions.
Also this commit removes the logic of appending the extensions
schema as this is the last extensions schema to merge.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I692a048b3a8da4e912e000b47da977dda466348b
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for security
group extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I160028d77e84705106aad5ec8b2d9a54a3c54b18
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for scheduler
hint extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I7d15614051d4a38b74b0fc9e5c751fdc3f64cb1c
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for multiplex
create extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I2b1a7a45ee35d3a7023a27f13e197221868087b2
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for keypair extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I56b044863a2454601d3f4534bace229a94c4f0e3
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for config extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I0bdb82c1692c547be6edc9729b2fd3e415b35646
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for BDM v2 extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I49146f5b2e7635aa500054e9506e9bf28f6a2ce5
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for legacy BDM extensions.
Partially implements: blueprint api-extensions-merge-rocky
Change-Id: I396809b66dd6a9bc704b24072a6325b90244dad7
This change adds support for the trusted_image_certificates parameter,
which is used to define a list of trusted certificate IDs that can be
used during image signature verification and certificate validation. The
parameter may contain a list of strings, each string representing the ID
of a trusted certificate. The list is restricted to a maximum of 50 IDs.
The list of certificate IDs will be stored in the trusted_certs field of
the instance InstanceExtra and will be used to verify the validity of
the signing certificate of a signed instance image.
The trusted_image_certificates request parameter can be passed to
the server create and rebuild APIs (if allowed by policy):
* POST /servers
* POST /servers/{server_id}/action (rebuild)
The following policy rules were added to restrict the usage of the
``trusted_image_certificates`` request parameter in the server create
and rebuild APIs:
* os_compute_api:servers:create:trusted_certs
* os_compute_api:servers:rebuild:trusted_certs
The trusted_image_certificates parameter will be in the response
body of the following APIs (not restricted by policy):
* GET /servers/detail
* GET /servers/{server_id}
* PUT /servers/{server_id}
* POST /servers/{server_id}/action (rebuild)
APIImpact
Implements blueprint: nova-validate-certificates
Change-Id: Iedd3fea0e86648fae364f075915555dcb2c4f199
soft_deleted is support in query but we didn't mention in the doc
bcb405e871/nova/db/sqlalchemy/api.py (L2127)
Change-Id: I1c5577a501144170e82c96c04cffbf32dcaa5cff
Closes-Bug: 1765575
As nova extensions has been deprecated already and goal is to
merge all scattered code into main controller side.
Currently schema and request/response extended code are there
among all extensions.
This commit merge the schema part of create server for AZ extensions.
Partially implements: blueprint api-extensions-merge-queens
Change-Id: I3671e63187b79cb7a80594d4d7a948565a9003bb
This microversion makes the following changes:
1. Deprecates personality files from POST /servers and the rebuild
server action APIs.
2. Adds the ability to pass new user_data to the rebuild server
action API.
3. Personality / file injection related limits and quota resources
are removed from the limits, os-quota-sets and os-quota-class-sets
APIs.
Implements blueprint deprecate-file-injection
Change-Id: Ia89eeb6725459c35369e8f790f68ad9180bd3aba
This patch adds `key_name` param to instance rebuild
API. Then the user could reset the instance keypair
when rebuilding. If set key_name to None, the API
will unset the keypair of the instance.
APIImpact
Implements blueprint: rebuild-keypair-reset
Change-Id: I23886a89c25f811cfbe7e2500ce7ff52f9162966
move common definition into common layer, as dependency patches
like I64ad387ec7b532e9dbc791f683a005587825ff61 plan to use the
definitions of the schema, this patch moves these definitions
as common ones
Change-Id: I17c2937e6b8ac3d09fabe273c50c81dd9b0babb6
This is the 4th patch of the series,
this patch adds a new microversion
in API to support adding tags when
booting instances.
Implemetes: blueprint support-tag-instance-when-boot
Change-Id: Ifcaaf285c8f98a1d0e8bbbc87b2f57fbce057346
Many attribute in the request schema are defined with
allowed enum values. But schema does not specify those
enum as string type.
enum in json schema is defined in such a way that it
allows any type not just string so defining each enum type
as string explicitly makes schema more readable and consistent
with other API schema.
Note- this does not change any behavior or does not fix any issue.
This is just for consistency with other schema definition and readability.
Change-Id: I4f6fe5e418c624e0dcbcfb3b6bca64ab3e5c96fe
schema_servers.base_xxx was for extending json-schema for API extensions,
however the json-schema of resize is not extended at all since the first
commit I3651da8c1d23ee1b5d4710b1b323ecf9337ca70d
So this patch removes the variable for easy code.
Partial-implement-blueprint api-no-more-extensions-pike
Change-Id: I2b9c31d177943d728fa51848f6f824b9918744a6
While adding the json schema for servers filter query,
we added 'accessIPv4' and 'accessIPv6' as allowed params
but they do not match with what DB has. It is 'access_ip_v4'
and 'access_ip_v6' in DB.
This makes 'access_ip_v4' and 'access_ip_v6' filter stop working.
The schema should be fixed accordingly to allow the 'access_ip_v4'
and 'access_ip_v6' as valid filter.
'accessIPv4' and 'accessIPv6' are something the API accepts
and returns and internally API layer translate those param
to their respective field('access_ip_v4' and 'access_ip_v6')
present in DB.
So user does not know anything about 'access_ip_v4' and
'access_ip_v6'. They are not in API representation actually.
Later list filter and sort param should be same as field return
in GET or accepted in POST/PUT which are 'accessIPv4' and 'accessIPv6'.
But that is something new attribute support in filter and can be
done later after more discussion.
Change-Id: Idc12de0062d298259e25c8b4c0dde889054a9ae5
Closes-Bug: #1661195
The field is 'terminated_at', not 'terminate_at', which was
probably just a typo. This fixes the field name in the server
query parameter schema and adds a test to show it working.
Change-Id: I279fa7b40da1d1057a9774e2dc380425454f11dd
Closes-Bug: #1661113
In the context of device tagging, bugs have caused the tag attribute
to disappear starting with version 2.33 for block_devices and starting
with version 2.37 for network interfaces. In other words, block
devices could only be tagged in 2.32 and network interfaces between
2.32 and 2.36 inclusively.
This patch documents this behaviour in api-ref and introduces
microversion 2.42, which re-adds the tag in all the right places.
Change-Id: Ia0869dc6f7f5bd347ccbd0930d1d668d37695a22
Closes-bug: 1658571
Implements: blueprint fix-tag-attribute-disappearing
Currently all the DB columns exposed in the sort_key parameter. That means
the supported sort keys will be changed when the DB schema changed. This
patch will strict the supported sort keys in a limited list.
Only the keys which are in the API representation will be supported. For
avoid to break the user hardly, the keys which aren't supported from now
will be ignored when in the request. For other invalid sort keys, the
400 will be returned, which matches the behavior as before.
The sort_key in the JSON-Schema will be enum. But due to there is no
way to describe ignore few of enum values in the schema. So we put all
ignored keys in the enum also. Then we will filter those keys out in the
python code. For readability, we put all the ignored sort keys in the
variable 'SERVER_LIST_IGNORE_SORT_KEY'.
partial implement of bp add-whitelist-for-server-list-filter-sort-parameters
Change-Id: I4af9b0eb2166ce14bde4ef4f8a1f9e9707f2c5cf
We have a lot of filters are pattern match.
There is list for exact match
df2fd4a252/nova/db/sqlalchemy/api.py (L2221)
Out of that list will be pattern match
df2fd4a252/nova/db/sqlalchemy/api.py (L2231)
HTTP 500 raises if invalid regex provided for
those filters, strict there format to be regex
in JSON schema to avoid this.
partial implement of bp add-whitelist-for-server-list-filter-sort-parameters
Closes-Bug: #1653899
Change-Id: I4cf38407c20284dee7127edfe312da81caac9272
This patch enables a white list for query parameter.
The parameters, which are out of white list, will be ignored.
The sort_key still accepts open value. The later patch will add white
list to it.
Co-Authored-By: Zhenyu Zheng <zhengzhenyu@huawei.com>
partial implement of bp add-whitelist-for-server-list-filter-sort-parameters
Change-Id: I7141eef6a1c85ec6d6e8ee170911572535652978
tag schema is being used in multiple place like server tags
and device tags and may be in future it will be used in many
other schema also.
So this patch moves tag schema from server_tags.py to common
place (parameter_types.py).
Change-Id: I9385c436c48c881dc5fab475ed35eb0e10010637
This adds the 2.37 microversion to the REST API for automatically
allocating a network, i.e. get me a network.
The majority of the changes to the REST API concern request
validation. 'networks' is now required in the server POST body
after this microversion. The 'auto' or 'none' special network
uuid values are used, but if specified, can not be specified
with any other requested network values.
The other special case that is checked is when the minimum
compute service version is not new enough to support this change,
i.e. a Mitaka compute will not have the network API code that
knows how to deal with the special auto/none network IDs. Because
the REST API is checking the service version, the service caches
the service version after the first check. Once all computes are
updated to Newton then a restart of the nova-api service(s) will
be required to flush the cache. A release note is provided for
this situation.
The api-ref docs are also updated for this microversion including
an example API sample request.
The matching Tempest change to test this is here:
I89b18709e0cfbbcbf9be96a91a13a1356cdf85b0
The matching python-novaclient change is here:
I6636ddcd3be7bf393d2d69cc6c1ba5c7d65ff674
Implements blueprint get-me-a-network
Change-Id: I89b18709e0cfbbcbf9be96a91a13a1356cdf85b0
Currently imageRef in server create, rebuild and rescue
operation can be accepted as random url which contains image
UUID and fetch the UUID from that.
As /images proxy APIs are deprecated, and ImageRef in
server creation etc are UUID only and valid against glance.
This patch makes imageRef handling as UUID only and
return 400 if non UUID are requested.
NOTE- Previously nova use to allow the empty string which was
ok in case of boot from volume.
We will keep the same behavior of allowing empty string in case of
boot from volume only and 400 in all other case.
Closes-Bug: #1607229
Change-Id: I49f4da62c1b5b3fd8c5f67039ae113f76722b26c
This patch allows the user to specify a tag for a virtual network
interface and/or block device mapping when booting an instance.
Implements: blueprint bp/virt-device-role-tagging
Change-Id: I89247200f4cf1f644daf476727b4a6acb22b0cf6
This removes personality extension, as well as the rebuild extension
point for servers.
We add an operation flag to translate extension because personality
extension uses different kwarg names depending on the operation. This
is done with a set of constants which should prevent typos silently
causing failures.
A few variables are renamed in servers.py to avoid multiline
statements.
Part of bp:api-no-more-extensions
Change-Id: I47deae0279f85d9a355d1248b6e90af732406514
This removes the portions of the os-disk-config extension that handles
additional attributes being passed in during
create/update/resize/rebuild. These are folded directly into
servers.py with a new module wide function for translating REST in =>
attr dict data structures.
Tests which use disk_config as the example for loading and using these
extensions are removed.
As this is the only in tree extension that hooks the resize entry
point, that is fully removed from setup.cfg and well as any extension
manager processing.
Part of bp:api-no-more-extensions
Change-Id: I691a3a917a3dbaa86072d689e9ebf42ba356ca60
'format' keyword works for any types. That means for 'port' field,
'null' value never passed the format checks. We should use 'oneOf'
keyword instead of it.
Change-Id: Ic51e9e1c6efadce0a0b4d20a114ca75799fb36a5
Partial-Bug: #1552888
This patches adds changes to the Nova REST API to allow
users to create a server with a description, rebuild
a server with a description, update the description,
and get the description in the server details.
Note: Future commits will be done to support the server
description in python-novaclient and openstack-client.
APIImpact
Implements blueprint: user-settable-server-description
Change-Id: I74b1a340c5ab98fdea2186e87dd13f42ce7c7661
Change I9b649aafba011d537e3fe4eebef7a678ff6733e4 has added a
compute API to trigger crash dump in instance. This patch adds
the REST API to nova. It enables users to trigger crash dump in
an instance through REST API.
Change-Id: I6ed777ff637254b4b79417008f9055dd19fc7405
Implements: blueprint instance-crash-dump
Co-Authored-By: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
In the V2 API, there are three cases for the name field:
1. disallow any space in the name: server_groups.
2. allow leading/trailing whitespaces, strip spaces and disallow
all characters are spaces: flavor_manage, servers.
3. allow leading/trailing whitespacess, no strip spaces and allow
all characters are spaces: aggregates, cells, create_backup,
security_groups, create_image, rebuild
But currently in the V2.1 API and V2.1 API compat mode disallows
leading/trailing in the name field.
For the V2.1 compat mode, we should relax the validation to avoid
breaking the user, although leading/trailing is unclear usecase. This
patch allows leading/trailing spaces but will strip them, and still
disallows that all characters are spaces in the name fields for
flavor_mange, servers, aggregates(and availability_zones),
create_backup, create_image, rebuild.
Due to the server_groups and security_groups(no jsons-schema in v2.1)
have consistent behavior between v2 and v2.1. So this patch won't
change server_groups.
But when creating servers, the name of security_groups, availability_zone
and keyapir isn't stripped the leading/trailing spaces. This is for
backward compatible with users who already use legacy V2 API created
security_group, availabilit_zone and keypair with leading/trailing
in the name, otherwise the users can't use those resource anymore.
For supporting servers schema extension point returns legacy v2 schema,
this patch adds version parameter to the schema extension point. Then
extension point can return different schema based on the version
parameter.
Change-Id: I9442891272284d395ea0dd8cfa302d3f74bf13ec
Partial-Bug: #1498075
The server name is designed to be anything the user would like it to
be, so should be validated against name, not hostname. This is how
v2.0 worked, and v2.1 schema validation accidentally went over the top
here. v2.1 regressed at f40b6a1d5c
Change-Id: Ia32a452ab3a5d7cd5a5289e8e8bf9f8e5e404780
Partial-Bug: #1491511