[ 
https://issues.apache.org/jira/browse/HDFS-13972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16819576#comment-16819576
 ] 

CR Hota commented on HDFS-13972:
--------------------------------

[~elgoiri] Thanks for the comment.

In terms of testing just this feature, since its not an input/output param, the 
only way I tried locally is by refactoring and adding a simple check for method 
name. But to prevent erroneous usage of this by developers for other methods 
may be tricky. 

Is there anything specific you have in mind?

 
{code:java}
  private void setSuperUser(String method) throws IOException {
    if ("getDatanodeReport".equals(method)) {
      UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
      RouterRpcServer.setCurrentUser(loginUser);
    }
  }

  private DatanodeInfo chooseDatanode(final Router router,
      final String path, final HttpOpParam.Op op, final long openOffset,
      final String excludeDatanodes) throws IOException {
    // We need to get the DNs as a privileged user
    final RouterRpcServer rpcServer = getRPCServer(router);
    setSuperUser("getDatanodeReport");
    DatanodeInfo[] dns = null;
    try {
      dns = rpcServer.getDatanodeReport(DatanodeReportType.LIVE);
    } catch (IOException e) {
      LOG.error("Cannot get the datanodes from the RPC server", e);
    } finally {
      // Reset ugi to remote user for remaining operations.
      RouterRpcServer.resetCurrentUser();
    }

{code}
 

> RBF: Support for Delegation Token (WebHDFS)
> -------------------------------------------
>
>                 Key: HDFS-13972
>                 URL: https://issues.apache.org/jira/browse/HDFS-13972
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: CR Hota
>            Priority: Major
>         Attachments: HDFS-13972-HDFS-13891.001.patch, 
> HDFS-13972-HDFS-13891.002.patch, HDFS-13972-HDFS-13891.003.patch, 
> HDFS-13972-HDFS-13891.004.patch, HDFS-13972-HDFS-13891.005.patch, 
> HDFS-13972-HDFS-13891.006.patch, HDFS-13972-HDFS-13891.007.patch, 
> HDFS-13972-HDFS-13891.008.patch, HDFS-13972-HDFS-13891.009.patch, 
> HDFS-13972-HDFS-13891.010.patch, HDFS-13972-HDFS-13891.011.patch, 
> HDFS-13972-HDFS-13891.012.patch, HDFS-13972-HDFS-13891.013.patch, 
> TestRouterWebHDFSContractTokens.java
>
>
> HDFS Router should support issuing HDFS delegation tokens through WebHDFS.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to