Want to filter nodes with label1 AND label2

Bug #1477605 reported by Julia Aranovich
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Invalid
Low
Ilya Kutukov

Bug Description

Now it is possible to filter nodes with label1 OR label2

fuel2 node list --labels label1=value1 label2=value2

I think we should also support AND operation here. Maybe it will be smth like:

fuel2 node list --labels label1=value1 label2=value2 --labels label3=value3
(means nodes with (label1 OR label2) AND label3)

Revision history for this message
Vladimir Sharshov (vsharshov) wrote :

This is wishlist. Moving to 8.0

Changed in fuel:
importance: Medium → Wishlist
status: Confirmed → Won't Fix
Dmitry Pyzhov (dpyzhov)
tags: added: feature
Dmitry Pyzhov (dpyzhov)
Changed in fuel:
assignee: Andriy Popovych (popovych-andrey) → Fuel Python Team (fuel-python)
milestone: 7.0 → 8.0
no longer affects: fuel/8.0.x
Dmitry Pyzhov (dpyzhov)
tags: added: area-python
Revision history for this message
Evgeniy L (rustyrobot) wrote :

>> fuel2 node list --labels label1=value1 label2=value2 --labels label3=value3
>> (means nodes with (label1 OR label2) AND label3)

Doesn't look explicit and and obvious, I would propose to add conditions explicitly, with `or`, `and`, `in` and so on.

Ilya Kutukov (ikutukov)
Changed in fuel:
assignee: Fuel Python Team (fuel-python) → Ilya Kutukov (ikutukov)
Revision history for this message
Ilya Kutukov (ikutukov) wrote :

Requestor invended intuitive way to define this param like:
--labels "(label1 OR label2) AND label3”
but this is DSL expression that is not lightweight solution

Also it is possible to make smth lightweight like
--labels label1 label2+label3 label4
but operators execution order should be fixed as OR over AND or AND over OR and some filter conditions could not be defined

Revision history for this message
Alexey Shtokolov (ashtokolov) wrote :

Folks, for solution from description:
 --labels label1=value1 label2=value2 --labels label3=value3
--labels "(label1 OR label2) AND label3”
there is no way to make AND or AND

So I suggest to support DSL expressions like AND, OR, NOT

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-fuelclient (master)

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

Changed in fuel:
status: Triaged → In Progress
Revision history for this message
Roman Prykhodchenko (romcheg) wrote :

Sorry folks, but this bug requires a blueprint because it requires changes in the API which then may be re-used in fuel-client. Logic like this cannot be landed to the client side.

Changed in fuel:
status: In Progress → Invalid
Revision history for this message
Dmitry Pyzhov (dpyzhov) wrote :

Let's discuss the scope and implementation.

Changed in fuel:
status: Invalid → In Progress
Revision history for this message
Roman Prykhodchenko (romcheg) wrote :

It looks like it's time to think about a generic filtering feature in the API. It's required for nodes, clusters and many other objects Fuel operates. It will touch both API and DB layer of Nailgun and then client-side components will just use that modified API.

Revision history for this message
Julia Aranovich (jkirnosova) wrote :

Yes, we have an idea about generic filtering in the API, which will be available both for UI and CLI. But I'm not sure when we'll start its implementation. This particular ticket was created as a result of an experience of label management in CLI. I think the case to get nodes with label1 AND label2 is a more frequent case than to get nodes with label1 OR label2 OR both. For this purpose I would run 2 commands to filter separately nodes by label1 and then by label2.

For example, user wants to get a node from rack#1 and position#3 (rack# and position# are node labels). Now (in master) he will get all nodes from rack#1 and all nodes, that located at position#3 through all racks. I think it is unacceptable.

I think we should go with CLI change for the ticket.

Revision history for this message
Vitaly Kramskikh (vkramskikh) wrote :

+1 for supporting multiple arguments assuming AND. As for DSL, it's the ideal solution and we have this item in our backlog.

Revision history for this message
Roman Prykhodchenko (romcheg) wrote :

I can see absolutely no way this to be implemented in fuel client only. If a bigger discussion is needed, please start a thread at openstack-dev ML.

Revision history for this message
Sergii Golovatiuk (sgolovatiuk) wrote :

Please do not open bugs for features. Bug should fix something and not to introduce functionality.

Changed in fuel:
status: In Progress → Invalid
Revision history for this message
Ilya Kutukov (ikutukov) wrote :

My opinion is to preserve existing code in the review and close this bug as invalid.

But please, keep in mind that you are already have filtering by labels in CLI client, so the client appears to be fatter than you think. This change was approved by Roman, Sebastian and so on: https://review.openstack.org/#/c/204524/
All rejected changes was about only syntax of existing filtering on client side.

Revision history for this message
Sergii Golovatiuk (sgolovatiuk) wrote :

Fuel Client has filtering labels, that's true. It's already technical debt. To solve this issue for sure the logic should be moved to nailgun. nailgun should introduce some query language that can be used by clients. All these require specification, API planning, removing hard-code from UI and client. Otherwise iphone will die trying to filter 1k nodes environment.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-fuelclient (master)

Change abandoned by Ilya Kutukov (<email address hidden>) on branch: master
Review: https://review.openstack.org/244633

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.