Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephfs: Fix cephfs PVC sizing #4180

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Conversation

karthik-us
Copy link
Collaborator

Issue:
The RoundOffCephFSVolSize() function omits the fractional part when calculating the size for cephfs volumes, leading to the created volume capacity to be lesser than the requested volume capacity.

Fix:
Consider the fractional part during the size calculation so the rounded off volume size will be greater than or equal to the requested volume size.

Fixes: #4179

@mergify mergify bot added the component/cephfs Issues related to CephFS label Oct 10, 2023
Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change looks good.

Would it make sense to add an e2e test with a value that caused the failure?

@@ -67,9 +67,9 @@ func RoundOffCephFSVolSize(bytes int64) int64 {
return 4 * helpers.MiB
}

bytes /= helpers.MiB
floatbytes := float64(bytes) / helpers.MiB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bytesInFloat sounds better? as @nixpanic suggested please add a E2E test for this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@karthik-us
Copy link
Collaborator Author

/test ci/centos/mini-e2e/k8s-1.28

e2e/cephfs.go Outdated
@@ -2426,6 +2427,35 @@ var _ = Describe(cephfsType, func() {
validateOmapCount(f, 0, cephfsType, metadataPool, volumesType)
})

By("Test 500MB PVC creation and check for PV and PVC binding", func() {
size := "500M"
err := createCephfsStorageClass(f.ClientSet, f, true, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be skipped, SC is already created here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@karthik-us
Copy link
Collaborator Author

/test ci/centos/mini-e2e/k8s-1.28

@nixpanic
Copy link
Member

@Mergifyio rebase

Issue:
The RoundOffCephFSVolSize() function omits the fractional
part when calculating the size for cephfs volumes, leading
to the created volume capacity to be lesser than the requested
volume capacity.

Fix:
Consider the fractional part during the size calculation so the
rounded off volume size will be greater than or equal to the
requested volume size.

Signed-off-by: karthik-us <[email protected]>
Fixes: ceph#4179
Adding e2e test to check for successful PVC creation
of 500MB.

Signed-off-by: karthik-us <[email protected]>
@mergify
Copy link
Contributor

mergify bot commented Oct 12, 2023

rebase

✅ Branch has been successfully rebased

@nixpanic
Copy link
Member

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Oct 12, 2023

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 5ff0607

@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Oct 12, 2023
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.28

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Oct 12, 2023
@nixpanic
Copy link
Member

/test ci/centos/mini-e2e-helm/k8s-1.28

@nixpanic
Copy link
Member

/test ci/centos/mini-e2e-helm/k8s-1.28

This CI job seemed to be missing. Started it again to get a status report and have this PR merged.

@mergify mergify bot merged commit 5ff0607 into ceph:devel Oct 12, 2023
34 checks passed
@karthik-us karthik-us deleted the cephfs-pvc-sizing branch October 16, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cephfs Issues related to CephFS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CephFS PVC creation fails provision for few sizes
5 participants