ajayydv commented on a change in pull request #547: HDDS-594. SCM CA: DN sends 
CSR and uses certificate issued by SCM.
URL: https://github.com/apache/hadoop/pull/547#discussion_r262751813
 
 

 ##########
 File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/HddsDatanodeService.java
 ##########
 @@ -252,38 +250,37 @@ public void 
initializeCertificateClient(OzoneConfiguration config)
 
   /**
    * Get SCM signed certificate and store it using certificate client.
+   * @param client
+   * @param config
    * */
   private void getSCMSignedCert(CertificateClient client,
       OzoneConfiguration config) throws IOException {
+    PKCS10CertificationRequest csr = getCSR(client, config);
+    SCMSecurityProtocol secureScmClient =
+        HddsUtils.getScmSecurityClient(config,
+            HddsUtils.getScmAddressForSecurityProtocol(config));
 
-    for (EndpointStateMachine ep : datanodeStateMachine.getConnectionManager()
-        .getValues()) {
-      PKCS10CertificationRequest csr = getCSR(client, config, ep.getVersion());
-      SCMSecurityProtocol secureScmClient =
-          HddsUtils.getScmSecurityClient(config, ep.getAddress());
+    String pemEncodedCert = secureScmClient.getDataNodeCertificate(
+        datanodeDetails.getProtoBufMessage(), getEncodedString(csr));
 
-      String pemEncodedCert = secureScmClient.getDataNodeCertificate(
-          datanodeDetails.getProtoBufMessage(), getEncodedString(csr));
-
-      try {
-        X509Certificate x509Certificate =
-            CertificateCodec.getX509Certificate(pemEncodedCert);
-        client.storeCertificate(x509Certificate);
-      } catch (IOException | CertificateException e) {
-        LOG.error("Error while storing SCM signed certificate.", e);
-        throw new RuntimeException(e);
 
 Review comment:
   I think IPC layer already has logic to retry for socket timeout related 
errors. If it fails there (unrecoverable), then its best to shutdown DN.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to