adaptive: honor user-provided capacityBytes when provider stats are unavailable#13059
adaptive: honor user-provided capacityBytes when provider stats are unavailable#13059genegr wants to merge 2 commits intoapache:4.20from
Conversation
|
@genegr as this is a simple bug fix, could you rebase over branch |
…navailable AdaptiveDataStoreLifeCycleImpl.initialize() guarded the user-provided capacityBytes behind stats != null when computing the pool capacity to persist. As a consequence, any adaptive provider that could not report capacity yet (for example a FlashArray pod that has not been given a quota and has no footprint yet, or a transient probe failure) caused the whole pool registration to fail with "Capacity bytes not available from the storage provider, user provided capacity bytes must be specified" even when the operator had passed capacityBytes= on createStoragePool. Accept the user-supplied value unconditionally and use the provider stats only as an upper-bound sanity check when they are actually available. The "no user-provided capacity, no provider capacity" branch is preserved and still raises the same InvalidParameterValueException. Signed-off-by: Eugenio Grosso <eugenio.grosso@gmail.com>
e7d2553 to
25641c3
Compare
|
|
||
| if (CollectionUtils.isNotEmpty(quarantinedAddressesIDs)) { | ||
| sc.setParameters("id", quarantinedAddressesIDs.toArray()); | ||
| } |
There was a problem hiding this comment.
@genegr IP related changes are not relevant to the PR description.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #13059 +/- ##
=========================================
Coverage 16.26% 16.26%
Complexity 13435 13435
=========================================
Files 5665 5665
Lines 500556 500555 -1
Branches 60790 60789 -1
=========================================
+ Hits 81416 81432 +16
+ Misses 410036 410016 -20
- Partials 9104 9107 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Rebased onto No content changes; only the base. |
|
@genegr can you check/fix the build error. |
There was a problem hiding this comment.
Pull request overview
Fixes managed primary storage pool registration for adaptive plugin providers by honoring user-supplied capacityBytes even when provider capacity stats are unavailable at registration time.
Changes:
- Use user-provided
capacityBytesregardless of whether provider stats are returned. - When provider stats are available, keep an upper-bound sanity check to reject
capacityBytesthat exceed provider capacity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (capacityBytes != null && capacityBytes != 0) { | ||
| if (stats != null && stats.getCapacityInBytes() > 0 && stats.getCapacityInBytes() < capacityBytes) { | ||
| throw new InvalidParameterValueException("Capacity bytes provided exceeds the capacity of the storage endpoint: provided by user: " + capacityBytes + ", storage capacity from storage provider: " + stats.getCapacityInBytes()); | ||
| } | ||
| parameters.setCapacityBytes(capacityBytes); |
| } | ||
| if (capacityBytes != null && capacityBytes != 0) { | ||
| if (stats != null && stats.getCapacityInBytes() > 0 && stats.getCapacityInBytes() < capacityBytes) { | ||
| throw new InvalidParameterValueException("Capacity bytes provided exceeds the capacity of the storage endpoint: provided by user: " + capacityBytes + ", storage capacity from storage provider: " + stats.getCapacityInBytes()); |
Address Copilot feedback on PR apache#13059: - The capacityBytes check now uses > 0 instead of != 0, so a negative value no longer slips through and gets persisted as a storage capacity. - Reworded the exception message for the exceeds-capacity check: Provided capacity bytes exceed ... (grammar). Signed-off-by: Eugenio Grosso <eugenio.grosso@gmail.com>
Description
Registering an adaptive-plugin-backed managed primary pool currently fails with
Capacity bytes not available from the storage provider, user provided capacity bytes must be specifiedeven whencapacityBytes=is actually passed tocreateStoragePool, whenever the provider cannot report capacity at that moment (for example a FlashArray pod with no quota and no footprint yet, or a transient probe failure).Root cause lives in
AdaptiveDataStoreLifeCycleImpl.initialize(): the user-supplied capacity was guarded behindstats != null, so any null stats caused a fall-through to the "no user capacity either" error branch even when the user did provide one.This change accepts the user-supplied value unconditionally and uses the provider stats only as an upper-bound sanity check when they are actually available. The "no user-provided capacity, no provider capacity" branch is preserved and still raises the same
InvalidParameterValueException.Types of changes
Feature/Enhancement Scale or Bug Severity
Major for any deployment that uses the adaptive storage framework against a provider which cannot report capacity synchronously at pool-register time — registration will always fail regardless of what
capacityBytesis passed.How Has This Been Tested?
Validated end-to-end on a 4.23-SNAPSHOT lab:
provider="Flash Array",transport=nvme-tcp) against an empty Purity pod withcapacitybytes=1099511627776andcapacityiops=100000. Before this change, the registration failed with the error above; after this change, the pool enters theUpstate using the user-provided capacity.capacityBytesthat exceeds the provider's capacity.mkfs.ext4+ SHA-256 write/verify, live-migrate between two KVM hosts with the data disk attached — no I/O gap across the migrate).