From dda29949366f16c06445dde9161c3b1151ed3f36 Mon Sep 17 00:00:00 2001 From: Sanjay Tripathi Date: Wed, 19 Nov 2014 15:57:13 +0530 Subject: [PATCH] CLOUDSTACK-7940: Exception printed completely on the UI. Not in a readable format. --- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 2 +- .../engine/orchestration/VolumeOrchestrator.java | 2 +- .../hypervisor/xenserver/resource/CitrixResourceBase.java | 7 +++---- .../storage/motion/XenServerStorageMotionStrategy.java | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index c9322e4e8ca..dc6ad3fe370 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1924,7 +1924,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()) { 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 f474fe335d6..63d967b90af 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -968,7 +968,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); 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 aa115b13e5a..b275fb4129b 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 @@ -2953,9 +2953,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); } } @@ -3360,7 +3359,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 { 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 975deec531f..c8367dd3ac1 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());