Arik Hadas has uploaded a new change for review.

Change subject: core: improve exception handling on run vm
......................................................................

core: improve exception handling on run vm

In case an exception is thrown when calling the 'create' verb in VDSM
and there is no point to retry to run the VM on other host, we used to
just re-throw the exception in RunVmCommand to prevent the rerun
mechanism from taking place.

The problem is that this way the pending resources were not cleared
in this flow. The solution is to improve the error handling:
1. If Done/exists exception was thrown, we call the reportCompleted to
decrease the pending resources
2. If VDS_NETWORK_ERROR/PROVIDER_FAILURE exception was thrown, we call
the runningFailed to decrease the pending resources (in this case, the
VM should be treated as if it went down, we should remove its
stateless snapshot if such snapshot exists for example).

Change-Id: Iee3bdb65ca58c49de65770d4e9cf9435bbbe5070
Bug-Url: https://bugzilla.redhat.com/1174817
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/36245/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 6f4ab51..3b8ba02 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -231,15 +231,16 @@
                     ExecutionHandler.setAsyncJob(getExecutionContext(), true);
                 }
             } catch(VdcBLLException e) {
-                VdcBllErrors errorCode = e.getErrorCode();
-
                 // if the returned exception is such that shoudn't trigger the 
re-run process,
                 // re-throw it. otherwise, continue (the vm will be down and a 
re-run will be triggered)
-                switch (errorCode) {
+                switch (e.getErrorCode()) {
                 case Done: // should never get here with errorCode = 'Done' 
though
                 case exist:
+                    reportCompleted();
+                    throw e;
                 case VDS_NETWORK_ERROR: // probably wrong xml format sent.
                 case PROVIDER_FAILURE:
+                    runningFailed();
                     throw e;
                 default:
                     log.warnFormat("Failed to run VM {0}: {1}", getVmName(), 
e.getMessage());


-- 
To view, visit http://gerrit.ovirt.org/36245
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee3bdb65ca58c49de65770d4e9cf9435bbbe5070
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to