You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/11/04 17:03:01 UTC

[GitHub] [hadoop-ozone] xiaoyuyao commented on a change in pull request #110: HDDS-2321. Ozone Block Token verify should not apply to all datanode …

xiaoyuyao commented on a change in pull request #110: HDDS-2321. Ozone Block Token verify should not apply to all datanode …
URL: https://github.com/apache/hadoop-ozone/pull/110#discussion_r342161925
 
 

 ##########
 File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
 ##########
 @@ -390,6 +391,52 @@ public static boolean isReadOnly(
     }
   }
 
+  /**
+   * Not all datanode container cmd protocol has embedded ozone block token.
+   * Block token are issued by Ozone Manager and return to Ozone client to
+   * read/write data on datanode via input/output stream.
+   * Ozone datanode uses this helper to decide which command requires block
+   * token.
+   * @param cmdType
+   * @return true if it is a cmd that block token should be checked when
+   * security is enabled
+   * false if block token does not apply to the command.
+   *
+   */
+  public static boolean requireOmBlockToken(
+      ContainerProtos.Type cmdType) {
+    switch (cmdType) {
+    case ReadChunk:
+    case GetBlock:
+    case WriteChunk:
+    case PutBlock:
+      return true;
+    default:
+      return false;
+    }
+  }
+
+  /**
+   * Return the block ID of container commands that are related to blocks.
+   * @param msg container command
+   * @return block ID.
+   */
+  public static BlockID getBlockID(ContainerProtos.ContainerCommandRequestProto msg) {
+    switch (msg.getCmdType()) {
+    case ReadChunk:
 
 Review comment:
   Good point. Fixed. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org