Greg Padgett has uploaded a new change for review.

Change subject: core: don't fail Live Merge if VM is in Unknown state
......................................................................

core: don't fail Live Merge if VM is in Unknown state

VMs in Unknown state cannot be queried for whether Live Merge completed
successfully.  Wait until the VM is in a determinate state to check the
merge status.

Change-Id: I58913a598703cbecbcb7508cd2a68533a6c7475e
Bug-Url: https://bugzilla.redhat.com/??????
Signed-off-by: Greg Padgett <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MergeStatusCommand.java
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/29799/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MergeStatusCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MergeStatusCommand.java
index 03c3e0e..6946ffc 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MergeStatusCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MergeStatusCommand.java
@@ -8,6 +8,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 import org.ovirt.engine.core.bll.utils.PermissionSubject;
 import org.ovirt.engine.core.common.VdcObjectType;
@@ -15,6 +16,8 @@
 import org.ovirt.engine.core.common.action.MergeStatusReturnValue;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.businessentities.VmBlockJobType;
 import org.ovirt.engine.core.common.vdscommands.FullListVDSCommandParameters;
 import org.ovirt.engine.core.compat.CommandStatus;
@@ -44,7 +47,17 @@
         // Our contract with vdsm merge states that if the VM is found down, we
         // have to assume the merge failed.  (It's okay if it really succeeded,
         // we can retry the operation without any issues.)
-        if (getVmDAO().get(getParameters().getVmId()).isDown()) {
+        VM vm = getVmDAO().get(getParameters().getVmId());
+        while (vm.getStatus() == VMStatus.Unknown) {
+            log.info("VM is in Unknown status; waiting to resume command");
+            try {
+                TimeUnit.SECONDS.sleep(10);
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+            }
+            vm = getVmDAO().get(getParameters().getVmId());
+        }
+        if (vm.isDown()) {
             log.error("Failed to live merge, VM is not running");
             setCommandStatus(CommandStatus.FAILED);
             return;


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

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

Reply via email to