Arik Hadas has uploaded a new change for review.

Change subject: engine: Re-run vm on other host if vm creation fail
......................................................................

engine: Re-run vm on other host if vm creation fail

When an error with error code different than 'Done' or 'exists'
is returned from VDSM while trying to run a vm, there would be
an attempt to re-run the vm on other host.

Change-Id: I35569a2ebfbea3e8eb69b414c31748c49cb29841
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=680743
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/9085/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 35a5b09..9f1cccb 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
@@ -201,6 +201,18 @@
                     status = createVm();
                     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) {
+                case Done:
+                case exist:
+                    throw e;
+                default:
+                }
+
             } finally {
                 freeLock();
                 decrementVdsPendingVmsCount();
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
index 7705811..9e3a418 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
@@ -166,6 +166,7 @@
                         command.getVDSReturnValue().getExceptionString());
                 getVDSReturnValue().setReturnValue(VMStatus.Down);
                 getVDSReturnValue().setSucceeded(false);
+                
getVDSReturnValue().setExceptionString(command.getVDSReturnValue().getExceptionString());
                 
getVDSReturnValue().setVdsError(command.getVDSReturnValue().getVdsError());
             } else {
                 throw command.getVDSReturnValue().getExceptionObject();


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35569a2ebfbea3e8eb69b414c31748c49cb29841
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to