[
https://issues.apache.org/jira/browse/HDFS-6546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097325#comment-14097325
]
Colin Patrick McCabe commented on HDFS-6546:
--------------------------------------------
{code}
/**
+ * Returns an EncryptionZoneWithId representing the ez root for a given path.
+ * Returns null if the path is not in an ez.
+ *
+ * \@param iip The INodesInPath of the path to check
+ * \@return the EncryptionZoneWithId representing the ez root for the path.
+ */
+ EncryptionZoneWithId getEZRootINodeForPath(INodesInPath iip) {
+ final EncryptionZoneInt ezi = getEncryptionZoneForPath(iip);
+ if (ezi == null) {
+ return new EncryptionZoneWithId("", "", -1);
+ } else {
+ return new EncryptionZoneWithId(getFullPathName(ezi), ezi.getKeyName(),
+ ezi.getINodeId());
+ }
+ }
{code}
The comment says it returns null, but it seems to be returning an empty object
instead. I guess either update the comment or make it really return null. I
can see how returning an empty object might be more convenient for PB
purposes... if you want to go down that route, perhaps make this a named final
constant? On the other hand null is more consistent with other getEZRoot
methods. Your call.
Also, should we call this RPC getEzForPath? It's returning an EncryptionZone
object, not an "EZ root inode" (do users know what that is?)
+1 once those comments are addressed.
> Add non-superuser capability to get the encryption zone for a specific path
> ---------------------------------------------------------------------------
>
> Key: HDFS-6546
> URL: https://issues.apache.org/jira/browse/HDFS-6546
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: namenode, security
> Affects Versions: fs-encryption (HADOOP-10150 and HDFS-6134)
> Reporter: Charles Lamb
> Assignee: Charles Lamb
> Attachments: HDFS-6546.001.patch, HDFS-6546.002.patch
>
>
> Need to add protocol, api, and CLI that allows a non super user to ask
> whether a path is part of an EZ, and if so, which one.
--
This message was sent by Atlassian JIRA
(v6.2#6252)