* [RFC] storage plugin hook for node preference in the load rebalancer
@ 2026-11-02 9:54 Roland Kammerer
2026-11-26 7:57 ` Roland Kammerer
2026-11-26 14:34 ` Daniel Kral
0 siblings, 2 replies; 3+ messages in thread
From: Roland Kammerer @ 2026-11-02 9:54 UTC (permalink / raw)
To: pve-devel
Hi PVE devs,
Daniel, thanks for the interesting talk at Proxtalks and our short
discussion in the Q&A.
The tl;dr version is: I think it would be great if the storage (plugin)
could have a say in where a VM is placed/rebalanced. LINSTOR/DRBD would
definitely benefit from that, there is some prior art on other platforms
like stork (Portworx) on k8s and I hope this could benefit other storage
providers as well.
The following then contains some RFC in parts generated with an LLM, but
first let me state the purpose of the RFC as of now and the LINSTOR use
case:
Don't be too picky about the proposed API, that is a first draft with a
simple list, it was the first thing that came to my mind. We could have
weights per node or whatever, right now I'm interested if "asking the
storage for placement" is something you would be willing to consider in
general, the actual API is for now "technical details".
The LINSTOR/DRBD case: Imagine a hyperconverged cluster where the PVE
nodes are the LINSTOR nodes and the user configured LINSTOR/DRBD replica
count of 3. The actual storage then lands on 3 nodes. At creation time
the plugin already tries to create local storage on the node the VM is
created. If the VM is then later moved it could end on a node that has a
local copy or not. In every case the actual storage can be accessed. If
we don't have local storage we need to read/write over the network, if
it is a node with local storage we can serve reads locally, a huge
benefit. If the storage could weigh in on placement decisions that would
be great.
Now the LLM assisted part, take it with a grain of salt, not every use
case might be valid and there might be ones that got overlooked. You
certainly know your ecosystem better than me, personally I only know
stork (Portworx) on k8s where the "ask the storage what it thinks"
exists for sure:
With the dynamic scheduler + load rebalancer series [0] the HA manager
will pick (resource, target node) pairs on its own and queue live
migrations. Candidates are filtered by HA rules and scored on CPU/memory
imbalance only. The storage a guest lives on has no say in where the
guest ends up, although for several storage types the target node
matters:
- ZFS with storage replication: live migration to a non-target node is
refused by qemu-server (or does a full copy with --force), to a target
node it is incremental.
- DRBD/LINSTOR: full-copy replicas on a few nodes, every other node goes
over the network (same model as Portworx on Kubernetes, where stork
steers pods to nodes holding a replica).
- Ceph/Vitastor with localized reads in stretched setups: moving the VM
to the other site turns every read into a cross-site read.
- Shared SAN (iSCSI/FC + LVM): per-node path health is visible to the
storage, not to the HA manager.
Proposal: a small, optional hook in the storage plugin API.
# PVE::Storage::Plugin, default implementation
sub rank_nodes {
my ($class, $scfg, $storeid, $volname, $nodes) = @_;
return $nodes; # no preference
}
The caller passes the candidate nodes (e.g. [D, B, C]), the plugin
returns them ordered by preference (e.g. [B, D, C]). Nodes left out are
unsuitable, so the hook covers both hard exclusion and soft preference.
A wrapper in PVE::Storage aggregates over all volumes of a guest. The
rebalancer can drop excluded candidates before scoring and feed the rank
into the planned "migration cost" criterion. The same hook would help HA
recovery and rebalance-on-start, where a replicated ZFS guest can today
be recovered onto a node without a copy of its disk.
This mirrors CSI topology / volume node affinity in Kubernetes, where
the scheduler asks the storage layer before placing a workload.
Open questions:
- Ordered list, or a numeric cost per node for mixing with other TOPSIS
criteria?
- Aggregation across volumes of one guest in PVE::Storage or in the HA
manager?
We would implement this for the LINSTOR plugin and are happy to send
patches for the default implementation and the wrapper if there is
interest.
Best regards,
Roland
[0] https://lore.proxmox.com/pve-devel/20260330144101.668747-1-d.kral@proxmox.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] storage plugin hook for node preference in the load rebalancer
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
1 sibling, 0 replies; 3+ messages in thread
From: Roland Kammerer @ 2026-11-26 7:57 UTC (permalink / raw)
To: pve-devel
friendly reminder that there has not been any feedback for quite some
time.
regards, rck
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] storage plugin hook for node preference in the load rebalancer
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
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Kral @ 2026-11-26 14:34 UTC (permalink / raw)
To: Roland Kammerer, pve-devel
On Mon Nov 2, 2026 at 10:54 AM CET, Roland Kammerer wrote:
> Hi PVE devs,
>
> Daniel, thanks for the interesting talk at Proxtalks and our short
> discussion in the Q&A.
Hi Roland!
Sorry for the wait and thanks a lot for writing up the idea as a RFC and
bringing it to the mailing list!
I'll try to sum up my thoughts on the topic below and happy to read your
and any other ideas and discussions.
>
> The tl;dr version is: I think it would be great if the storage (plugin)
> could have a say in where a VM is placed/rebalanced. LINSTOR/DRBD would
> definitely benefit from that, there is some prior art on other platforms
> like stork (Portworx) on k8s and I hope this could benefit other storage
> providers as well.
>
> The following then contains some RFC in parts generated with an LLM, but
> first let me state the purpose of the RFC as of now and the LINSTOR use
> case:
>
> Don't be too picky about the proposed API, that is a first draft with a
> simple list, it was the first thing that came to my mind. We could have
> weights per node or whatever, right now I'm interested if "asking the
> storage for placement" is something you would be willing to consider in
> general, the actual API is for now "technical details".
I'm going into some more technical details here below, but I think
having this is generally an interesting idea, since we already plan on
improving the load balancing decisions by including the migration costs,
where the storage migration is probably the largest and most important
part of it (especially as we go towards a general load balancer which
includes non-HA guests that may have local storage, even if that's not
too desirable for many live migrations to load balance).
>
> The LINSTOR/DRBD case: Imagine a hyperconverged cluster where the PVE
> nodes are the LINSTOR nodes and the user configured LINSTOR/DRBD replica
> count of 3. The actual storage then lands on 3 nodes. At creation time
> the plugin already tries to create local storage on the node the VM is
> created. If the VM is then later moved it could end on a node that has a
> local copy or not. In every case the actual storage can be accessed. If
> we don't have local storage we need to read/write over the network, if
> it is a node with local storage we can serve reads locally, a huge
> benefit. If the storage could weigh in on placement decisions that would
> be great.
Thanks for the overview of how LINSTOR/DRBD does handle volume
replication in the cluster!
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?
- 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?
- 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?
>
> Now the LLM assisted part, take it with a grain of salt, not every use
> case might be valid and there might be ones that got overlooked. You
> certainly know your ecosystem better than me, personally I only know
> stork (Portworx) on k8s where the "ask the storage what it thinks"
> exists for sure:
>
> With the dynamic scheduler + load rebalancer series [0] the HA manager
> will pick (resource, target node) pairs on its own and queue live
> migrations. Candidates are filtered by HA rules and scored on CPU/memory
> imbalance only. The storage a guest lives on has no say in where the
> guest ends up, although for several storage types the target node
> matters:
>
> - ZFS with storage replication: live migration to a non-target node is
> refused by qemu-server (or does a full copy with --force), to a target
> node it is incremental.
Just as a note: The HA/CRS stack currently does always migrate with
--force and --with-local-disks, so if the online migration of an HA
resource is specifically requested to a target node, which is not a
replication job target, then that full copy would already happen now.
> - DRBD/LINSTOR: full-copy replicas on a few nodes, every other node goes
> over the network (same model as Portworx on Kubernetes, where stork
> steers pods to nodes holding a replica).
> - Ceph/Vitastor with localized reads in stretched setups: moving the VM
> to the other site turns every read into a cross-site read.
> - Shared SAN (iSCSI/FC + LVM): per-node path health is visible to the
> storage, not to the HA manager.
>
> Proposal: a small, optional hook in the storage plugin API.
>
> # PVE::Storage::Plugin, default implementation
> sub rank_nodes {
> my ($class, $scfg, $storeid, $volname, $nodes) = @_;
> return $nodes; # no preference
> }
>
> The caller passes the candidate nodes (e.g. [D, B, C]), the plugin
> returns them ordered by preference (e.g. [B, D, C]). Nodes left out are
> unsuitable, so the hook covers both hard exclusion and soft preference.
> A wrapper in PVE::Storage aggregates over all volumes of a guest. The
> rebalancer can drop excluded candidates before scoring and feed the rank
> into the planned "migration cost" criterion. The same hook would help HA
> recovery and rebalance-on-start, where a replicated ZFS guest can today
> be recovered onto a node without a copy of its disk.
>
> This mirrors CSI topology / volume node affinity in Kubernetes, where
> the scheduler asks the storage layer before placing a workload.
Ad migration blockers in general:
One important aspect that you already mentioned is that a guest can use
different storages for different volumes: each guest volume plays a role
whether the guest can be moved, to which target nodes it can be moved,
how much moving to a specific node would cost, etc.
I'm currently working on a patch series which generally informs the HA
Manager about its guests implicit dependencies, so that restrictions can
already be accounted for while determining viable target nodes for load
balancing but also other scenarios, such as maintenance eviction,
rebalance-on-start and node failure recovery.
The main restrictions would be immovable HA resources (e.g. uses Intel
TDX/AMD SEV or a mapped device passthroughs without live migration
support while running) and HA resources with a limited target node set
(e.g. uses storage available only on certain nodes).
So in that regard, the per-storage 'nodes' option would already be
acknowledged for guests.
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.
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.
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.
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?
> - Aggregation across volumes of one guest in PVE::Storage or in the HA
> manager?
AFAICT PVE::Storage shouldn't be too coupled to the concept of guests
(though @Max C. has probably more to say about this here) and the HA
Manager already does know which guests are relevant to ask for.
>
> We would implement this for the LINSTOR plugin and are happy to send
> patches for the default implementation and the wrapper if there is
> interest.
>
> Best regards,
> Roland
>
> [0] https://lore.proxmox.com/pve-devel/20260330144101.668747-1-d.kral@proxmox.com/
Cheers,
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 14:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox