Arik Hadas has uploaded a new change for review. Change subject: core: print the correct previous destination host ......................................................................
core: print the correct previous destination host The previous destination host was shown as "UNKNOWN" in the audit log for retrying to migrate VM. Now the name of the host that was the destination of the previous attempt is shown. Change-Id: If0d1f90a5c895a349cc9e9f964fdb9a840c49545 Bug-Url: https://bugzilla.redhat.com/1150642 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java 3 files changed, 27 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/34268/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java index 09aa5dc..e572c23 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java @@ -352,11 +352,6 @@ return false; } - if (getDestinationVds() != null && getDestinationVds().getStatus() != VDSStatus.Up) { - addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP); - return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); - } - return validate(new SnapshotsValidator().vmNotDuringSnapshot(vm.getId())) // This check was added to prevent migration of VM while its disks are being migrated // TODO: replace it with a better solution @@ -384,7 +379,6 @@ // if vm is up and rerun is called then it got up on the source, try to rerun if (getVm() != null && getVm().getStatus() == VMStatus.Up) { - setDestinationVdsId(null); super.rerun(); } else { // vm went down on the destination and source, migration failed. @@ -395,6 +389,12 @@ } } + @Override + protected void reexecuteCommand() { + setDestinationVdsId(null); + super.reexecuteCommand(); + } + /** * Log that the migration had failed with the error code that is in the VDS and needs to be retrieved. */ diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java index 7001f42..b8c360d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java @@ -11,6 +11,7 @@ import org.ovirt.engine.core.common.action.LockProperties.Scope; import org.ovirt.engine.core.common.action.MigrateVmToServerParameters; import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.compat.Guid; @@ -39,6 +40,11 @@ return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID); } + if (getDestinationVds().getStatus() != VDSStatus.Up) { + addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP); + return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); + } + if (!super.canDoAction()) { return false; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java index 67b584d..964ace2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java @@ -108,17 +108,7 @@ */ if (getRunVdssList().size() < Config.<Integer> getValue(ConfigValues.MaxRerunVmOnVdsCount) && getVm().getStatus() != VMStatus.Paused) { - // restore CanDoAction value to false so CanDoAction checks will run again - getReturnValue().setCanDoAction(false); - if (getExecutionContext() != null) { - Job job = getExecutionContext().getJob(); - if (job != null) { - // mark previous steps as fail - JobRepositoryFactory.getJobRepository().closeCompletedJobSteps(job.getId(), JobExecutionStatus.FAILED); - } - } - insertAsyncTaskPlaceHolders(); - executeAction(); + reexecuteCommand(); // if there was no rerun attempt in the previous executeAction call and the command // wasn't done because canDoAction check returned false.. @@ -133,6 +123,20 @@ } } + protected void reexecuteCommand() { + // restore CanDoAction value to false so CanDoAction checks will run again + getReturnValue().setCanDoAction(false); + if (getExecutionContext() != null) { + Job job = getExecutionContext().getJob(); + if (job != null) { + // mark previous steps as fail + JobRepositoryFactory.getJobRepository().closeCompletedJobSteps(job.getId(), JobExecutionStatus.FAILED); + } + } + insertAsyncTaskPlaceHolders(); + executeAction(); + } + protected void runningFailed() { try { decreasePendingVms(); -- To view, visit http://gerrit.ovirt.org/34268 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If0d1f90a5c895a349cc9e9f964fdb9a840c49545 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches