propagate job execution runtime exception to API context
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/86a63c49 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/86a63c49 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/86a63c49 Branch: refs/heads/master Commit: 86a63c49bc459fe390d05b801e526a69590e89e9 Parents: 206a9ed Author: Kelven Yang <kelv...@gmail.com> Authored: Mon Jan 27 14:46:12 2014 -0800 Committer: Kelven Yang <kelv...@gmail.com> Committed: Fri Feb 28 15:35:57 2014 -0800 ---------------------------------------------------------------------- .../com/cloud/vm/VirtualMachineManagerImpl.java | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86a63c49/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 1dae94d..fb5d0f1 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -783,6 +783,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof ResourceUnavailableException) throw (ResourceUnavailableException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -1333,6 +1337,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof OperationTimedoutException) throw (OperationTimedoutException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -1638,6 +1646,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (jobResult != null) { if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -1734,6 +1744,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); + } } } @@ -2015,6 +2028,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ResourceUnavailableException)jobException; else if (jobException instanceof ConcurrentOperationException) throw (ConcurrentOperationException)jobException; + else if (jobException instanceof RuntimeException) + throw (RuntimeException)jobException; + else if (jobException instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobException); } } } @@ -2312,6 +2329,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof InsufficientCapacityException) throw (InsufficientCapacityException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } } @@ -3252,6 +3273,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (InsufficientCapacityException)jobException; else if (jobException instanceof RuntimeException) throw (RuntimeException)jobException; + else if (jobException instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobException); else if (jobException instanceof Long) return requested; } @@ -3363,6 +3386,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ConcurrentOperationException)jobResult; else if (jobResult instanceof RuntimeException) throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); else if (jobResult instanceof Boolean) return (Boolean)jobResult; } @@ -3610,6 +3635,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac throw (ResourceUnavailableException)jobResult; else if (jobResult instanceof ConcurrentOperationException) throw (ConcurrentOperationException)jobResult; + else if (jobResult instanceof RuntimeException) + throw (RuntimeException)jobResult; + else if (jobResult instanceof Throwable) + throw new RuntimeException("Unexpected exception", (Throwable)jobResult); } } }