Filter machines by power address, serial number (BMC, iLO, DRAC, etc.)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
Undecided
|
Unassigned | ||
maas-ui |
Fix Released
|
Low
|
Unassigned |
Bug Description
This comes from a customer request.
As per title, would it be possible to filter machines by power address (BMC, iLO, iDRAC, etc.)?
In case anybody else wants this feature and comes across this request, at the moment, I can think of a couple of workarounds (of varying suitability):
- Use tags. It isn't possible to partially match a tag (e.g. tag "192.168.1.10" won't be matched by a search for "192"), so it makes most sense to implement some sort of tagging scheme to achieve this, e.g. if you have a BMC network of 192.168.1.0/24 and a machine with a power address of 192.168.1.10, you could have "power:
- Use `jq` in the CLI. This was thrown together quickly, but the following could be used to return the power parameters and "system_id" of every machine managed by MAAS:
```
for i in $(maas "$MAAS_USER" machines read | jq -r '.[].system_id'); do maas <LOGIN> machine power-parameters "$i" | jq ". + {\"system_id\": \"$i\"}"; done | jq -s
```
Alternatively, to filter by particular attributes, such as "power_type":
```
for i in $(maas "$MAAS_USER" machines read | jq -r '.[] | select(.power_type == "moonshot") | .system_id'); do maas <LOGIN> machine power-parameters "$i" | jq ". + {\"system_id\": \"$i\"}"; done | jq -s
```
These would return:
```
[
{
"power_pass": "notapass",
"power_user": "notauser",
"power_
"power_
"system_id": "ybb6aq"
},
{
"power_pass": "notauser2",
"power_user": "notapass2",
"power_
"power_
"system_id": "8wyxah"
}
]
```
Which can then further be filtered with `jq`. Of course, given that a `power-parameters` query is made for every MAAS machine, this is slow. Additionally, "system_id" is not a particularly human-readable attribute; including "fqdn", for example, would be much more useful. However, this is beyond the scope here.
Reference to a case link: https:/
EDIT (2021-08-17): I've tested a MAAS 2.7.2 installation (STS MAAS) and found that if filtering by power address or serial number works. It therefore seems that there might be a regression here.
description: | updated |
Changed in maas: | |
status: | New → Invalid |
status: | Invalid → New |
summary: |
- Filter machines by power address (BMC, iLO, DRAC, etc.) + Filter machines by power address, serial number (BMC, iLO, DRAC, etc.) |
description: | updated |
Changed in maas: | |
status: | New → Incomplete |
tags: | added: feature |
Changed in maas-ui: | |
importance: | Undecided → Unknown |
Edited original comment to note that this used to work in 2.7.2. Removed "feature" tag, updated title to include serial number filtering.