cephfs quota set #826
-
In go-ceph branch master, I have not see a function to set quota limit for director . Please give me a example to |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
It's not clear to me what you are asking for. I don't know what director is. The "PS" indicates you want to set a quota for cephfs. This is more helpful. What would be most helpful is if you could link to documentation explaining what you are trying to do. So for example if there's a ceph command line tool that does what you want, link to docs showing the use of the tool and then we can backtrack from the tool to what APIs may be needed. Thank you. |
Beta Was this translation helpful? Give feedback.
-
My most pressing need is this ,i want to set a quota limit on a directory. the flow is that I create dir by mount.MakeDir which is in /go-ceph/cephfs/path.go, then i search the ceph doc for info :
I try to use the function in /go-ceph/cephfs/file_xattr.go
and function in /cephfs/path_xattr.go
The problem is that I do not know the function is right to do it (PS: set a quota limit which get from https://docs.ceph.com/en/quincy/cephfs/quota/?highlight=setfattr%20-n%20ceph.quota.max_bytes%20-v%20100000000#configuration),if it is right ,how can I construct a param to fill It . |
Beta Was this translation helpful? Give feedback.
-
So, the setfattr tool will end up calling linux syscalls like setxattr & lsetxattr. As you've determined the cephfs api calls are similarly named. The tool's path := "/your/path/here"
name := "ceph.quota.max_bytes"
value := []byte("10000")
err := mount.LsetXattr(path, name, value, XattrDefault)
// ...handle errors... You can also pass flags if you need them, but generally the default (0) is fine. Lines 24 to 33 in 312e4cf If this approach doesn't work please let us know and share any errors that you get. |
Beta Was this translation helpful? Give feedback.
So, the setfattr tool will end up calling linux syscalls like setxattr & lsetxattr. As you've determined the cephfs api calls are similarly named. The tool's
-n
option corresponds to the name argument. The tool's-v
argument corresponds to the value argument. Since no special arguments are being passed for the value or encoding, you simply want to convert the value (100000000, 10000) directly as a string, and convert that to a byte slice. Roughly, that'd be:
You can also pass flags if you need them, but generally the default (0) …