MAAS Commission/Allocate/Deploy/Release APIs to ignore locked machines

I am currently using MaaS 3.3 as an infrastructure provider for a datacenter. I’d like to know if it is possible to add a field to all of the APIs which change machine state to respect the “locked” status of machines. I am using Cluster API to interact with MaaS and create Kubernetes clusters but want to avoid any locked machines from being changed programmatically. Ideally I would want locked machines to be unable to change, but short of that would like there to be a field on API requests to filter out locked machines from the responses (thus disallowing machines to change state). Is there such an option available? I read through the source on Github but didn’t see anything for the allocate function and assume it’s the same for the rest of the operations.

Hi callmecclemon!

Could you provide a bit more details on what problems you’re encountering?

Locked machines are prevented from changing states already. If you try to do an operation on a locked machine, it should cause an error.

For the allocate API, this shouldn’t cause an issue, since the allocate API works on Ready machines, and as far as I can see, you can’t lock a Ready machine.

It’s true that you can’t filter on locked machines, though. But if you get a machine via the API, you should be able to see that it’s locked.