MAAS selection of node for juju constraints does not choose "best/least-capable" match

Bug #1417793 reported by Clark Laughlin
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Wishlist
Raphaël Badin

Bug Description

I have a combination of different nodes in MAAS:
* arch=amd64, cpu-cores=4, mem=8GB
* arch=amd64, cpu-cores=8, mem=32GB
* arch=arm64, cpu-cores=8, mem=32GB

I am using "juju add-machine" and desire to select a node that has a lower-number of cores. When I specify "--constraints cpu-cores=4", I get an 8-core machine. When I specify "--constraints cpu-cores=3", I still get an 8-core machine.

The same is true when I specify "--constraints mem=4GB".

I expect to have a machine selected that is the lowest-capable match for the constraints. Instead, I seem to get the first match, which might be based on database order or some other ordering.

Related branches

Revision history for this message
Clark Laughlin (clark-laughlin) wrote :
description: updated
Revision history for this message
Clark Laughlin (clark-laughlin) wrote :
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

a quick search through the code shows no filtering for the result set for the node that best matches, just a first item off the result set.

summary: - MAAS selection of node for juju constraints does not choose "least-
+ MAAS selection of node for juju constraints does not choose "best/least-
capable" match
Changed in maas:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Raphaël Badin (rvb) wrote :

>A quick search through the code shows no filtering for the result set for the node that best matches, just a first item off the
> result set.

You're right. MAAS could be more intelligent and try to minimize the resources while still satisfying the constraints.

But for this strategy to be really useful, MAAS would need to grow a "cost function" (similar to what aws provides) to decide which machine gets picked up among all the machines that match the constraints.

The current workaround (when you have a limited set of machines and want to allocate them with precision) is to use tags.

Revision history for this message
Raphaël Badin (rvb) wrote :

> MAAS would need to grow a "cost function"

Ideally an admin should be able to define a "cost function" but a first step could be to provide something meaningful (for instance based on AWS pricing) out of the box.

Revision history for this message
Raphaël Badin (rvb) wrote :

Marking this fixed for now. We've added a tiny cost function that should make the call to acquire() prefer machines with fewer resources when multiple machines fit.

Changed in maas:
status: Triaged → Fix Committed
assignee: nobody → Raphaël Badin (rvb)
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.