Commit 2f5e76f8 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

sessions: introduce server id provider interface

server scope and owners should be configurable and bound to file filesystem and/or dataserver
parent 8f39592a
......@@ -30,6 +30,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import org.dcache.chimera.nfs.vfs.Inode;
import org.dcache.chimera.nfs.NfsUser;
import org.dcache.chimera.nfs.v4.xdr.server_owner4;
import org.dcache.chimera.nfs.v4.xdr.uint64_t;
import org.dcache.chimera.nfs.vfs.VirtualFileSystem;
......@@ -251,4 +253,27 @@ public class CompoundContext {
assert _curretOpPosition < _totalOperationsCount;
_curretOpPosition ++;
}
public ServerIdProvider getServerIdProvider() {
// FIXME: bond to file system and DS
return new ServerIdProvider() {
@Override
public server_owner4 getOwner() {
server_owner4 owner = new server_owner4();
owner.so_minor_id = new uint64_t(0);
owner.so_major_id = _callInfo.
getTransport().
getLocalSocketAddress().
getAddress().
getAddress();
return owner;
}
@Override
public byte[] getScope() {
return "".getBytes();
}
};
}
}
......@@ -246,10 +246,9 @@ public class OperationEXCHANGE_ID extends AbstractNFSv4Operation {
res.eir_resok4.eir_sequenceid = new sequenceid4( new uint32_t(client.currentSeqID() ));
res.eir_resok4.eir_flags = new uint32_t(_flag);
res.eir_resok4.eir_server_owner = new server_owner4();
res.eir_resok4.eir_server_owner.so_minor_id = new uint64_t(17);
res.eir_resok4.eir_server_owner.so_major_id = "Chimera".getBytes();
res.eir_resok4.eir_server_scope = "Chimera".getBytes();
ServerIdProvider serverIdProvider = context.getServerIdProvider();
res.eir_resok4.eir_server_owner = serverIdProvider.getOwner();
res.eir_resok4.eir_server_scope = serverIdProvider.getScope();
res.eir_resok4.eir_server_impl_id = new nfs_impl_id4[1];
res.eir_resok4.eir_server_impl_id[0] = new nfs_impl_id4();
......
/*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Library General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
* details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program (see the file COPYING.LIB for more details); if not,
* write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
* 02139, USA.
*/
package org.dcache.chimera.nfs.v4;
import org.dcache.chimera.nfs.v4.xdr.server_owner4;
/**
* Interface to provide server unique information used
* during EXCHANGE_ID operation.
*
* The server scope allows a group of servers to indicate to clients that a set
* of servers sharing the same server scope value has arranged to use compatible
* values of otherwise opaque identifiers. Thus, the identifiers generated by
* one server of that set may be presented to another of that same scope.
*
* See rfc5661 section 2.10.4 for details.
*/
public interface ServerIdProvider {
server_owner4 getOwner();
byte[] getScope();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment