← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1697497] Re: PUT /os-services/force-down won't work with non-boolean forced_down field

 

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

commit d0d7fc3a19dba48fa988b995db620e0da066381a
Author: Ken'ichi Ohmichi <ken-oomichi@xxxxxxxxxxxxx>
Date:   Mon Jun 12 12:37:20 2017 -0700

    Add bool_from_string for force-down action
    
    On force-down action API, its forced_down parameter is defined as
    parameter_types.boolean which allows string values like 'True',
    'False', etc. However the API code didn't contain bool_from_string
    call which converts string value to boolean value. In addition,
    the parameter is defined as BooleanField in the service object.
    So if the string value is passed on forced_down parameter, HTTP
    500 error happaned. This patch fixes this problem by adding
    bool_from_string call.
    
    Closes-Bug: #1697497
    
    Change-Id: Ifca579d1bb43ece190c633b3ea1ffa476daf6e34


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1697497

Title:
  PUT /os-services/force-down won't work with non-boolean forced_down
  field

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) newton series:
  New
Status in OpenStack Compute (nova) ocata series:
  New

Bug description:
  This API's docs says it takes a boolean for the forced_down field:

  https://developer.openstack.org/api-ref/compute/?expanded=update-
  forced-down-detail#update-forced-down

  But the schema uses the boolean parameter type:

  https://github.com/openstack/nova/blob/a43dbba2b8feea063ed2d0c79780b4c3507cf89b/nova/api/openstack/compute/schemas/services.py#L42

  Which is not only booleans, it's also things like 'on/off' and
  'yes/no':

  https://github.com/openstack/nova/blob/a43dbba2b8feea063ed2d0c79780b4c3507cf89b/nova/api/validation/parameter_types.py#L188

  Which isn't converted to a boolean:

  https://github.com/openstack/nova/blob/a43dbba2b8feea063ed2d0c79780b4c3507cf89b/nova/api/openstack/compute/services.py#L136

  That's just passed through to update the service object:

  https://github.com/openstack/nova/blob/a43dbba2b8feea063ed2d0c79780b4c3507cf89b/nova/objects/service.py#L151

  https://github.com/openstack/nova/blob/a43dbba2b8feea063ed2d0c79780b4c3507cf89b/nova/db/sqlalchemy/models.py#L97

  Which is expecting a boolean, so 'yes' or 'on' is going to result in
  an error.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1697497/+subscriptions


References