ovh / svfs

The Swift Virtual File System
Other
375 stars 54 forks source link

Handle quotas when reporting filesystem size for vanilla swift endpoints #117

Open sekurilabs opened 7 years ago

sekurilabs commented 7 years ago

Context

Steps to reproduce this issue :

  1. Add account quota in openstack swift
  2. Check mounted filesystem with df -h

Results you expected :

Expected to have mount of the size of the account quota as described in the code (fs.go - Statfs function)

Results you observed :

Maximum size reported all the time.

Additional information :

Need an information why account quota is not working on the mount and how to fix it or correctly mount it.

Thanks

sekurilabs commented 7 years ago

Any help with this? Seems like svfs is not recognizing account quotas at all. Tested OS's were ubuntu 14.04 and 16.04.

xlucas commented 7 years ago

Hello,

As for now svfs only recognize account quotas once used with hubic.

For vanilla swift endpoints, it doesn't handle quotas yet, it is something that can be added in a further release, that's why the reported device size is set to the maximum underlying value.

This can be added to a future release for sure, but it also requires checking containers quotas if any.

sekurilabs commented 7 years ago

Thanks for the answer. Is there any workaround to limit filesystem size?

Thanks!

xlucas commented 7 years ago

None AFAIK but if you've set account quotas then obviously even if df doesn't display the actual filesystem size limit, trying to upload data beyond the account quota will fail.

sekurilabs commented 7 years ago

Yeah, I know that. For me it's important that the size of the filesystem is the same as quota as it needs to be represented that way to a client.

Thank you for the help.

sekurilabs commented 7 years ago

Sorry, one more question: How do I build svfs from source? It seems there is no documentation on how to build it.

Thanks!

xlucas commented 7 years ago

As a regular golang project : go get github.com/ovh/svfs.

sekurilabs commented 7 years ago

Thanks again. Please do consider enabling the quota feature (either based on container or account quota) in future releases. It would be really helpful to have this feature, especially in some production cases.

Thank you!

sekurilabs commented 7 years ago

Hello,

Any news on this feature? I have been trying to change /svfs/fs.go and /vendor/github.com/xlucas/swift/swift.go but no luck.

In swift.go I have changed info.Quota, = getInt64FromHeader(resp, "X-Account-Meta-Quota") to info.Quota, = getInt64FromHeader(resp, "X-Account-Meta-Quota-Bytes"), which is the correct metadata information, and in fs.go I have changed Statfs reporting to if container is "" and account.quota > 0 then calculate filesystem size using the account quota information. So far I had no luck, it always reports as 8EB in size.