Repository navigation
fix(internal): only require capacity for the space an expansion adds - #496
Merged
mhkarimi1383 merged 1 commit intoNov 7, 2026
Merged
Conversation
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
mhkarimi1383
approved these changes
Nov 7, 2026
ExpandRawFile refused an expansion unless the pool's remaining capacity could hold the volume's whole new size. get_capacity() already excludes the physical size of every volume in the pool, including the one being expanded, so its existing blocks were counted twice. Once a volume was larger than the space left in its pool, it could not be expanded at all, even by a small amount. Compare the capacity to what the expansion really takes: - thin volumes: the size increase, as truncate only grows the file. - thick volumes: the new size minus the image's physical size, as fallocate also allocates any holes (e.g. in an image restored from a sparse snapshot or discarded by mkfs). Using only the size increase would let such an expansion eat into the reserved capacity. Fixes openebs#494 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
mhkarimi1383
force-pushed
the
fix/expand-capacity-check
branch
from
November 7, 2026 09:03
412261d to
a1c7981
Compare
mhkarimi1383
enabled auto-merge
November 7, 2026 09:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #494
ExpandRawFilerefused an expansion unless the pool's remaining capacity could hold the volume's whole new size.get_capacity()already excludes the physical size of every volume in the pool, including the one being expanded, so the volume's existing blocks were counted twice. Once a volume was larger than the space left in its pool, it couldn't be expanded at all, even by a small amount.Changes:
ExpandRawFilenow compares the capacity to what the expansion really takes:truncateonly grows the file.new_sizeminus the image's physical size, asfallocatealso allocates any holes (for example in an image restored from a sparse snapshot or discarded bymkfs). Using only the size increase would let such an expansion eat into the reserved capacity.tests/unit/test_internal_svc.pycovers both provisioning modes, an increase that doesn't fit, and a thick image with holes.docs/user-guide/resize.mdandCHANGELOG.mdare updated.Testing:
.ci/unit.sh-equivalent run: 26 passed, 1 skipped. On macOS, so I ran pytest directly with the Linux-only_fallocateextension stubbed. CI will be the first run with the real one.ruff check/ruff format --check(v0.17.3, as in pre-commit) are clean.ExpandRawFileagainst a real pool directory with realstatvfs,get_capacityand metadata, stubbing onlylosetupandfallocate. For an 8MiB volume with 4MiB left, expanded to 10MiB:develop:RESOURCE_EXHAUSTED, for both thin and thick.OK, and the image and metadata are 10MiB. With 1MiB left, it is stillRESOURCE_EXHAUSTEDand the volume is unchanged.I haven't run this on a cluster, so the smoke and e2e suites are left to CI.