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

[cloudstack] branch master updated: Update inconsistent debugging info in catch block (#2553)

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 106a9a3  Update inconsistent debugging info in catch block (#2553)
106a9a3 is described below

commit 106a9a34e12843a76cd67d9ab13837f56d79785a
Author: lzh3636 <li...@outlook.com>
AuthorDate: Mon Apr 16 03:07:16 2018 -0400

    Update inconsistent debugging info in catch block (#2553)
    
    * Add stack traces information
    
    * update stack trace info
    
    * update stack trace to make them consistent
    
    * update stack traces
    
    * update stacktraces
    
    * update stacktraces for other similar situations
    
    * fix some other situations
    
    * enhance other situations
---
 .../cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java   | 3 +--
 .../api/command/user/firewall/CreatePortForwardingRuleCmd.java        | 3 +--
 engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java     | 2 +-
 .../java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java     | 4 ++--
 .../hyperv/src/main/java/com/cloud/ha/HypervInvestigator.java         | 2 +-
 .../ovm/src/main/java/com/cloud/ovm/hypervisor/OvmFencer.java         | 4 ++--
 .../simulator/src/main/java/com/cloud/ha/SimulatorFencer.java         | 4 ++--
 .../xenserver/src/main/java/com/cloud/ha/XenServerFencer.java         | 4 ++--
 .../com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java   | 4 ++--
 server/src/main/java/com/cloud/ha/KVMFencer.java                      | 4 ++--
 server/src/main/java/com/cloud/server/ConfigurationServerImpl.java    | 4 ++--
 11 files changed, 18 insertions(+), 20 deletions(-)

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 fab7d9e..02c4255 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 class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
                 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 ea0cb00..ff11395 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 class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
             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 626b8cc..f54db8d 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 class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
             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 0b0b083..b2f173e 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 class RabbitMQEventBus extends ManagerBase implements EventBus {
             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 222286f..774efc8 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 class HypervInvestigator extends AdapterBase implements Investigator {
                     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 e671a36..6a247d9 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 class OvmFencer extends AdapterBase implements FenceBuilder {
                 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 86c2871..c776edf 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 class SimulatorFencer extends AdapterBase implements FenceBuilder {
                     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 af89a0a..72ec375 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 class XenServerFencer extends AdapterBase implements FenceBuilder {
                     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 4a9001b..7124659 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
@@ -5028,14 +5028,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 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 3f06872..e102bc2 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 class KVMFencer extends AdapterBase implements FenceBuilder {
                 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 197ebed..b970111 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 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     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);
             }
         }

-- 
To stop receiving notification emails like this one, please contact
dahn@apache.org.