* [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; 4+ 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] 4+ 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; 4+ 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] 4+ 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 2026-11-30 12:00 ` Roland Kammerer 1 sibling, 1 reply; 4+ 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] 4+ messages in thread
* Re: [RFC] storage plugin hook for node preference in the load rebalancer 2026-11-26 14:34 ` Daniel Kral @ 2026-11-30 12:00 ` Roland Kammerer 0 siblings, 0 replies; 4+ messages in thread From: Roland Kammerer @ 2026-11-30 12:00 UTC (permalink / raw) To: Daniel Kral; +Cc: pve-devel 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-30 12:00 UTC | newest] Thread overview: 4+ 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 2026-11-30 12:00 ` Roland Kammerer
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.