From: Roland Kammerer <roland.kammerer@linbit.com>
To: Daniel Kral <d.kral@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [RFC] storage plugin hook for node preference in the load rebalancer
Date: Mon, 30 Nov 2026 13:00:32 +0100 [thread overview]
Message-ID: <aw1lYOOUXK5aAVpP@arm64> (raw)
In-Reply-To: <DN57TKWURW2Q.2C9BZXOECGBX@proxmox.com>
On Thu, Nov 26, 2026 at 03:34:19PM +0100, Daniel Kral wrote:
> Just to get a better understanding, I'd be interested in:
>
> - At what point in time are the replica nodes chosen? Are they known
> right as the volume has been allocated?
Yes, nodes are chosen at volume creation (also see next question).
> - How are the replication nodes for a volume chosen in a cluster? Let's
> say the replica count is configured to 3 and the cluster has 7 nodes?
> What are the objective criterias to balance out the replicas?
A storage of type DRBD (as in storage.cfg) has an entry called "resource
group". That is LINSTOR's concept of bundling settings. This includes
the replica count and usually the name of a (LINSTOR) storage pool.
Let's say all 7 nodes have a LINSTOR storage pool called "fastpool"
(backed by local storage like a LVM VG). Now the user clicks that
storage to create a VM disk, the plugin reads the (LINSTOR) resource
group, tells the LINSTOR controller to create a disk of $size from the
resource group "fastpool". And now the important part: the LINSTOR
controller uses an internal component called the "AutoPlacer". In the
most simple case it will chose the 3 nodes out of the 7 that still have
the most free space in "fastpool".
In reality things are a bit more complicated: The user can set
properties in the LINSTOR resource group to influence the placement.
Like not placing storage on nodes with a certain "label",... Also we
already try to create local storage on the node the user selected in the
PVE gui and then let the AutoPlacer place the rest.
So a good abstraction is "the nodes with the most space in the LINSTOR
storage pool the resource group points to", while actual placement can
get more complicated.
> - If a guest is moved to a node, where one or more of their volumes
> aren't replicated yet, is the local storage moved from the current
> node to the target node? That is, with replica count = 3, does it
> always stay 3, or is there a point where it could (briefly) go to 4
> volume replicas?
There is an extra setting for that, it is called "auto-diskful". If off
(the default) and the VM is moved to a node without a replica we
read/write over the network and that is it. If the setting is "on" one
can define a time for how long the diskless resource has to be in use
before it gets a local copy. Then what you described happens: You get a
local copy, data synchronizes and during that time you have an extra
copy of the data.
That is what we want to avoid. While already synchronized data can be
used before the whole sync finishes, one still needs to sync the whole
data (DRBD always has full copies) eventually.
For completeness: There is an extra setting if an old, then unused extra
copy stays or gets deleted, but I guess that does not matter too much
here.
> Ad invocation of such a method:
>
> These checks are for now all based on information that is already
> available from reading config files from the pmxcfs, so it's reliably
> fast to fetch the relevant data.
>
> However, for an endpoint like this for third-party storage plugins, we
> cannot have these guarantees and the HA/CRS stack should never block on
> such a request. So I think it would be more interesting to broadcast
> such information about volumes through the pmxcfs and if it isn't
> available just assume that all nodes are allowed and equivalent.
Good point and I agree, calling into potentially blocking - and in
LINSTOR's case networking code - sounds wrong.
It should be the responsibility of PVE to query the information via the
storage API and cache it into pmxcfs in whatever internal format. Guess
we agree that writing to pmxcfs should not be done directly by the
plugin or the storage platform (LINSTOR in this case)?
> Ad the proposed API:
>
> It's not fully decided yet how migration costs are represented for the
> load balancer, but it would be good to know how other storage plugins
> would implement such an interface.
>
> In general, the interface asks two questions here:
>
> 1. To which nodes can the volume be migrated to?
> 2. How much does it cost to migrate to other available nodes?
>
> I'm a bit unsure whether it might be too powerful to let the storage
> plugin remove target nodes: There's certainly some use cases, such as
> 'no storage space left on that node', but it could also be removed in
> other cases, where it might be detrimental how well the load balancer
> can make decisions.
Yes, interesting questions. Guess that would need input from other
platforms. The funny thing here is that when we talk about migration (so
the storage is already placed), we have this situation where placing to
a node without a local copy is not desirable, but creating a diskless
DRBD device (reading/writing over network) basically comes at no cost.
After placement we never run into a "no storage space left" scenario
(ignoring auto-diskful, resizes, thinly provisioned storage,...).
IMO excluding nodes does not hurt, but yeah, I get the point that
interfaces should not be too powerful/split by responsibility. I think
for LINSTOR's case it does not matter too much.
> And I'm also unsure whether this should be a single API, so I'll talk
> about the second question only for now.
>
> >
> > Open questions:
> >
> > - Ordered list, or a numeric cost per node for mixing with other TOPSIS
> > criteria?
>
> The load balancer would definitely benefit of having some numerical cost
> assigned to nodes, so there's some term or factor that can be aggregated
> even between different storage plugin implementations. And the numerical
> cost should be comparable and probably something objective, so more of a
> real cost than just a node preference.
Sounds good, guess actual costs make more sense in general. As I wrote,
this was just to get the ball rolling, we certainly can come up with
some cost function.
> Generally, the storage-related migration cost would determine how much
> effort must be made to migrate the guest's volumes to another node. For
> generic local storages, this will likely include some calculation of how
> much bytes need to be sent over a link that averages to some amount of
> bytes per second.
>
> How that calculation is done is debatable (Let users configure the
> to-be-expected network speeds statically between nodes? Test it every
> now and then dynamically without loosing to much productive bandwidth?
> Remember how fast previous migrations over the links were?).
>
> One possible unit for that numerical cost for this (storage-only)
> interface could just be the amount of bytes that would need to be moved
> to the node and the external caller makes the calculation against the
> known network speeds?
>
> For example, ZFS could then return the (estimate of?) the bytes of the
> diff to another node if it's a replication target and just return the
> full disk size on a full copy for any node that is not a replication
> target.
>
> Would such an interface work for DRBD? Any other ideas for it? Or any
> ideas of how other storage plugins could use this interface?
All of that sounds very reasonable to me and I guess bytes for storage
is fine as well, but I just wonder how much support and flexibility PVE
should provide here. For example network speeds taken into account for
migration costs: Good idea, but PVE might not even know all the
constraints for that, like a user could define several networks with
different properties and so on. LINSTOR on the other hand knows all/most
of that. What I'm trying to say: returning costs sounds like a good
idea, but keeping that as abstract as possible and moving responsibility
to the plugin also sounds like a good idea. Then the calculation can be
as complex as necessary and not just "bytes". Another example: nodes
without local storage on the same replication network: for "bytes" (and
even with network speeds) they would be equivalent, but LINSTOR might
have more information: the "equivalent" nodes might have different free
storage and all of the settings that are taken into account for the
initial placement are still valid. So basically LINSTOR would do a
try-run of the AutoPlacer and order nodes/assign costs. That sounds a lot
more powerful than just bytes. If that is considered too powerful
"bytes" is better than nothing, that's for sure.
Best, rck
prev parent reply other threads:[~2026-11-30 12:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 9:54 [RFC] storage plugin hook for node preference in the load rebalancer Roland Kammerer
2026-11-26 7:57 ` Roland Kammerer
2026-11-26 14:34 ` Daniel Kral
2026-11-30 12:00 ` Roland Kammerer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aw1lYOOUXK5aAVpP@arm64 \
--to=roland.kammerer@linbit.com \
--cc=d.kral@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox