Roy Golan has uploaded a new change for review. Change subject: core: Change Vm status on destroy only for SRC VMs ......................................................................
core: Change Vm status on destroy only for SRC VMs when stopping a migrating VMs, do the state change only if the VM is really running on SRC host. StopVm shoots 2 destroy commands incase the vm is migrating - 1 for the DST and one for the SRC. after the DST is destroy the Vm must not be DOWN, otherwise an interleaving RunVm could start it while we're about to shoot the next stop. that solution is reverting change I6109ef0ea4869b59a93be6fef4b0c3cff50da62e which implemented that with an engine lock Change-Id: I422e75fc863e3416261a4d3eaef4312dc933bdac Bug-url: https://bugzilla.redhat.com/1064859 Signed-off-by: Roy Golan <rgo...@redhat.com> --- M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java 1 file changed, 11 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/25568/1 diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java index 0cae20d..2ac0b6d 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java @@ -1,6 +1,7 @@ package org.ovirt.engine.core.vdsbroker; import java.util.List; +import java.util.Objects; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; @@ -38,9 +39,7 @@ getVDSReturnValue().setReturnValue(VMStatus.Down); } - // Updating the DB - ResourceManager.getInstance().InternalSetVmStatus(curVm, - parameters.getGracefully() ? VMStatus.PoweringDown : VMStatus.Down); + changeStatus(parameters, curVm); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override @@ -91,6 +90,15 @@ } } + private void changeStatus(DestroyVmVDSCommandParameters parameters, VM curVm) { + // do the state transition only if that VM is really running on SRC + if (curVm.getRunOnVds() != null || curVm.getStatus() != VMStatus.MigratingTo) { + // Updating the DB + ResourceManager.getInstance().InternalSetVmStatus(curVm, + parameters.getGracefully() ? VMStatus.PoweringDown : VMStatus.Down); + } + } + /** * signal the event listener that this VM is down. Because we don't care for failures, to prevent a side effect of * aborting the current TX this method is being invoked in a new TX of its own. -- To view, visit http://gerrit.ovirt.org/25568 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I422e75fc863e3416261a4d3eaef4312dc933bdac Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <rgo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches