cannot use plus sign in flavorid

Bug #1920938 reported by Ruby Loo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Amit Uniyal

Bug Description

We want the flavor name and flavor id to have the same value. This was working fine until we added a flavor name with '+'.

In the code [1], the flavor id is restricted to '^(?! )[a-zA-Z0-9. _-]+(?<! )$'. Although the comment above that code says 'forbid leading/trailing whitespace' -- it is restricting more than the whitespace. In the api-ref [2] for creating a flavor, the id is described as "The ID of the flavor. While people often make this look like an int, this is really a string. If not provided, this defaults to a uuid."

I haven't seen anything that explicitly indicates that plus signs are not allowed, so it seems to me that this is a coding bug and that the plus sign (and perhaps other characters) ought to be allowed as part of the flavorid value.

eg, try creating a flavor name & id with 'this+that':

$ openstack flavor create 'this+that' --id 'this+that'
BadRequestException: 400: Client Error for url: .../nova_api/v2.1/flavors, Invalid input for field/attribute id. Value: this+that. 'this+that' does not match '^(?! )[a-zA-Z0-9. _-]+(?<! )$'

Tested against master branch (of nova and openstackclient).

[1] https://opendev.org/openstack/nova/src/commit/50f48400483f9cb66b323920ccf1ea40b0fd0cd1/nova/api/openstack/compute/schemas/flavor_manage.py#L31
[2] https://docs.openstack.org/api-ref/compute/?expanded=create-flavor-detail#create-flavor

Tags: doc
Revision history for this message
Sylvain Bauza (sylvain-bauza) wrote :

We don't allow the plus sign as you saw in https://opendev.org/openstack/nova/src/commit/50f48400483f9cb66b323920ccf1ea40b0fd0cd1/nova/api/openstack/compute/schemas/flavor_manage.py#L31 so we should then update the API docs to tell the accepted values.

Accepting it as a doc bugfix, not for telling yes for modifying the API as it would need a new microversion (and a spec)

Changed in nova:
status: New → Confirmed
tags: added: doc
Changed in nova:
importance: Undecided → Low
Revision history for this message
Ruby Loo (rloo) wrote :

Thanks Sylvain for providing feedback so promptly! I personally view it as a bug. I don't mind adding a microversion to the PR I threw together (https://review.opendev.org/c/openstack/nova/+/782545). But I don't have time to figure out how to submit a spec etc.

If Verizon Media feels like it is important enough, I'll get back in touch but as far as I know, it isn't.

Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

I agree on microversion bump as this change 400->200 so it is interop issue.

This is the similar proposal as allowing more char in keypair name - https://blueprints.launchpad.net/nova/+spec/allow-special-characters-in-keypair-name

Maybe we can combine all these in a single spec.

for spec, you can propose the spec for Xena cycle in nova-specs repo, example- https://review.opendev.org/c/openstack/nova-specs/+/755109

Amit Uniyal (auniyal)
Changed in nova:
assignee: nobody → Amit Uniyal (auniyal)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/nova/+/858094

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/c/openstack/nova/+/858094
Committed: https://opendev.org/openstack/nova/commit/b7356303cdfd9df42b9fea7ab51cb85de7318dad
Submitter: "Zuul (22348)"
Branch: master

commit b7356303cdfd9df42b9fea7ab51cb85de7318dad
Author: Amit Uniyal <email address hidden>
Date: Fri Sep 16 10:49:09 2022 +0000

    Updated flavors doc

    Flavor with special characters in flavor ID is not allowed to create

    Closes-Bug: 1920938
    Change-Id: I600ae07f7fb039c9ccf461c4bf74ae42d9a3744f

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by "Ruby Loo <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/nova/+/782545
Reason: I'm not available to work on this, feel free to restore.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 27.0.0.0rc1

This issue was fixed in the openstack/nova 27.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.