Skip to content

Commit 8790b84

Browse files
sanjaytripathiyadvr
authored andcommitted
CLOUDSTACK-7940: Exception printed completely on the UI. Not in a readable format.
(cherry picked from commit dda2994) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 6715c6c commit 8790b84

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,7 @@ protected void migrate(VMInstanceVO vm, long srcHostId, DeployDestination dest)
19191919
Answer ma = _agentMgr.send(vm.getLastHostId(), mc);
19201920
if (ma == null || !ma.getResult()) {
19211921
String details = (ma != null) ? ma.getDetails() : "null answer returned";
1922-
throw new CloudRuntimeException("Unable to migrate due to " + details);
1922+
throw new CloudRuntimeException(details);
19231923
}
19241924
} catch (OperationTimedoutException e) {
19251925
if (e.isActive()) {

‎engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ public void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHos
988988
CommandResult result = future.get();
989989
if (result.isFailed()) {
990990
s_logger.debug("Failed to migrated vm " + vm + " along with its volumes. " + result.getResult());
991-
throw new CloudRuntimeException("Failed to migrated vm " + vm + " along with its volumes. " + result.getResult());
991+
throw new CloudRuntimeException("Failed to migrated vm " + vm + " along with its volumes. ");
992992
}
993993
} catch (InterruptedException e) {
994994
s_logger.debug("Failed to migrated vm " + vm + " along with its volumes.", e);

‎plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,9 +2956,8 @@ protected MigrateAnswer execute(final MigrateCommand cmd) {
29562956
}
29572957
return new MigrateAnswer(cmd, true, "migration succeeded", null);
29582958
} catch (Exception e) {
2959-
String msg = "Catch Exception " + e.getClass().getName() + ": Migration failed due to " + e.toString();
2960-
s_logger.warn(msg, e);
2961-
return new MigrateAnswer(cmd, false, msg, null);
2959+
s_logger.warn(e.getMessage(), e);
2960+
return new MigrateAnswer(cmd, false, e.getMessage(), null);
29622961
}
29632962

29642963
}
@@ -3363,7 +3362,7 @@ private void migrateVM(Connection conn, Host destHost, VM vm, String vmName) thr
33633362
throw new CloudRuntimeException("migrate VM catch HandleInvalid and VM is not running on dest host");
33643363
}
33653364
} catch (XenAPIException e) {
3366-
String msg = "Unable to migrate VM(" + vmName + ") from host(" + _host.uuid + ") due to " + e.toString();
3365+
String msg = "Unable to migrate VM(" + vmName + ") from host(" + _host.uuid + ")";
33673366
s_logger.warn(msg, e);
33683367
throw new CloudRuntimeException(msg);
33693368
} finally {

‎plugins/hypervisors/xenserver/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private Answer migrateVmWithVolumesAcrossCluster(VMInstanceVO vm, VirtualMachine
154154
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
155155
} else if (!receiveAnswer.getResult()) {
156156
s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + receiveAnswer.getDetails());
157-
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + receiveAnswer.getDetails());
157+
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
158158
}
159159

160160
MigrateWithStorageSendCommand sendCmd =
@@ -165,7 +165,7 @@ private Answer migrateVmWithVolumesAcrossCluster(VMInstanceVO vm, VirtualMachine
165165
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
166166
} else if (!sendAnswer.getResult()) {
167167
s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + sendAnswer.getDetails());
168-
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + sendAnswer.getDetails());
168+
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
169169
}
170170

171171
MigrateWithStorageCompleteCommand command = new MigrateWithStorageCompleteCommand(to);
@@ -175,7 +175,7 @@ private Answer migrateVmWithVolumesAcrossCluster(VMInstanceVO vm, VirtualMachine
175175
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
176176
} else if (!answer.getResult()) {
177177
s_logger.error("Migration with storage of vm " + vm + " failed. Details: " + answer.getDetails());
178-
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost + ". " + answer.getDetails());
178+
throw new CloudRuntimeException("Error while migrating the vm " + vm + " to host " + destHost);
179179
} else {
180180
// Update the volume details after migration.
181181
updateVolumePathsAfterMigration(volumeToPool, answer.getVolumeTos());

0 commit comments

Comments
 (0)