server fault is not blacklisted for filtering/sorting

Bug #1762870 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Medium
Unassigned

Bug Description

The server['fault'] response key is a joined column in the instance_faults table, but is not listed in the blacklisted list of joined table keys:

https://github.com/openstack/nova/blob/43f4755d5e034a6ff1cd5788d76851642027a54e/nova/api/openstack/compute/schemas/servers.py#L298

it's also not listed as an ignored sort key, but we can't sort on fault since it's a dict in the response:

https://github.com/openstack/nova/blob/43f4755d5e034a6ff1cd5788d76851642027a54e/nova/api/openstack/compute/schemas/servers.py#L312

I'm not sure what would happen if you tried sorting instances on fault, but I think filtering on fault probably results in a 500 error.

Tags: api
Revision history for this message
Matt Riedemann (mriedem) wrote :

Looks like we just ignore "fault" as a query parameter:

stack@rocky:~$ curl http://162.253.55.188/compute/v2.1/servers?fault=test -H "x-auth-token: $TOKEN" | python -m json.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 311 100 311 0 0 3970 0 --:--:-- --:--:-- --:--:-- 3987
{
    "servers": [
        {
            "id": "f3406368-d27e-4da0-8644-a7341be91c6f",
            "links": [
                {
                    "href": "http://162.253.55.188/compute/v2.1/servers/f3406368-d27e-4da0-8644-a7341be91c6f",
                    "rel": "self"
                },
                {
                    "href": "http://162.253.55.188/compute/servers/f3406368-d27e-4da0-8644-a7341be91c6f",
                    "rel": "bookmark"
                }
            ],
            "name": "test-server2"
        }
    ]
}
stack@rocky:~$

Probably because of this:

https://github.com/openstack/nova/blob/43f4755d5e034a6ff1cd5788d76851642027a54e/nova/api/openstack/compute/schemas/servers.py#L394

Revision history for this message
Matt Riedemann (mriedem) wrote :

Trying to sort on 'fault' results in a 400 as I'd expect:

stack@rocky:~$ curl http://162.253.55.188/compute/v2.1/servers?sort_key=fault -H "x-auth-token: $TOKEN" | python -m json.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 875 100 875 0 0 77860 0 --:--:-- --:--:-- --:--:-- 79545
{
    "badRequest": {
        "code": 400,
        "message": "Invalid input for query parameters sort_key. Value: fault. u'fault' is not one of ['access_ip_v4', 'access_ip_v6', 'auto_disk_config', 'availability_zone', 'config_drive', 'created_at', 'display_description', 'display_name', 'host', 'hostname', 'image_ref', 'instance_type_id', 'kernel_id', 'key_name', 'launch_index', 'launched_at', 'locked_by', 'node', 'power_state', 'progress', 'project_id', 'ramdisk_id', 'root_device_name', 'task_state', 'terminated_at', 'updated_at', 'user_id', 'uuid', 'vm_state', 'architecture', 'cell_name', 'cleaned', 'default_ephemeral_device', 'default_swap_device', 'deleted', 'deleted_at', 'disable_terminate', 'ephemeral_gb', 'ephemeral_key_uuid', 'id', 'key_data', 'launched_on', 'locked', 'memory_mb', 'os_type', 'reservation_id', 'root_gb', 'shutdown_terminate', 'user_data', 'vcpus', 'vm_mode']"
    }
}
stack@rocky:~$

Changed in nova:
status: Triaged → Invalid
Revision history for this message
Alex Xu (xuhj) wrote :

yea, we ignore the query parameters not in the schema.

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.