You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/04/16 07:07:18 UTC

[GitHub] DaanHoogland closed pull request #2553: Update inconsistent debugging info in catch block

DaanHoogland closed pull request #2553: Update inconsistent debugging info in catch block
URL: https://github.com/apache/cloudstack/pull/2553
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index fab7d9eef29..02c425553d8 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -254,9 +254,8 @@ public void create() {
                 setEntityUuid(result.getUuid());
             }
         } catch (NetworkRuleConflictException ex) {
-            s_logger.info("Network rule conflict: " + ex.getMessage());
             s_logger.trace("Network Rule Conflict: ", ex);
-            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
         }
     }
 
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index ea0cb00301a..ff11395ee37 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@ -358,9 +358,8 @@ public void create() {
             setEntityId(result.getId());
             setEntityUuid(result.getUuid());
         } catch (NetworkRuleConflictException ex) {
-            s_logger.info("Network rule conflict: ", ex);
             s_logger.trace("Network Rule Conflict: ", ex);
-            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
         }
     }
 
diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java
index 626b8ccf2be..f54db8dcd29 100644
--- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java
@@ -91,7 +91,7 @@ public void deleteRecordsForAccount(Long accountId) {
             txn.commit();
         } catch (Exception ex) {
             txn.rollback();
-            s_logger.error("error retrieving usage vm instances for account id: " + accountId);
+            s_logger.error("error retrieving usage vm instances for account id: " + accountId, ex);
         } finally {
             txn.close();
         }
diff --git a/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java b/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
index 0b0b0839e70..b2f173e27c9 100644
--- a/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
+++ b/plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java
@@ -237,9 +237,9 @@ public void handleDelivery(String queueName, Envelope envelope, AMQP.BasicProper
             s_subscribers.put(queueName, queueDetails);
 
         } catch (AlreadyClosedException closedException) {
-            s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection");
+            s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection", closedException);
         } catch (ConnectException connectException) {
-            s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection");
+            s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection", connectException);
         } catch (Exception e) {
             throw new EventBusException("Failed to subscribe to event due to " + e.getMessage());
         }
diff --git a/plugins/hypervisors/hyperv/src/main/java/com/cloud/ha/HypervInvestigator.java b/plugins/hypervisors/hyperv/src/main/java/com/cloud/ha/HypervInvestigator.java
index 222286f9165..774efc84b3a 100644
--- a/plugins/hypervisors/hyperv/src/main/java/com/cloud/ha/HypervInvestigator.java
+++ b/plugins/hypervisors/hyperv/src/main/java/com/cloud/ha/HypervInvestigator.java
@@ -68,7 +68,7 @@ public Status isAgentAlive(Host agent) {
                     return answer.getResult() ? Status.Down : Status.Up;
                 }
             } catch (Exception e) {
-                s_logger.debug("Failed to send command to host: " + neighbor.getId());
+                s_logger.debug("Failed to send command to host: " + neighbor.getId(), e);
             }
         }
 
diff --git a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmFencer.java b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmFencer.java
index e671a364da6..6a247d91439 100644
--- a/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmFencer.java
+++ b/plugins/hypervisors/ovm/src/main/java/com/cloud/ovm/hypervisor/OvmFencer.java
@@ -94,12 +94,12 @@ public Boolean fenceOff(VirtualMachine vm, Host host) {
                 answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
             } catch (AgentUnavailableException e) {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                 }
                 continue;
             } catch (OperationTimedoutException e) {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                 }
                 continue;
             }
diff --git a/plugins/hypervisors/simulator/src/main/java/com/cloud/ha/SimulatorFencer.java b/plugins/hypervisors/simulator/src/main/java/com/cloud/ha/SimulatorFencer.java
index 86c28715e0b..c776edfde35 100644
--- a/plugins/hypervisors/simulator/src/main/java/com/cloud/ha/SimulatorFencer.java
+++ b/plugins/hypervisors/simulator/src/main/java/com/cloud/ha/SimulatorFencer.java
@@ -90,12 +90,12 @@ public Boolean fenceOff(VirtualMachine vm, Host host) {
                     answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
                 } catch (AgentUnavailableException e) {
                     if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     }
                     continue;
                 } catch (OperationTimedoutException e) {
                     if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     }
                     continue;
                 }
diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/ha/XenServerFencer.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/ha/XenServerFencer.java
index af89a0ada66..72ec375fa27 100644
--- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/ha/XenServerFencer.java
+++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/ha/XenServerFencer.java
@@ -77,12 +77,12 @@ public Boolean fenceOff(VirtualMachine vm, Host host) {
                     answer = (FenceAnswer)ans;
                 } catch (AgentUnavailableException e) {
                     if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     }
                     continue;
                 } catch (OperationTimedoutException e) {
                     if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                        s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     }
                     continue;
                 }
diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 19670b2066e..fed3ff97ca5 100644
--- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -5037,14 +5037,14 @@ public void startVM(final Connection conn, final Host host, final VM vm, final S
                 checkForSuccess(conn, task);
             } catch (final Types.HandleInvalid e) {
                 if (vm.getPowerState(conn) == VmPowerState.RUNNING) {
-                    s_logger.debug("VM " + vmName + " is in Running status");
+                    s_logger.debug("VM " + vmName + " is in Running status", e);
                     task = null;
                     return;
                 }
                 throw new CloudRuntimeException("Start VM " + vmName + " catch HandleInvalid and VM is not in RUNNING state");
             } catch (final TimeoutException e) {
                 if (vm.getPowerState(conn) == VmPowerState.RUNNING) {
-                    s_logger.debug("VM " + vmName + " is in Running status");
+                    s_logger.debug("VM " + vmName + " is in Running status", e);
                     task = null;
                     return;
                 }
diff --git a/server/src/main/java/com/cloud/ha/KVMFencer.java b/server/src/main/java/com/cloud/ha/KVMFencer.java
index 3f06872b56f..e102bc273ac 100644
--- a/server/src/main/java/com/cloud/ha/KVMFencer.java
+++ b/server/src/main/java/com/cloud/ha/KVMFencer.java
@@ -99,10 +99,10 @@ public Boolean fenceOff(VirtualMachine vm, Host host) {
                 try {
                     answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
                 } catch (AgentUnavailableException e) {
-                    s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable");
+                    s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     continue;
                 } catch (OperationTimedoutException e) {
-                    s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable");
+                    s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable", e);
                     continue;
                 }
                 if (answer != null && answer.getResult()) {
diff --git a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
index 197ebed3e69..b970111f9ef 100644
--- a/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ConfigurationServerImpl.java
@@ -715,10 +715,10 @@ private void writeKeyToDisk(String key, String keyPath) {
                     kStream.write(key.getBytes());
                 }
             } catch (FileNotFoundException e) {
-                s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath());
+                s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath(), e);
                 throw new CloudRuntimeException("Failed to update keypairs on disk: cannot find  key file " + keyPath);
             } catch (IOException e) {
-                s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath());
+                s_logger.warn("Failed to write  key to " + keyfile.getAbsolutePath(), e);
                 throw new CloudRuntimeException("Failed to update keypairs on disk: cannot write to  key file " + keyPath);
             }
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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