Repository navigation
fix(controller): allocate no DRBD port or minor for a definition without DRBD - #289
Conversation
LINSTOR creates a resource's DRBD port, node-id and minor with its DRBD layer data, so a definition whose layer stack has no DRBD layer holds none of them. blockstor allocated all three for every replica, so a STORAGE-only volume showed a DRBD port it never listens on and took a port and a minor out of each node's finite range. The allocator now reads the definition's stack first and skips it when DRBD is absent. A stack still left to a group that sets one is waited for, since the pin may keep the default stack for a definition that already holds data. The satellite already skips its allocation gate for such stacks, so nothing waits on the IDs. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
LINSTOR's balance task ignores a definition that does not use DRBD: with no peer to resync from, a replica it tops up is only an empty volume under the definition's name. blockstor's scheduled pass and the RG event path placed on such definitions all the same, so a storage-only volume whose replica was deleted got a fresh empty one. Both now skip a definition whose own or inherited stack has no DRBD layer. An explicit rg modify still places on it, as LINSTOR's autoplace on a replica-count change does. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
…ing off The RG event path now leaves definitions without DRBD to the rebalance annotation, but with BalanceResourcesEnabled=false the rebalance reconciler only stripped that annotation. An explicit `rg modify --place-count` then placed the DRBD children and silently skipped the storage-only ones. LINSTOR's modify autoplaces every child of the group whatever its layer stack and whatever the BalanceResources setting; the kill switch covers the balance task only. With balancing off, the rebalance reconciler now places the children the RG event path leaves out before it strips the marker. DRBD children stay with the RG event path, so the existing kill-switch contract for them is unchanged. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The layer-stack check runs on every live Resource reconcile, RD-watch and sibling fan-out included, and it read the definition, and often its group, straight from the apiserver right before runApply read the same definition again from the cache. A stack is set once and never cleared, and the satellite applies the same gate, so a cached copy gives the same answer. Only a cache miss goes to the apiserver: a replica can arrive before the cache has the definition created a moment earlier, and reading that miss as a definition that is gone would allocate DRBD IDs for a storage-only replica. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The Bug 302 comments still said DRBD IDs are allocated unconditionally on every live reconcile, which is no longer true for a definition without DRBD or one whose stack is not pinned yet. The spawn-shortfall replay has no layer-stack skip while the scheduled pass does. That is deliberate, since it finishes a spawn that came up short rather than topping up after a deletion; say so, so it is not taken for an oversight. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
With BalanceResourcesEnabled=false the rebalance reconciler placed an explicit `rg modify` only on children without DRBD and left the DRBD ones to the RG event path. That path is not where LINSTOR's modify places, and once it makes the balance checks, the switch among them, nothing placed the DRBD children: the modify topped up storage-only volumes and silently skipped the rest. LINSTOR reads the switch in its balance task alone (BalanceResources.java:270 and 300-308); `rg modify` autoplaces every child short of the place count without consulting it (CtrlRscGrpApiCallHandler.java:583-621). The disabled branch now places every child itself. TestRGRebalanceReconcilerHonoursBalanceResourcesDisabled asserted that such a modify places nothing, and TestRGRebalanceDisabledLeavesDRBDChildToRGEvent pinned the split; both now assert the placement. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
I checked the LINSTOR side at linstor-server v1.35.3. BalanceResources.shouldIgnoreRscDfn skips a definition without DRBD before the UpToDate checks (L235-261). rg modify with a replica count autoplaces every child short of it, without looking at the stack or the balance switch (CtrlRscGrpApiCallHandler.java L644-667 at that tag; the PR cites L583-621, which match a different version). The ID gate waits only on the group-stack case, and pinLayerStack resolves that independently of the replicas, so a DRBD replica cannot stall there. The RG event path's applyRGToRD does nothing but place, so skipping it for storage-only children loses nothing else. CI is green. LGTM.
What this fixes
A resource definition whose layer stack has no DRBD layer (
STORAGE, orLUKS,STORAGE) still had a DRBD port, node-id and minor allocated for every replica. Such a replica never listens on that port, yetr lshowed one, and each allocation took a slot out of the node's finite port range and the cluster's minor range.The balancing passes had the same blind spot. The scheduled rebalance and the RG event path topped such definitions up like any other, so a storage-only volume whose only replica was deleted got a fresh, empty replica under its name. Once #280 lands, its new guard (skip a definition with no UpToDate diskful replica) reads these definitions as never UpToDate, because a replica without DRBD has no DRBD disk state, and logs a skip for each of them on every pass.
What LINSTOR does
LINSTOR creates a resource's TCP port, node-id and volume minor as part of its DRBD layer data (
RscDrbdLayerHelper), so a resource built from a stack without DRBD has none. Its balance task (BalanceResources.shouldIgnoreRscDfn) ignores a definition that does not use the DRBD layer before it checks anything else, the UpToDate rule included. An explicitrg modifywith a replica count autoplaces every child definition short of that count regardless of the stack, and regardless of the BalanceResources setting (CtrlRscGrpApiCallHandler.java:583-621), which only the balance task reads (BalanceResources.java:270,300-308).Changes
rg modifystill places on such a definition through the rebalance annotation, with balancing on or off. WithBalanceResourcesEnabled=falsethe rebalance reconciler used to only strip the annotation, which worked only because the RG event path placed every child on the same update. It now places every child itself before stripping the annotation, DRBD and storage-only alike, as LINSTOR's modify does. Leaving the DRBD children to the RG event path made the modify depend on a path LINSTOR does not place from, and once fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280 makes that path apply the balance checks, the switch among them, it would place nothing there with balancing off.Interactions with other open PRs
rg_rebalance_controller.goandresourcegroup_controller.go. The intended order after both is LINSTOR's: the no-DRBD skip comes before the UpToDate rule, so fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280's guard never sees a storage-only definition and stops logging a skip for each one on every pass.rebalanceChildRDsnow takes a selector of which children a pass places on (all, or DRBD only for the scheduled pass), and the kill-switched pass uses all of them. fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280 also changes the kill-switched branch: it places only for anrg modifythat named a place count, marked by a second annotation, and places nothing for a constraint-only modify. The resolution is fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280's branch with this PR's selection, all children for the place-count pass, and the no-DRBD skip on the gated passes too, since they stand for the balance task; this PR's tests that seed rebalance-pending for an explicit modify then need fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280's place-count mark.UnknownState and the layer chain the native CLI renders for these replicas; that part is not repeated here. With fix(cli): show non-DRBD replicas as Created, the way linstor-client does #283 the CLI also stops reading a DRBD layer for them; this PR stops allocating the port in the first place.LUKS,STORAGEstack is covered by the same check.Not changed
rg modifyannotation is stamped on a place-count raise and also on a change to a placement filter (layer stack, replicas-on-same, not-place-with-rsc, x-replicas-on-different), while LINSTOR autoplaces only when a replica count is given. So a filter-only modify still places on an under-placed child, storage-only ones included. This predates the PR and applies to DRBD definitions the same way; on main the RG event path placed storage-only children on every group event, controller start included, so this PR narrows the gap rather than widening it. fix(controller): keep rebalance from re-placing a definition whose replicas were deleted #280 closes it on the REST side ofrg modify.Testing
STORAGEandLUKS,STORAGEdefinitions, IDs still allocated for an explicit DRBD stack and for the default one, and a requeue without allocation while the stack is not pinned yet; the scheduled pass and the RG event path place nothing on a storage-only definition (stack on the definition or inherited from the group), the scheduled pass still tops up a DRBD definition, and therg modifypath still places on a storage-only one. WithBalanceResourcesEnabled=false, anrg modifyplaces both a storage-only and a DRBD child whichever of the RG event path and the rebalance reconciler runs first, and the rebalance reconciler alone places on a DRBD child too.TestRGRebalanceReconcilerHonoursBalanceResourcesDisabledon main asserted that such a modify places nothing with the switch off, which is not what LINSTOR does; it now asserts the placement, and the scheduled tick stays suppressed (TestRebalanceHonoursDisabled). The layer-stack check makes no apiserver read when the cache has the definition, and does not allocate when the cache misses a definition the apiserver has. All of these fail without the fix.make lint-config && make lint: 0 issues.go test ./...with envtest assets: pass.go test -tags=integration ./tests/integration/...for the tests touching layer stacks, DRBD ports and rebalance: pass. After the kill-switch change,-run 'TestGroup(KW|FR|RG)': pass. One run hit a snapshot timeout in a workflow test unrelated to this change; the rerun passed. After the review fixes, the RG, RD, DRBD minor, layer-stack, concurrency and balance-tick integration tests (TestGroupC*,TestGroupD,TestGroupL,TestGroupKWFBalanceResourcesTick,TestBug433*,TestBug434*,TestSmoke*) pass again.pkg/namingprovenance guard: pass.Not tested