Open johanfleury opened 1 month ago
Hi, thank you for bug report. It is definitely a bug. The idea was to have the same limitation as big clouds have. And 1Gi usually enough. I do not think that proxmox has minimal size limitation (i did not check)
Thanks.
It was not clear in my message, but I tested adding a 100MB disk to a VM from the UI and it worked well. I don’t think there’s a minimum size requirement and the API allows you to set size in bytes.
@johanfleury @sergelogvinov I think i has something to do with this line
which indicates that the size is rounded off to the nearest GB.
I've run test and get rounded size 100Mi -> 1Gi, so util.RoundUpSize
works as expected.
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
storageClassName: proxmox-xfs
volumeMode: Filesystem
volumeName: pvc-14edca40-2d3c-4cb8-bd05-6db5b18350b2
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
phase: Bound
Yep you can resize disk thought UI. Proxmox 7.4 has 1Gb minimum chunk, Proxmox 8.2 has 1Gb minimum chunk too.
Round size is only for "to have the same limitations as well-known cloud have". I do not think that Proxmox has minimum size limit (only lvm, zfs, etc). And 1Gi minimum size doesn't required extra checks of file system backend.
Is it rounded to 1 Gibibyte or 1 Gigabyte?
Is it rounded to 1 Gibibyte or 1 Gigabyte?
it should be Gibibytes (power of two)
// RoundUpSize calculates how many allocation units are needed to accommodate
// a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS
// allocates volumes in gibibyte-sized chunks,
// RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2'
// (2 GiB is the smallest allocatable volume that can hold 1500MiB)
func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64 {
roundedUp := volumeSizeBytes / allocationUnitBytes
if volumeSizeBytes%allocationUnitBytes > 0 {
roundedUp++
}
return roundedUp
}
Bug Report
Description
When creating a PV with
spec.resources.requests.storage
lower than 1GiB, a volume of 1GiB is created.My understanding is that calls to
RoundUpSize
inCreateVolume
andExpandVolume
are forcing disk size to be a 1GiB multiple (i.e. 100Mi → 1Gi, 1.5Gi → 2Gi): https://github.com/sergelogvinov/proxmox-csi-plugin/blob/76c899e4e1c8f2287854a4e08fbbdd8a1c7360a9/pkg/csi/controller.go#L126 https://github.com/sergelogvinov/proxmox-csi-plugin/blob/76c899e4e1c8f2287854a4e08fbbdd8a1c7360a9/pkg/csi/controller.go#L126I tested on my cluster (PVE 8.2) and creating a disk of 100Mi is working well, so I feel like this rounding up is not necessary.
Logs
Controller:
Node: not relevant
Environment