Filter leading/trailing spaces for name field in v2.1 compat mode

Bug #1498075 reported by John Garbutt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Alex Xu

Bug Description

This has spun out of:
https://bugs.launchpad.net/nova/+bug/1491511

v2_legacy allows trailing whitespace, so v2.0 compat needs to also accept those request.

To make it simpler, best to strip all the trailing whitespace in v2.0.

Changed in nova:
importance: Undecided → High
tags: added: liberty-rc-potential
Changed in nova:
assignee: nobody → John Garbutt (johngarbutt)
status: New → In Progress
Revision history for this message
John Garbutt (johngarbutt) wrote :
Changed in nova:
assignee: John Garbutt (johngarbutt) → Alex Xu (xuhj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by John Garbutt (<email address hidden>) on branch: master
Review: https://review.openstack.org/220791
Reason: OK, going for squashing this into the previous patch: https://review.openstack.org/#/c/222032/

Revision history for this message
John Garbutt (johngarbutt) wrote :
Changed in nova:
assignee: Alex Xu (xuhj) → Ken'ichi Ohmichi (oomichi)
Changed in nova:
milestone: none → liberty-rc1
Changed in nova:
assignee: Ken'ichi Ohmichi (oomichi) → John Garbutt (johngarbutt)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/222032
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4354163c1e149ffdff5f46b9f480d58704f009c8
Submitter: Jenkins
Branch: master

commit 4354163c1e149ffdff5f46b9f480d58704f009c8
Author: He Jie Xu <email address hidden>
Date: Thu Sep 10 11:02:15 2015 +0800

    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

Changed in nova:
status: In Progress → Fix Committed
assignee: John Garbutt (johngarbutt) → Alex Xu (xuhj)
Matt Riedemann (mriedem)
tags: removed: liberty-rc-potential
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-rc1 → 12.0.0
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.