Skip to content

machines.list should accept the same criteria for filtering as the official MaaS CLI Client #238

Closed as not planned

Description

@dandruczyk

The python-libmaas API is missing the ability to query by anyting other than system_id in client.machines.list

The CLI distributed with maas allows you to read a machine's details with its system_id or a large number of other optional criteria (see below for list as of 2.6.2).

i.e. maas machines read hostname=
This call is fast typically under a couple seconds (depends on how complex the machine is)

The python-libmaas API only allows you to query a machine by system_id, which is a giant pain when you are trying to deploy a machine and don't know it's system_id but you do knows its hostname or other criteria, which forces you to use the client.machines.list() call which is extremely slow as noted in #208 (And it gets progressively worse the more machines that maas knows about)

tl;dr please add all the other possible search criteria (starting with hostname) argument to client.machines.list call to allow filtering on that as well as system_id like the maas CLI has already (since 2.6.2 at least for sure)

2.6.2 CLI allows querying machines with these optional options:
List nodes visible to current user, optionally filtered by
criteria.

Nodes are sorted by id (i.e. most recent last) and grouped by type.

:param hostname: Optional. Only nodes relating to the
node with the matching hostname will be returned. This can be specified
multiple times to see multiple nodes.
:type hostname: String

:param cpu_count: Optional. Only nodes with the specified
minimum number of CPUs will be included.
:type cpu_count: Int

:param mem: Optional. Only nodes with the specified
minimum amount of RAM (in MiB) will be included.
:type mem: String

:param mac_address: Optional. Only nodes relating to
the node owning the specified MAC address will be returned. This can be
specified multiple times to see multiple nodes.
:type mac_address: String

:param id: Optional. Only nodes relating to the nodes
with matching system ids will be returned.
:type id: String

:param domain: Optional. Only nodes relating to the
nodes in the domain will be returned.
:type domain: String

:param zone: Optional. Only nodes relating to the
nodes in the zone will be returned.
:type zone: String

:param pool: Optional. Only nodes belonging to the
pool will be returned.
:type pool: String

:param agent_name: Optional. Only nodes relating to
the nodes with matching agent names will be returned.
:type agent_name: String

:param fabrics: Optional. Only nodes with interfaces
in specified fabrics will be returned.
:type fabrics: String

:param not_fabrics: Optional. Only nodes with
interfaces not in specified fabrics will be returned.
:type not_fabrics: String

:param vlans: Optional. Only nodes with interfaces in
specified VLANs will be returned.
:type vlans: String

:param not_vlans: Optional. Only nodes with interfaces
not in specified VLANs will be returned.
:type not_vlans: String

:param subnets: Optional. Only nodes with interfaces
in specified subnets will be returned.
:type subnets: String

:param not_subnets: Optional. Only nodes with
interfaces not in specified subnets will be returned.
:type not_subnets: String

:param status: Optional. Only nodes with specified
status will be returned.
:type status: String

:param pod: Optional. Only nodes that belong to a
specified pod will be returned.
:type pod: String

:param not_pod: Optional. Only nodes that don't
belong to a specified pod will be returned.
:type not_pod: String

:param pod_type: Optional. Only nodes that belong to
a pod of the specified type will be returned.
:type pod_type: String

:param not_pod_type: Optional. Only nodes that don't
belong a pod of the specified type will be returned.
:type not_pod_type: String

Activity

  1. changed the title [-]machines.list should accept hostname=<> like the CLI maas <profile> machines read hostname=<>[/-] [+]machines.list should accept the same criteria for filtering as the official MaaS CLI Client[/+] on Jun 3, 2020
  2. github-actions commented on Feb 3, 2024

    @github-actions

    This issue is stale because it has been open for 30 days with no activity.

  3. github-actions commented on Mar 4, 2024

    @github-actions

    This issue was closed because it has been inactive for 30 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions