'deleted' filter does not work properly for server list

Bug #1443890 reported by Ankit Agrawal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Ankit Agrawal

Bug Description

When calling server list with deleted filter set to true/false, it always returns deleted instances to admin.

Steps to reproduce:

Hit curl command with deleted='true', 'false' or any random string (e.g. deleted='abc')

curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X GET http://10.69.4.150:8774/v2/58bad77b05ef44f8a9f5fc5089bab30e/servers/detail?deleted='true' -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 32d57785556647d4b03e4cacf74e3aea"

curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X GET http://10.69.4.150:8774/v2/58bad77b05ef44f8a9f5fc5089bab30e/servers/detail?deleted='false' -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 32d57785556647d4b03e4cacf74e3aea"

curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X GET http://10.69.4.150:8774/v2/58bad77b05ef44f8a9f5fc5089bab30e/servers/detail?deleted='abc' -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 2c80485a73be4d439440702ae849ec61"

Expected result:
Server list should return deleted instances only when deleted filter contains any value from ('1', 't', 'true', 'on', 'y', 'yes').

Actual result:
All above commands returns deleted instances even deleted is passed as 'false', 'False' or 'abc'.

Tags: api
Changed in nova:
assignee: nobody → Ankit Agrawal (ankitagrawal)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/173296

Changed in nova:
status: New → In Progress
melanie witt (melwitt)
tags: added: api
removed: ntt
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 5c7c852dc0e4ac44e167585938a2b944c1156d10
Author: ankitagrawal <email address hidden>
Date: Tue Apr 14 03:38:47 2015 -0700

    'deleted' filter does not work properly

    While calling server list with deleted filter set to true/false, it
    always returns deleted instances to admin, because the code didn't
    convert string to boolean value. So even if we pass deleted='false'
    or any string value, it always returns True.

    Converted 'deleted' filter from string to its boolean value and set
    default to False if called with an invalid string.

    Closes-Bug: 1443890
    Change-Id: I215ebbd4638c94fbabe13a5b2ab8a356204dce3c

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-1 → 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.