Roy Golan has uploaded a new change for review. Change subject: core: Cancel incoming migration when host is preparing for maintenance ......................................................................
core: Cancel incoming migration when host is preparing for maintenance Host going to Maintenance can have ongoing incoming migration before it changes its status to Preparing for maintenance. This host will migrate all its VMs except those incoming, which are not he's still. This will result the host staying in PreparingForMaint till manual intervention. The solution has 3 parts: 1. cancel all incoming migrations 2. make cancel migration command trigger a rerun of the migration automatically 3. detect if host is idle long time in PreparingForMaint and migrate VMs out This patch handles closure 1 and 2. Change-Id: I9d354a4f38c3f44c524b225a8a9650b8067d5432 Signed-off-by: Roy Golan <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/19727/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java index 64b4bcd..07ac831 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java @@ -31,6 +31,7 @@ import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; +import org.ovirt.engine.core.vdsbroker.vdsbroker.CancelMigrationVDSParameters; @InternalCommandAttribute @NonTransactiveCommandAttribute @@ -63,9 +64,18 @@ for (VDS vds : spms) { setVdsStatusToPrepareForMaintaice(vds); } + cancelIncommingMigrations(); freeLock(); } + private void cancelIncommingMigrations() { + for (Guid hostId :vdssToMaintenance.keySet()) { + for (VM vm : getVmDAO().getAllMigratingToHost(hostId)) { + runVdsCommand(VDSCommandType.CancelMigrate, new CancelMigrationVDSParameters(vm.getRunOnVds(), vm.getId(), true)); + } + } + } + private void setVdsStatusToPrepareForMaintaice(VDS vds) { if (vds.getStatus() != VDSStatus.PreparingForMaintenance && vds.getStatus() != VDSStatus.NonResponsive && vds.getStatus() != VDSStatus.Down) { -- To view, visit http://gerrit.ovirt.org/19727 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d354a4f38c3f44c524b225a8a9650b8067d5432 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
