Fixes issue where volume expansion succeeds (quota is updated via PUT API)
but ControllerExpandVolume returns capacity_bytes: 0 due to a logic condition
evaluation, causing Kubernetes to reject the expansion with "capacity to 0" errors.
Root Cause:
The driver correctly uses PUT API call to update the quota, which succeeds.
However, the return value logic condition evaluates to 0 when:
- datasetEnableQuotas is false/undefined, AND
- driverZfsResourceType is "filesystem" (not "volume")
This happens even though the quota was successfully updated on the TrueNAS side.
API Flow:
1. PUT /pool/dataset/id/{datasetName} - Updates refquota/volsize (returns 200 OK)
2. GET /pool/dataset/id/{datasetName} - Reads back refquota/volsize with rawvalue
Changes:
- Read actual capacity from dataset after expansion using DatasetGet
(queries refquota for filesystems, volsize for volumes)
- Use actual capacity from API response instead of relying on config flag
- Add fallback to requested capacity if actual capacity cannot be retrieved
The driver already uses the correct HTTP method (PUT) - no API changes needed.
This fix ensures we return the actual capacity that was set, not 0.
Fixes #394
|
||
|---|---|---|
| .. | ||
| driver | ||
| utils | ||