server list by 'tags' does not work

Bug #1946816 reported by melanie witt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned
python-openstackclient
Fix Released
Undecided
Unassigned

Bug Description

Copied from a downtream bug [1]:

Description of problem:
I have a number of servers tagged with 'capo-e2e'. I want to list them by tag. I cannot do this. I added a second tag 'capo_e2e', and I can't select by that, either.

$ openstack --os-compute-api-version 2.26 server show 64232f5b-01e8-4139-be54-59c0399c40a8
+-----------------------------+----------------------------------------------------------+
| Field | Value |
+-----------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2021-10-11T12:27:27.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | capo-e2e-network=10.0.2.16 |
| config_drive | |
| created | 2021-10-11T12:27:16Z |
| description | capo-e2e-worker |
| flavor | m1.xlarge (86d33ae4-b13d-4381-84a8-a0c307115bf9) |
| hostId | 6ad047fd6e10b28977a60c38bde9c73b24130c0b24012a42fcdda227 |
| id | 64232f5b-01e8-4139-be54-59c0399c40a8 |
| image | ubuntu-2004-lts (cbabe19a-de0d-4297-bb5e-65ae7db4946a) |
| key_name | None |
| locked | False |
| name | capo-e2e-worker |
| progress | 0 |
| project_id | 25c8689dad974accbed26d0c67aadb4f |
| properties | |
| security_groups | name='capo-e2e-secgroup' |
| status | ACTIVE |
| tags | capo-e2e, capo_e2e |
| updated | 2021-10-11T12:27:28Z |
| user_id | bc844776c9a143b087ae4b811778ec2e |
| volumes_attached | |
+-----------------------------+----------------------------------------------------------+

$ openstack --os-compute-api-version 2.26 server list --tags capo-e2e
Invalid input for query parameters tags. Value: ['capo-e2e']. "['capo-e2e']" is not a 'regex' (HTTP 400) (Request-ID: req-91a4d02a-8e4a-44c7-aa04-99808648a847)

(Incidentally, there may be good technical reasons for 👆 but it's a very bad api experience)

The following all list no servers:

$ openstack --os-compute-api-version 2.26 server list --tags capo\\-e2e
$ openstack --os-compute-api-version 2.26 server list --tags capo_e2e
$ openstack --os-compute-api-version 2.26 server list --tags e
$ openstack --os-compute-api-version 2.26 server list --tags '.*e.*'
$ openstack --os-compute-api-version 2.26 server list --tags '/.*e.*/'

(I'm basically just guessing random syntax)

Version-Release number of selected component (if applicable):
openstack-nova-api-20.6.2-2.20210607104828.el8ost.4.noarch

How reproducible:
Always

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2012910

Tags: api
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/+/813736

Revision history for this message
melanie witt (melwitt) wrote :
Changed in python-openstackclient:
status: New → Fix Released
Revision history for this message
melanie witt (melwitt) wrote (last edit ):

This is actually Invalid for nova. I made a mistake when I read the api-ref and missed that it says [1]:

"""
tags (Optional)

query

string

A list of tags to filter the server list by. Servers that match all tags in this list will be returned. Boolean expression in this case is ‘t1 AND t2’. Tags in query must be separated by comma.

New in version 2.26
"""

with the important bit being "Tags in query must be separated by comma." The nova API expects the tags request param to be of the format "tag1,tag2,tag3" and does not expect a string representation of a JSON list.

[1] https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#id15

Changed in nova:
assignee: melanie witt (melwitt) → nobody
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by "melanie witt <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/nova/+/813736
Reason: I can't read.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient 5.7.0

This issue was fixed in the openstack/python-openstackclient 5.7.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient 5.6.1

This issue was fixed in the openstack/python-openstackclient 5.6.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient wallaby-eom

This issue was fixed in the openstack/python-openstackclient wallaby-eom release.

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.