xBis7 commented on PR #3835:
URL: https://github.com/apache/ozone/pull/3835#issuecomment-1282286052

   @kerneltime Let me explain in more details the purpose of this PR. The issue 
is that you can either have `ip` or `hostname` and use only one of them to get 
the datanode info.
   
   from master the default behavior
   
   ```
   bash-4.2$ ozone admin datanode usageinfo --ip=172.21.0.5
   Usage Information (1 Datanodes)
   
   UUID         : 08c48611-7121-46a5-a047-129f573c78a6 
   IP Address   : 172.21.0.5 (ozone_datanode_1.ozone_default) 
   Capacity     : 182775984128 B (170.22 GB) 
   Total Used   : 168680075264 B (157.10 GB) 
   Total Used % : 92.29% 
   Ozone Used   : 4096 B (4 KB) 
   Ozone Used % : 0.00% 
   Remaining    : 14095908864 B (13.13 GB) 
   Remaining %  : 7.71% 
   
   bash-4.2$ ozone admin datanode usageinfo --ip=ozone_datanode_1.ozone_default
   Usage Information (0 Datanodes)
   ```
   
   from master with `dfs.datanode.use.datanode.hostname=true`
   ```
   bash-4.2$ ozone admin datanode usageinfo --ip=172.19.0.5
   Usage Information (0 Datanodes)
   
   bash-4.2$ ozone admin datanode usageinfo --ip=d416d3fec041
   Usage Information (1 Datanodes)
   
   UUID         : 809c1065-2594-4208-bc57-4442b71022e2 
   IP Address   : 172.19.0.5 (d416d3fec041) 
   Capacity     : 182775984128 B (170.22 GB) 
   Total Used   : 168679792640 B (157.10 GB) 
   Total Used % : 92.29% 
   Ozone Used   : 4096 B (4 KB) 
   Ozone Used % : 0.00% 
   Remaining    : 14096191488 B (13.13 GB) 
   Remaining %  : 7.71% 
   ```
   
   We want to have a `--hostname` parameter and also we want the CLI to be more 
consistent, meaning that the `--ip` accepts only ip and the new `--hostname` 
accepts only hostname. If we just add the `--hostname` parameter then in the 
above second case we will have `--hostname` that accepts hostname and `--ip` 
that also accepts only hostname. 
   
   As pointed out to me, we can't deprecate the flag or change the current 
logic in `SCMNodeManager` because it's necessary for environments like 
Kubernetes where the datanode can restart and end up with a new Ip address. 
That's why I creating specific APIs for the CLI.
   
   The current code achieves the desired behavior.
   
   from this branch with `dfs.datanode.use.datanode.hostname=true`
   ```
   bash-4.2$ ozone admin datanode usageinfo --ip=172.22.0.5
   Usage Information (1 Datanodes)
   
   UUID         : 961511cf-38ec-412c-b805-381549ce03cf 
   IP Address   : 172.22.0.5 
   Hostname     : 16cbb539ec92 
   Capacity     : 182775984128 B (170.22 GB) 
   Total Used   : 168680542208 B (157.10 GB) 
   Total Used % : 92.29% 
   Ozone Used   : 4096 B (4 KB) 
   Ozone Used % : 0.00% 
   Remaining    : 14095441920 B (13.13 GB) 
   Remaining %  : 7.71% 
   
   bash-4.2$ ozone admin datanode usageinfo --ip=16cbb539ec92
   Usage Information (0 Datanodes)
   
   bash-4.2$ ozone admin datanode usageinfo --hostname=16cbb539ec92
   Usage Information (1 Datanodes)
   
   UUID         : 961511cf-38ec-412c-b805-381549ce03cf 
   IP Address   : 172.22.0.5 
   Hostname     : 16cbb539ec92 
   Capacity     : 182775984128 B (170.22 GB) 
   Total Used   : 169011408896 B (157.40 GB) 
   Total Used % : 92.47% 
   Ozone Used   : 4096 B (4 KB) 
   Ozone Used % : 0.00% 
   Remaining    : 13764575232 B (12.82 GB) 
   Remaining %  : 7.53% 
   ```
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to