Gilad Chaplik has uploaded a new change for review. Change subject: core: remove vdsSelector CheckDestinationFirst (8/15) ......................................................................
core: remove vdsSelector CheckDestinationFirst (8/15) it's always true ... Change-Id: I5f9ce4357a85727f1a2016a46c0ce8f00621fd4b Signed-off-by: Gilad Chaplik <[email protected]> --- 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/RunVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolCommandBase.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java M backend/manager/modules/sla/src/main/java/org/ovirt/engine/core/sla/VdsSelector.java 5 files changed, 7 insertions(+), 26 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/13210/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 e6007a9..7b256bf 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 @@ -40,7 +40,7 @@ public MigrateVmCommand(T parameters) { super(parameters); - setVdsSelector(new VdsSelector(getVm(), getVdsDestinationId(), true, new VdsFreeMemoryChecker(this))); + setVdsSelector(new VdsSelector(getVm(), getVdsDestinationId(), new VdsFreeMemoryChecker(this))); forcedMigrationForNonMigratableVM = parameters.isForceMigrationForNonMigratableVM(); } 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 4b6f21b..22c5592 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 @@ -138,7 +138,7 @@ if (getVm() != null) { Guid destVdsId = (getDestinationVds() != null) ? (Guid) getDestinationVds().getId() : null; - setVdsSelector(new VdsSelector(getVm(), destVdsId, true, new VdsFreeMemoryChecker(this))); + setVdsSelector(new VdsSelector(getVm(), destVdsId, new VdsFreeMemoryChecker(this))); refreshBootParameters(runVmParameters); getVm().setLastStartTime(new Date()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolCommandBase.java index 0f80520..09b1b46 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolCommandBase.java @@ -265,7 +265,6 @@ new VdsSelector(vm, runVmParams.getDestinationVdsId() != null ? runVmParams.getDestinationVdsId() : vm.getDedicatedVmForVds(), - true, new VdsFreeMemoryChecker(new NonWaitingDelayer())); // TODO: temporary until this logic will be extracted. diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java index cf1bc60..02aac34 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RunVmCommandTest.java @@ -350,7 +350,7 @@ initDAOMocks(Collections.<Disk> emptyList(), Collections.<VmDevice> emptyList()); final VM vm = mockVm(); - doReturn(new VdsSelector(vm, new Guid(), true, new VdsFreeMemoryChecker(command))).when(command) + doReturn(new VdsSelector(vm, new Guid(), new VdsFreeMemoryChecker(command))).when(command) .getVdsSelector(); assertFalse(command.canDoAction()); @@ -368,7 +368,7 @@ vm.setStatus(VMStatus.Up); vm.setStoragePoolId(Guid.NewGuid()); - doReturn(new VdsSelector(vm, new NGuid(), true, new VdsFreeMemoryChecker(command))).when(command) + doReturn(new VdsSelector(vm, new NGuid(), new VdsFreeMemoryChecker(command))).when(command) .getVdsSelector(); assertFalse(command.canDoAction()); diff --git a/backend/manager/modules/sla/src/main/java/org/ovirt/engine/core/sla/VdsSelector.java b/backend/manager/modules/sla/src/main/java/org/ovirt/engine/core/sla/VdsSelector.java index 1c30d3d..57dd23e 100644 --- a/backend/manager/modules/sla/src/main/java/org/ovirt/engine/core/sla/VdsSelector.java +++ b/backend/manager/modules/sla/src/main/java/org/ovirt/engine/core/sla/VdsSelector.java @@ -35,16 +35,6 @@ return privateRunVdssList; } - private boolean privateCheckDestinationFirst; - - public boolean getCheckDestinationFirst() { - return privateCheckDestinationFirst; - } - - public void setCheckDestinationFirst(boolean value) { - privateCheckDestinationFirst = value; - } - private NGuid privateDestinationVdsId; public NGuid getDestinationVdsId() { @@ -66,26 +56,18 @@ privateVm = value; } - public VdsSelector(VM vm, NGuid destinationVdsId, boolean dedicatedFirst, VdsFreeMemoryChecker memoryChecker) { + public VdsSelector(VM vm, NGuid destinationVdsId, VdsFreeMemoryChecker memoryChecker) { setVm(vm); setDestinationVdsId(destinationVdsId); - setCheckDestinationFirst(dedicatedFirst); this.memoryChecker = memoryChecker; } public Guid getVdsToRunOn(boolean isMigrate) { Guid result = Guid.Empty; if (getDestinationVdsId() != null) { - if (getCheckDestinationFirst()) { - result = getVdsRunOnDestination(isMigrate); - if (result.equals(Guid.Empty) && privateVm.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) { - result = getAnyVdsToRunOn(isMigrate); - } - } else { + result = getVdsRunOnDestination(isMigrate); + if (result.equals(Guid.Empty) && privateVm.getMigrationSupport() != MigrationSupport.PINNED_TO_HOST) { result = getAnyVdsToRunOn(isMigrate); - if (result.equals(Guid.Empty)) { - result = getVdsRunOnDestination(isMigrate); - } } } else { result = getAnyVdsToRunOn(isMigrate); -- To view, visit http://gerrit.ovirt.org/13210 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5f9ce4357a85727f1a2016a46c0ce8f00621fd4b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
