Allon Mureinik has uploaded a new change for review.

Change subject: core: LSM - standardize version checks in CDA
......................................................................

core: LSM - standardize version checks in CDA

Removed the canDoAction check that relies on the LiveMigrationEnabled
config value and used the standard action_version_map instead.

The config value was not removed entirely, but was left in order to be
able to grey out relevant parts in the UI.

Change-Id: I3527c79ee77bc60c9ff7ca5030f3cd5f2ee28f39
Signed-off-by: Allon Mureinik <[email protected]>
---
A backend/manager/dbscripts/upgrade/03_02_0470_lsm_version_support.sql
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommandTest.java
3 files changed, 5 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/12375/1

diff --git 
a/backend/manager/dbscripts/upgrade/03_02_0470_lsm_version_support.sql 
b/backend/manager/dbscripts/upgrade/03_02_0470_lsm_version_support.sql
new file mode 100644
index 0000000..f858b12
--- /dev/null
+++ b/backend/manager/dbscripts/upgrade/03_02_0470_lsm_version_support.sql
@@ -0,0 +1,2 @@
+insert into action_version_map values (1010, '3.2', '3.2');
+insert into action_version_map values (1011, '3.2', '3.2');
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
index 66f42b2..676ff5b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommand.java
@@ -27,10 +27,8 @@
 import org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo;
 import org.ovirt.engine.core.common.businessentities.ActionGroup;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
-import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.StorageDomain;
-import org.ovirt.engine.core.common.config.Config;
-import org.ovirt.engine.core.common.config.ConfigValues;
+import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.utils.Pair;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.VdcBllMessages;
@@ -186,8 +184,7 @@
 
     @Override
     protected boolean canDoAction() {
-        if (!isValidParametersList() || !isLiveMigrationEnabled() || 
!checkImagesStatus()
-                || !isValidSpaceRequirements()) {
+        if (!isValidParametersList() || !checkImagesStatus() || 
!isValidSpaceRequirements()) {
             return false;
         }
 
@@ -215,16 +212,6 @@
 
     protected boolean checkImagesStatus() {
         return ImagesHandler.checkImagesLocked(getVmId(), 
getReturnValue().getCanDoActionMessages());
-    }
-
-    private boolean isLiveMigrationEnabled() {
-        if (!Config.<Boolean> GetValue(
-                ConfigValues.LiveStorageMigrationEnabled,
-                getStoragePool().getcompatibility_version().toString())) {
-            return 
failCanDoAction(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_POOL_LEVEL);
-        }
-
-        return true;
     }
 
     private boolean isDiskNotShareable(Guid imageId) {
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommandTest.java
index fe92cf9..7f1f0e0 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/lsm/LiveMigrateVmDisksCommandTest.java
@@ -6,7 +6,6 @@
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
-import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -14,7 +13,6 @@
 import java.util.List;
 
 import org.junit.Before;
-import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -22,13 +20,12 @@
 import org.ovirt.engine.core.common.action.LiveMigrateDiskParameters;
 import org.ovirt.engine.core.common.action.LiveMigrateVmDisksParameters;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
+import org.ovirt.engine.core.common.businessentities.StorageDomain;
 import org.ovirt.engine.core.common.businessentities.StorageDomainStatus;
 import org.ovirt.engine.core.common.businessentities.StorageDomainType;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
-import org.ovirt.engine.core.common.businessentities.StorageDomain;
 import org.ovirt.engine.core.common.businessentities.storage_pool;
-import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.compat.NGuid;
 import org.ovirt.engine.core.compat.Version;
@@ -37,7 +34,6 @@
 import org.ovirt.engine.core.dao.StorageDomainDAO;
 import org.ovirt.engine.core.dao.StoragePoolDAO;
 import org.ovirt.engine.core.dao.VmDAO;
-import org.ovirt.engine.core.utils.MockConfigRule;
 
 @RunWith(MockitoJUnitRunner.class)
 public class LiveMigrateVmDisksCommandTest {
@@ -61,11 +57,6 @@
 
     @Mock
     private VmDAO vmDao;
-
-    @ClassRule
-    public static MockConfigRule mcr = new MockConfigRule(
-            mockConfig(ConfigValues.LiveStorageMigrationEnabled, 
Version.v3_1.toString(), true)
-            );
 
     /**
      * The command under test


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

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

Reply via email to