Exemplo n.º 1
0
  public void init() throws Exception {

    _cellName = getCellName();
    _domainName = getCellDomainName();

    _rpcService = new OncRpcSvcBuilder().withPort(_port).withTCP().withAutoPublish().build();
    if (_enableRpcsecGss) {
      _rpcService.setGssSessionManager(new GssSessionManager(_idMapper));
    }

    _vfs = new VfsCache(new ChimeraVfs(_fileFileSystemProvider, _idMapper), _vfsCacheConfig);

    MountServer ms = new MountServer(_exportFile, _vfs);
    _rpcService.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V3), ms);
    _rpcService.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V3), ms);

    for (String version : _versions) {
      switch (version) {
        case V3:
          NfsServerV3 nfs3 = new NfsServerV3(_exportFile, _vfs);
          _rpcService.register(new OncRpcProgram(nfs3_prot.NFS_PROGRAM, nfs3_prot.NFS_V3), nfs3);
          break;
        case V41:
          final NFSv41DeviceManager _dm = this;
          _proxyIoFactory =
              new DcapProxyIoFactory(getCellAddress().getCellName() + "-dcap-proxy", "");
          _proxyIoFactory.setBillingStub(_billingStub);
          _proxyIoFactory.setFileSystemProvider(_fileFileSystemProvider);
          _proxyIoFactory.setPnfsHandler(_pnfsHandler);
          _proxyIoFactory.setPoolManager(_poolManagerStub.getDestinationPath());
          _proxyIoFactory.setIoQueue(_ioQueue);
          _proxyIoFactory.setRetryPolicy(RETRY_POLICY);
          _proxyIoFactory.startAdapter();
          _nfs4 =
              new NFSServerV41(
                  new ProxyIoMdsOpFactory(_proxyIoFactory, new MDSOperationFactory()),
                  _dm,
                  _vfs,
                  _idMapper,
                  _exportFile);
          _rpcService.register(new OncRpcProgram(nfs4_prot.NFS4_PROGRAM, nfs4_prot.NFS_V4), _nfs4);
          _loginBrokerHandler.start();
          break;
        default:
          throw new IllegalArgumentException("Unsupported NFS version: " + version);
      }
    }

    _rpcService.start();
  }