How should I manipulate lxd's allocatable resource pool?

How LXD in cluster mode decides which node should run this particular container?

How can I extend LXD’s resource manager by telling it, oh this node is full? According to some QOS metrics?

I have a performance agent running on each hardware resource. I want this performance agent to decide how many more containers I can run in its node. But I am unsure how I can manipulate lxd’s available allocatable resource pool.

To reiterate my question is where the instance should run. I would like to stop lxd to consider putting another instance/container in the particular node (cluster member) if the performance agent decides.

Should I somehow update the lxd’s database?

LXD currently has very basic heuristics for instance placement and simply uses the cluster member with the least number of instances.

If you have external metrics though you can tell LXD exactly which cluster member to deploy the new instance on using the --target flag to lxc init or lxc launch commands.

You can also use Cluster Groups to restrict which cluster members are considered for instance placement.

We do also have a future planned feature that will allow custom instance placement logic .

This is where the specification for the forthcoming feature will be designed: