CLOUDSTACK-7940: Exception printed completely on the UI. Not in a readable format.
(cherry picked from commit dda29949366f16c06445dde9161c3b1151ed3f36) Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8790b84b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8790b84b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8790b84b Branch: refs/heads/4.5 Commit: 8790b84b20dcf347459b5a69cb338a2f65af1414 Parents: 6715c6c Author: Sanjay Tripathi <[email protected]> Authored: Wed Nov 19 15:57:13 2014 +0530 Committer: Rohit Yadav <[email protected]> Committed: Tue Jan 20 11:34:48 2015 +0530 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 2 +- .../cloudstack/engine/orchestration/VolumeOrchestrator.java | 2 +- .../hypervisor/xenserver/resource/CitrixResourceBase.java | 7 +++---- .../storage/motion/XenServerStorageMotionStrategy.java | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8790b84b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index b992ed9..0051cff 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1919,7 +1919,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac Answer ma = _agentMgr.send(vm.getLastHostId(), mc); if (ma == null || !ma.getResult()) { String details = (ma != null) ? ma.getDetails() : "null answer returned"; - throw new CloudRuntimeException("Unable to migrate due to " + details); + throw new CloudRuntimeException(details); } } catch (OperationTimedoutException e) { if (e.isActive()) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8790b84b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 0895e84..fd4883b 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -988,7 +988,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati CommandResult result = future.get(); if (result.isFailed()) { s_logger.debug("Failed to migrated vm " + vm + " along with its volumes. " + result.getResult()); - throw new CloudRuntimeException("Failed to migrated vm " + vm + " along with its volumes. " + result.getResult()); + throw new CloudRuntimeException("Failed to migrated vm " + vm + " along with its volumes. "); } } catch (InterruptedException e) { s_logger.debug("Failed to migrated vm " + vm + " along with its volumes.", e); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8790b84b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index b4e5cbc..ee4e3d5 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -2956,9 +2956,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } return new MigrateAnswer(cmd, true, "migration succeeded", null); } catch (Exception e) { - String msg = "Catch Exception " + e.getClass().getName() + ": Migration failed due to " + e.toString(); - s_logger.warn(msg, e); - return new MigrateAnswer(cmd, false, msg, null); + s_logger.warn(e.getMessage(), e); + return new MigrateAnswer(cmd, false, e.getMessage(), null); } } @@ -3363,7 +3362,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new CloudRuntimeException("migrate VM catch HandleInvalid and VM is not running on dest host"); } } catch (XenAPIException e) { - String msg = "Unable to migrate VM(" + vmName + ") from host(" + _host.uuid + ") due to " + e.toString(); + String msg = "Unable to migrate VM(" + vmName + ") from host(" + _host.uuid + ")"; s_logger.warn(msg, e); throw new CloudRuntimeException(msg); } finally { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8790b84b/plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java b/plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java index 975deec..c8367dd 100644 --- a/plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java +++ b/plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java @@ -154,7 +154,7 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy { throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else if (!receiveAnswer.getResult()) { s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + receiveAnswer.getDetails()); - throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + receiveAnswer.getDetails()); + throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } MigrateWithStorageSendCommand sendCmd = @@ -165,7 +165,7 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy { throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else if (!sendAnswer.getResult()) { s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + sendAnswer.getDetails()); - throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + sendAnswer.getDetails()); + throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } MigrateWithStorageCompleteCommand command = new MigrateWithStorageCompleteCommand(to); @@ -175,7 +175,7 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy { throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else if (!answer.getResult()) { s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + answer.getDetails()); - throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + answer.getDetails()); + throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost); } else { // Update the volume details after migration. updateVolumePathsAfterMigration(volumeToPool, answer.getVolumeTos());
