irods / irods_client_nfsrods

An nfs4j Virtual File System implementation supporting the iRODS Data Grid
BSD 3-Clause "New" or "Revised" License
8 stars 9 forks source link

add configuration to set NFSRODS reported freespace #181

Open Narushima2030 opened 1 year ago

Narushima2030 commented 1 year ago

I want to use a directory mounted with nfsrods on NextCloud

I have set up an external storage service with a directory NextCloud mounted on /data by NFSRODS.

NextCloud can browse directories mounted on NFSRODS and download files An error occurs when creating or uploading a file.

Insufficient space in /irods/www-data/37918, 813 required, 0 available

The same is true for files with a size of 0. Quotas are unlimited.

You can operate similar files with Linux commands without using NextCloud.

Are there any issues or required settings when combining NFSRODS and NextCloud?

korydraughn commented 1 year ago

NextCloud can browse directories mounted on NFSRODS and download files An error occurs when creating or uploading a file.

Insufficient space in /irods/www-data/37918, 813 required, 0 available

The Insufficient space message signals that NextCloud or something in between the applications is querying NFSRODS for the current amount of free space.

NFSRODS always reports 0 for disk size because we can't know how much space is available across the iRODS zone.

Perhaps we should report a large value instead of 0. That achieves the same thing and somewhat makes more sense.

Are there any issues or required settings when combining NFSRODS and NextCloud?

I can't imagine there's anything special you need to do for this. Please let us know what you learn from trying this. We're interested in the good and the bad.

trel commented 1 year ago

NextCloud may need to be more permissive when seeing a '0' from a storage system.


Perhaps we should report a large value instead of 0.

Sending an arbitrarily large value (e.g. 5EB) does not feel responsible... what is 'big'? to whom?

I don't think the NFS protocol allows us to send anything other than an integer. No way to communicate 'trust me', or 'unlimited'...

korydraughn commented 1 year ago

I understand what you mean, but is 0 any better?

Which do you feel is more acceptable, assuming there's no explicit way to signal unlimited space?

Are we requiring all systems that rely on that value to accept 0 and proceed?

Narushima2030 commented 1 year ago

Thank you for your reply.

I figured out what was causing the problem.

Can I use a virtual NFSRODS and change it to that value? If it is possible to return a non-zero value, can you tell me where to change?

korydraughn commented 1 year ago

You can change the value here. https://github.com/irods/irods_client_nfsrods/blob/6f316fc9b3b75440b8a2e5bad515a13dcc2b9f7e/irods-vfs-impl/src/main/java/org/irods/nfsrods/vfs/IRODSVirtualFileSystem.java#L105

Here's the method where FsStat is defined. https://github.com/dCache/nfs4j/blob/1f1f04f33b3e07a2f6a03c4669119d02ef1e2978/core/src/main/java/org/dcache/nfs/vfs/FsStat.java#L37

Let us know how that works out.

trel commented 1 year ago

Are we requiring all systems that rely on that value to accept 0 and proceed?

Currently, yes.

As far as I know, the only alternative is to send an arbitrarily large value... which could be problematic in different ways. At least here, they know immediately, and we can discuss.

Narushima2030 commented 1 year ago

thank you for your reply.

thank you for your help.

korydraughn commented 1 year ago

We could just make this an option in the config file. Then admins can make NFSRODS report whatever they want.

We can even go as far as build a plugin interface that allows java devs to hook into this logic and report info based on whatever they want.

trel commented 1 year ago

A config option would give flexibility...

  1. A named variable, with a default of 0... to be read only on startup...

      "nfs_reported_freespace_in_bytes": 0,

    or

  2. A file (either well-known, sitting beside server_config.json, or location-defined in server_config.json) that has a value in it (could be updated manually / by a third party / script)... How often does NFSRODS read this value? Only on startup? Every N seconds, also defined in a variable in server_config.json?

      "nfs_reported_freespace_file": "freespace.json",

or

  1. A plugin interface (with a fallback to 0) that defines an integer value through an arbitrary function. How often does it run? How often does NFSRODS read this value? Only on startup? Every N seconds, also defined in a variable in server_config.json?
korydraughn commented 1 year ago

Not a fan of (2).

Yes, (1) is only read at startup, as you said.

(3) provides the most flexibility in that devs can choose to return the same values whenever the plugin is invoked, or they dynamically generate the info upon request. I don't think this requires NFSRODS run it in intervals. The plugin is invoked whenever the VFS function is invoked. How the information is obtained is up to the dev.

trel commented 1 year ago

Ah, I see - so when the freespace request comes in, the plugin function executes and returns whatever it was programmed to do. Okay, so... the only configuration required for 3) is to have the administrator define the name of the plugin / where it should be found? And we ship with a default plugin that just returns 0...

      "freespace_plugin_name": "default_always_zero",
korydraughn commented 1 year ago

Correct.