[2.6] Cannot filter machines by fabric/vlan, subnet or even status when executing 'machines read'

Bug #1828444 reported by Andres Rodriguez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Alberto Donato

Bug Description

I want to read machines filtered by fabric/vlan, subnet, status but I'm unable to do so because the machines read endpoint only provides a few filtering options. Current filtering options are:

 :param hostname:

 :param mac_address:

 :param id:

 :param domain:

 :param zone:

 :param pool:

MAAS should allow me to filter by fabric/vlan combination and/or subnet, and by the status of the machine.

This is with the goal of reducing the amount of data we may have when running 'maas admin machines read' and we are attempting to filter machines out as much as possible.

e.g. in very large environments, like 1000s of machines, we are doing to want to filter by more advanced settings.

Related branches

Changed in maas:
milestone: none → 2.6.0rc1
assignee: nobody → Alberto Donato (ack)
importance: Undecided → High
description: updated
Revision history for this message
Blake Rouse (blake-rouse) wrote :

This should not be done just Adhoc, we should determine exactly what we want it to filter by and have it match how the UI will be filtered.

That will allow the same QuerySet building that the API does to be used by the Websocket for the UI when filter and paging are performed server-side.

Revision history for this message
Alberto Donato (ack) wrote :

I agree it shouldn't be done ad-hoc. To do it properly, we should go in the direction of a more REST-y API, where we don't expand all the properties of an object, but rather have refs to related objects.
In this case, for instance, instead of including the VLAN/fabric info in the machine result, we'd have a ref pointing at a VLAN/fabric ID.
At that point it'd be easier to have generic filters that could take a value for any direct attribute of a machine, including VLAN/fabric ID (or pool, zone, domain, ...).
The same would apply to simple attribugtes like the hostname

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Agreed. So this bug is only to address part of the things we would need to improve the API on. So these three things would be:

1. Allow better filtering when doing a machines read (e.g. this bug report)
2. Allow pagination
3. Allow referencing of objets instead of providing output (which is suggestion #2).

This bug is only about providing better filter 1. Please note we should use the same convention as allocate.

Alberto Donato (ack)
Changed in maas:
status: New → Triaged
Alberto Donato (ack)
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
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.