Skip to content

Add automatic rebalancing after resource clone and snapshot restore #487

Open

Description

@kvaps

After rd clone or snapshot restore, replicas inherit the source volume's placement. When many volumes are cloned from the same source (e.g., golden image cloning for VMs), all replicas concentrate on the source nodes, creating storage hotspots.

LINSTOR could automatically rebalance newly created resources by checking query-size-info for optimal placement and running migrate-disk for misplaced replicas.

Currently we work around this in the CSI driver (see piraeusdatastore/linstor-csi#419), but a native LINSTOR solution would be more general and could benefit all LINSTOR users, not just CSI.

Possible approach:

  • After rd clone / snapshot restore completes, compare actual placement with query-size-info result
  • For each misplaced replica, create a diskless on the target node and run migrate-disk
  • This could be an opt-in resource group property (e.g., AutoRebalanceAfterClone)

Activity

  1. rp- commented on Mar 6, 2026

    @rp-
    Contributor

    Hey kvaps!

    I know of this problem and there is actually a PR floating around which was thought of a small fix, that would on clone create an additional diskful replica.
    Then after the next BalanceResourceTask cycle it would remove the diskfull with the least space avialable and kinda helps in balancing.

    I just also had a brief look at your rebalancer PR, but there are 2 things that I don't like.

    1. The approach uses a rest api option, which means all plugins need to be adapted to use this (takes some time)
    2. We plan to have a full rebalance task in the future, which would run in the background and try to keep resources well balanced between nodes. I guess as you can imagine that is not a trivial task so it might still take some time.
  2. kvaps commented on Mar 10, 2026

    @kvaps
    ContributorAuthor

    Hi @rp-! Thanks for the feedback.

    I understand the concern about the REST API option requiring changes across all plugins. The approach with creating an additional diskful replica on clone and letting BalanceResourceTask handle the cleanup sounds much cleaner.

    A couple of questions:

    1. Does the existing PR also cover snapshot restore, or only clone?
    2. Is the BalanceResourceTask already functional, or is it part of the planned full rebalance feature?

    Happy to close my PR if there's already a better solution in the pipeline. I just want to make sure the snapshot restore path is also covered.

  3. rp- commented on Mar 16, 2026

    @rp-
    Contributor
    1. Does the existing PR also cover snapshot restore, or only clone?

    I don't think it covers snapshot restore, but shouldn't be too hard to also add it there.

    1. Is the BalanceResourceTask already functional, or is it part of the planned full rebalance feature?

    The BalanceResourceTask was introduced in 1.26.0, but it only will make sure resource definitions meet their replica-count settings.

    A real rebalanceTask is still planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions