Project

General

Profile

Actions

Feature #63574

open

support setting quota in the format of {K|M}iB along with the K|M, {K|M}i

Added by Dhairya Parmar 6 months ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Category:
-
Target version:
% Done:

0%

Source:
Q/A
Tags:
Backport:
quincy,reef
Reviewed:
Affected Versions:
Pull request ID:

Description

Currently, from CLI to set quota we are supporting values in the format of "K" or "Ki" but not "KiB". However in dashboard many workflows support "KiB" format including setting quota with "KiB", "MiB", etc formats.

To have consistency and ease of use, requesting to support the format "KiB", "MiB" formats too on setting filesystem quota values.

Steps to Reproduce:
1. Create a filesystem volume from CLI
2. Try setting quota using CLI with quota value in the format of "KiB"
3. Op to set quota fails

$ sudo setfattr -n ceph.quota.max_bytes -v 8MiB /mnt/cephfs_fusea8gos0i24d/jwykxz6loj
setfattr: /mnt/cephfs_fusea8gos0i24d/jwykxz6loj: Invalid argument

$ sudo setfattr -n ceph.quota.max_bytes -v 8Mi /mnt/cephfs_fusea8gos0i24d/jwykxz6loj
$ sudo getfattr -n ceph.quota.max_bytes jwykxz6loj
# file: jwykxz6loj
ceph.quota.max_bytes="8388608" 

Actions #1

Updated by Dhairya Parmar 6 months ago

I had used common code(strtol.cc)'s strict_iec_cast() to enable acceptance of human readable values for max_bytes quota in https://tracker.ceph.com/issues/55940 but it restricts the unit size to 2 i.e. as mentioned in the description {K|M|G}iB isn't allowed, now i'm not sure if we should really be making changes to the common code since it is used across ceph code.

A simple workaround is to pop the last char and check if it's 'B' before calling strict_iec_cast() in the server code. this would be a fs exclusive fix, long term fix would be to enable it in the common code itself(it's pretty straightforward to implement) since other parts of ceph might eventually come up with this requirement.

Actions #2

Updated by Venky Shankar 6 months ago

  • Project changed from CephFS to Ceph
  • Category deleted (Administration/Usability)

Dhairya Parmar wrote:

I had used common code(strtol.cc)'s strict_iec_cast() to enable acceptance of human readable values for max_bytes quota in https://tracker.ceph.com/issues/55940 but it restricts the unit size to 2 i.e. as mentioned in the description {K|M|G}iB isn't allowed, now i'm not sure if we should really be making changes to the common code since it is used across ceph code.

Correct. Other interface via ceph cli exhibit the same property

ceph osd pool set-quota <pool> max_bytes 10MiB
Error EINVAL: error parsing value '10MiB': strict_iecstrtoll: illegal prefix (length > 2)

A simple workaround is to pop the last char and check if it's 'B' before calling strict_iec_cast() in the server code. this would be a fs exclusive fix, long term fix would be to enable it in the common code itself(it's pretty straightforward to implement) since other parts of ceph might eventually come up with this requirement.

Changing component to "ceph" since its more of a generic change.

Makes sense?

Actions #3

Updated by Dhairya Parmar 6 months ago

Venky Shankar wrote:

Dhairya Parmar wrote:

I had used common code(strtol.cc)'s strict_iec_cast() to enable acceptance of human readable values for max_bytes quota in https://tracker.ceph.com/issues/55940 but it restricts the unit size to 2 i.e. as mentioned in the description {K|M|G}iB isn't allowed, now i'm not sure if we should really be making changes to the common code since it is used across ceph code.

Correct. Other interface via ceph cli exhibit the same property

[...]

A simple workaround is to pop the last char and check if it's 'B' before calling strict_iec_cast() in the server code. this would be a fs exclusive fix, long term fix would be to enable it in the common code itself(it's pretty straightforward to implement) since other parts of ceph might eventually come up with this requirement.

Changing component to "ceph" since its more of a generic change.

+1

Makes sense?

yup

Actions #4

Updated by Venky Shankar 5 months ago

  • Target version set to v19.0.0
  • Backport set to quincy,reef
Actions #5

Updated by Dhairya Parmar 5 months ago

  • Subject changed from mds: support setting max_bytes quota in the format of {K|M}iB along with the K|M, {K|M}i to support setting max_bytes quota in the format of {K|M}iB along with the K|M, {K|M}i
Actions #6

Updated by Dhairya Parmar 5 months ago

  • Subject changed from support setting max_bytes quota in the format of {K|M}iB along with the K|M, {K|M}i to support setting quota in the format of {K|M}iB along with the K|M, {K|M}i
Actions

Also available in: Atom PDF