GutoVeronezi commented on a change in pull request #5988:
URL: https://github.com/apache/cloudstack/pull/5988#discussion_r806070306



##########
File path: 
server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
##########
@@ -273,8 +273,11 @@ private void setupAgentSecurity(final Connection 
sshConnection, final String age
             }
 
             if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "ls /dev/kvm")) {
-                s_logger.debug("It's not a KVM enabled machine");
-                return null;
+                String errorMsg = "It's not a KVM enabled machine";

Review comment:
       ```suggestion
                   String errorMsg = "This machine does not have KVM enabled.";
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -807,9 +807,16 @@ public Discoverer getMatchingDiscover(final 
Hypervisor.HypervisorType hypervisor
             try {
                 resources = discoverer.find(dcId, podId, clusterId, uri, 
username, password, hostTags);
             } catch (final DiscoveryException e) {
-                throw e;
+                String errorMsg = "Unable to add the host: " + e.getMessage();

Review comment:
       ```suggestion
                   String errorMsg = String.format("Could not add host at [%s] 
with zone [%s], pod [%s] and cluster [%s] due to [%s].", uri, dcId, podId, 
clusterId, e.getMessage());
   ```

##########
File path: 
server/src/main/java/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
##########
@@ -335,9 +338,9 @@ private void setupAgentSecurity(final Connection 
sshConnection, final String age
                 setupAgentCommand = "sudo cloudstack-setup-agent ";
             }
             if (!SSHCmdHelper.sshExecuteCmd(sshConnection, setupAgentCommand + 
parameters)) {
-                s_logger.info("cloudstack agent setup command failed: "
-                        + setupAgentCommand + parameters);
-                return null;
+                String errorMsg = "cloudstack agent setup command failed: " + 
setupAgentCommand + parameters;

Review comment:
       ```suggestion
                   String errorMsg = String.format("CloudStack Agent setup 
through command [%s] with parameters [%s] failed.", setupAgentCommand, 
parameters);
   ```

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -807,9 +807,16 @@ public Discoverer getMatchingDiscover(final 
Hypervisor.HypervisorType hypervisor
             try {
                 resources = discoverer.find(dcId, podId, clusterId, uri, 
username, password, hostTags);
             } catch (final DiscoveryException e) {
-                throw e;
+                String errorMsg = "Unable to add the host: " + e.getMessage();
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug(errorMsg, e);
+                }
+                throw new DiscoveryException(errorMsg, e);
             } catch (final Exception e) {
                 s_logger.info("Exception in host discovery process with 
discoverer: " + discoverer.getName() + ", skip to another discoverer if there 
is any");
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Exception in host discovery process with 
discoverer: " + discoverer.getName() + ":" + e.getMessage(), e);

Review comment:
       We could extract these messages to a variable.




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


Reply via email to