-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add a very basic NFS server implementation #87
base: master
Are you sure you want to change the base?
Conversation
Are we sure this should be part of DiscUtils? It might be a good candidate for a seperate project though, f.ex. DiscUtils.Servers.NFS (if it's to be part of DU). |
I'm not sure, and don't really have a strong opinion on it 😄. NFS and iSCSI are two 'network-based' file systems which are part of DiscUtils and I guess you can argue whether they should be in scope at all. I'm fine with splitting the server part off to a separate project. If we do move to a separate library, some additional classes inside DiscUtils.Nfs would need to be made public. I'm going to keep pushing to this branch for now as I complete the server work; let's continue the discussion. |
Ok - so the API stuff, like protocol messages and potentially even a client, without a doubt should go into the NFS package. An actual server is another thing entirely .. I would still think it needs to go in another package, like DiscUtils.NFS.Server (and at that point, it should be something you instantiate in a consuming program, with options n stuff). As for public classes. In some cases they should be public (else others wouldn't be able to make their own NFS servers), while others probably can go by with being shared in an InternalsVisibleTo-style thing. |
- NFS3 Mount Server - PortMap Server
…n BadFileHandle when handles are not resolved.
I did some more work on the NFS server implementation:
As to testing, I used the Some of the operations I tested are:
I tested with both the Facebook nfusr library as well as normal Linux mount. (nfusr has more verbose debug output, doesn't required sudo permissions and is easier to restart). Long story short, things starting to look good 😄 . |
Great :) What's lacking? |
This PR adds a very basic NFS server implementation to DiscUtils. It's intended as a foundation for anyone who wants to build a NFS server in managed code, not as a product you'd use on its own.
The NFS server implementation is split in two classes:
Nfs3Server
implements the RPC part. It reads calls from the client, parses them and invokes a corresponding method. It then returns the result to the client. If you want to write your own NFS server based on DiscUtils, you'd inherit from this class and override the various methods.Nfs3FileServer
is a basic implementation ofNfs3Server
which uses the file system as a backend. It allows you to expose any directory as a file share. It's POC code and doesn't include any error handling or authentication, though.There are also unit tests for the server and client implementation. But, rather than communicating over TCP, the
IRpcTransport
interface is mocked and implemented using aQueue
ofbyte[]
objects. That speeds up the unit tests and removes networking from the equation.