Examples of ExportedBlockKeys


Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

   * @param blockPoolId
   * @throws IOException
   */
  private synchronized void registerBlockPoolWithSecretManager(
      DatanodeRegistration bpRegistration, String blockPoolId) throws IOException {
    ExportedBlockKeys keys = bpRegistration.getExportedKeys();
    if (!hasAnyBlockPoolRegistered) {
      hasAnyBlockPoolRegistered = true;
      isBlockTokenEnabled = keys.isBlockTokenEnabled();
    } else {
      if (isBlockTokenEnabled != keys.isBlockTokenEnabled()) {
        throw new RuntimeException("Inconsistent configuration of block access"
            + " tokens. Either all block pools must be configured to use block"
            + " tokens, or none may be.");
      }
    }
    // TODO should we check that all federated nns are either enabled or
    // disabled?
    if (!isBlockTokenEnabled) return;
   
    if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
      long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
      long blockTokenLifetime = keys.getTokenLifetime();
      LOG.info("Block token params received from NN: for block pool " +
          blockPoolId + " keyUpdateInterval="
          + blockKeyUpdateInterval / (60 * 1000)
          + " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
          + " min(s)");
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

    this.exportedKeys = keys;
    this.softwareVersion = softwareVersion;
  }

  public DatanodeRegistration(String ipAddr, int xferPort) {
    this(ipAddr, xferPort, new StorageInfo(), new ExportedBlockKeys());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

    this.fs = FileSystem.get(nameNodeUri, conf);

    final NamespaceInfo namespaceinfo = namenode.versionRequest();
    this.blockpoolID = namespaceinfo.getBlockPoolID();

    final ExportedBlockKeys keys = namenode.getBlockKeys();
    this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
    if (isBlockTokenEnabled) {
      long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
      long blockTokenLifetime = keys.getTokenLifetime();
      LOG.info("Block token params received from NN: keyUpdateInterval="
          + blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime="
          + blockTokenLifetime / (60 * 1000) + " min(s)");
      this.blockTokenSecretManager = new BlockTokenSecretManager(
          blockKeyUpdateInterval, blockTokenLifetime);
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

  }

  @Test
  public void testConvertExportedBlockKeys() {
    BlockKey[] keys = new BlockKey[] { getBlockKey(2), getBlockKey(3) };
    ExportedBlockKeys expKeys = new ExportedBlockKeys(true, 9, 10,
        getBlockKey(1), keys);
    ExportedBlockKeysProto expKeysProto = PBHelper.convert(expKeys);
    ExportedBlockKeys expKeys1 = PBHelper.convert(expKeysProto);
    compare(expKeys, expKeys1);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

 
  @Test
  public void testConvertDatanodeRegistration() {
    DatanodeID dnId = new DatanodeID("host", "host", "xyz", 0, 1, 0);
    BlockKey[] keys = new BlockKey[] { getBlockKey(2), getBlockKey(3) };
    ExportedBlockKeys expKeys = new ExportedBlockKeys(true, 9, 10,
        getBlockKey(1), keys);
    DatanodeRegistration reg = new DatanodeRegistration(dnId,
        new StorageInfo(), expKeys, "3.0.0");
    DatanodeRegistrationProto proto = PBHelper.convert(reg);
    DatanodeRegistration reg2 = PBHelper.convert(proto);
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

    }
    return builder.build();
  }

  public static ExportedBlockKeys convert(ExportedBlockKeysProto keys) {
    return new ExportedBlockKeys(keys.getIsBlockTokenEnabled(),
        keys.getKeyUpdateInterval(), keys.getTokenLifeTime(),
        convert(keys.getCurrentKey()), convertBlockKeys(keys.getAllKeysList()));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

  }

  @Override
  public GetBlockKeysResponseProto getBlockKeys(RpcController unused,
      GetBlockKeysRequestProto request) throws ServiceException {
    ExportedBlockKeys keys;
    try {
      keys = impl.getBlockKeys();
    } catch (IOException e) {
      throw new ServiceException(e);
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

   * @param blockPoolId
   * @throws IOException
   */
  private void registerBlockPoolWithSecretManager(DatanodeRegistration bpRegistration,
      String blockPoolId) throws IOException {
    ExportedBlockKeys keys = bpRegistration.exportedKeys;
    isBlockTokenEnabled = keys.isBlockTokenEnabled();
    // TODO should we check that all federated nns are either enabled or
    // disabled?
    if (!isBlockTokenEnabled) return;
   
    if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
      long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
      long blockTokenLifetime = keys.getTokenLifetime();
      LOG.info("Block token params received from NN: for block pool " +
          blockPoolId + " keyUpdateInterval="
          + blockKeyUpdateInterval / (60 * 1000)
          + " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
          + " min(s)");
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

          + ". Expecting " + storage.getStorageID());
    }
   
    if (!isBlockTokenInitialized) {
      /* first time registering with NN */
      ExportedBlockKeys keys = dnRegistration.exportedKeys;
      this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
      if (isBlockTokenEnabled) {
        long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
        long blockTokenLifetime = keys.getTokenLifetime();
        LOG.info("Block token params received from NN: keyUpdateInterval="
            + blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime="
            + blockTokenLifetime / (60 * 1000) + " min(s)");
        blockTokenSecretManager.setTokenLifetime(blockTokenLifetime);
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys

   * @param blockPoolId
   * @throws IOException
   */
  private void registerBlockPoolWithSecretManager(DatanodeRegistration bpRegistration,
      String blockPoolId) throws IOException {
    ExportedBlockKeys keys = bpRegistration.exportedKeys;
    isBlockTokenEnabled = keys.isBlockTokenEnabled();
    // TODO should we check that all federated nns are either enabled or
    // disabled?
    if (!isBlockTokenEnabled) return;
   
    if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
      long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
      long blockTokenLifetime = keys.getTokenLifetime();
      LOG.info("Block token params received from NN: for block pool " +
          blockPoolId + " keyUpdateInterval="
          + blockKeyUpdateInterval / (60 * 1000)
          + " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
          + " min(s)");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.