Commit Graph

5 Commits

Author SHA1 Message Date
Stephen Finucane b543f8226c api: Rename 'parameter_types.hostname' -> 'fqdn'
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>
2021-08-19 11:16:59 +01:00
Tetsuro Nakamura 38b25397e8 fix nova accepting invalid availability zone name with ':'
Nova has a legacy hack to allow admins to specify hosts via an
availability zone using az:host:node. That means ':' cannot be
included in the name of an availability zone itself.

However, the aggregate API accepts requests which have
availability zone names including ':'.

This patch checks the availabilty zone name when aggregate is
created or updated and raises an error if it contains ':'.

Change-Id: I9b0d8e8d4b3ab2cb3d578c22fa259e0e7c0d325b
Closes-Bug: #1695861
2017-09-24 15:12:43 +09:00
He Jie Xu 923cf20eca Generate better validation error message when using name regexes
There are some regexes used in the json-schema for complex string validation.
When the validation failed, json-schema lib didn't generate a useful error
info for the user, it shows the regex to the user. But regex is really
unreadable for normal user. This patch override the default FormatChecker to
support passed in custom error message. This required using custom format
checker instead of using 'pattern'.

For aggregates API, it enabled 'null' in the name input. As the 'format'
keyword works for all allowed types and name format check will only validate
string type, so this patch change the schema to use 'oneOf' keyword, then
the 'format' will only against on string type.

Change-Id: Ic0e608b8a18b635bfcd936f57f14c9f54e1ef8b4
Partial-Bug: #1541691
2016-03-07 10:11:49 +08:00
He Jie Xu 4354163c1e Filter leading/trailing spaces for name field in v2.1 compat mode
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
2015-09-23 10:27:54 +01:00
He Jie Xu 3e032fd45b Remove 'v3' directory for v2.1 json-schemas
This is step 4 of the remove v3 process. It moves the v2.1
json-schemas out of v3 directory, and also corrects all the
references.

Change-Id: Ibf88c38df951ed755b7431846cca7496f861c1dd
Partial-Bug: #1462901
2015-08-13 09:58:48 +08:00