Maor Lipchuk has uploaded a new change for review.

Change subject: core: Use configuration for Import Storage Domain
......................................................................

core: Use configuration for Import Storage Domain

Add a new configuration value for Import Storage Domain.
Import Storage Domain should be supported only with Hosts that are in
3.5 clusters.

Change-Id: I4b1824320223c915b97e0ea487abec285cea31e5
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddExistingFileStorageDomainCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
9 files changed, 30 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/29020/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddExistingFileStorageDomainCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddExistingFileStorageDomainCommand.java
index 0a4ec24..6994972 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddExistingFileStorageDomainCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddExistingFileStorageDomainCommand.java
@@ -6,6 +6,7 @@
 import org.apache.commons.lang.StringUtils;
 
 import org.ovirt.engine.core.bll.Backend;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.action.StorageDomainManagementParameter;
 import 
org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase;
 import org.ovirt.engine.core.common.action.VdcActionType;
@@ -58,9 +59,10 @@
     }
 
     protected boolean checkExistingStorageDomain() {
-        // prevent importing DATA domain
-        if (getParameters().getStorageDomain().getStorageDomainType() == 
StorageDomainType.Data) {
-            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED);
+        // Prevent importing DATA domain if cluster version is not supported.
+        if (getParameters().getStorageDomain().getStorageDomainType() == 
StorageDomainType.Data
+                && 
!FeatureSupported.importDataStorageDomain(getVds().getVdsGroupCompatibilityVersion()))
 {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED);
         }
 
         if 
(DbFacade.getInstance().getStorageDomainStaticDao().get(getStorageDomain().getId())
 != null) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
index 18b6f00..a0207cd 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
@@ -307,6 +307,15 @@
 
     /**
      * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if import of Data Storage Domain is supported.
+     */
+    public static boolean importDataStorageDomain(Version version) {
+        return supportedInConfig(ConfigValues.ImportDataStorageDomain, 
version);
+    }
+
+    /**
+     * @param version
      *          Compatibility version to check for.
      * @return  <code>true</code> if iSCSI multipathing is supported for the 
given version.
      */
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index e0754c6..7c0a6c2 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1593,6 +1593,10 @@
 
     @TypeConverterAttribute(Boolean.class)
     @DefaultValueAttribute("true")
+    ImportDataStorageDomain,
+
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
     VirtIoRngDeviceSupported,
 
     @TypeConverterAttribute(Boolean.class)
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 20de068..a01c259 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -738,7 +738,7 @@
     CPU_TYPE_UNSUPPORTED_IN_THIS_CLUSTER_VERSION(ErrorType.CONFLICT),
     
USER_FAILED_TO_AUTHENTICATE_ACCOUNT_IS_LOCKED_OR_DISABLED(ErrorType.NO_AUTHENTICATION),
     
ACTION_TYPE_FAILED_CANNOT_REMOVE_BUILTIN_GROUP_EVERYONE(ErrorType.CONFLICT),
-    ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED(ErrorType.BAD_PARAMETERS),
+    
ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED),
     VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM(ErrorType.BAD_PARAMETERS),
     MOVE_VM_CLUSTER_MISSING_NETWORK(ErrorType.CONFLICT),
     
ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_VDS_GROUP_CANNOT_BE_LOCALFS(ErrorType.CONFLICT),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index b1364b1..3652608 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -840,7 +840,7 @@
 ACTION_TYPE_FAILED_INVALID_POOL_NAME=Can not ${action} ${type}. The given name 
is invalid for pool name. Only lower-case and upper-case letters, numbers, '_', 
'-', '.', and one mask sequence are allowed.
 VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM=Missing UserName or Password.
 ACTION_TYPE_FAILED_CANNOT_REMOVE_BUILTIN_GROUP_EVERYONE=Cannot remove the 
built-in group "Everyone".
-ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED=Importing data domain is 
prohibited.
+ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED=Cannot ${action} 
${type}. The operation is not supported for this cluster version.
 ACTION_TYPE_FAILED_VDS_NOT_MATCH_VALID_STATUS=Cannot ${action} ${type}. Valid 
Host statuses are "Non operational", "Maintenance" or "Connecting".
 CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID=Can not Remove Storage Domain - 
the underlying Host ID is invalid.
 ERROR_CANNOT_DEACTIVATE_MASTER_WITH_LOCKED_DOMAINS=You are trying to 
deactivate a Master storage domain while there are locked domains in the Data 
Center. Please wait for the operations on those domains to finish first.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 3b0a748..cc12814 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -2280,8 +2280,8 @@
     @DefaultStringValue("Cannot remove the built-in group \"Everyone\".")
     String ACTION_TYPE_FAILED_CANNOT_REMOVE_BUILTIN_GROUP_EVERYONE();
 
-    @DefaultStringValue("Importing data domain is prohibited.")
-    String ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED();
+    @DefaultStringValue("Cannot ${action} ${type}. The operation is not 
supported for this cluster version.")
+    String ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED();
 
     @DefaultStringValue("Cannot ${action} ${type}. Valid Host statuses are 
\"Non operational\", \"Maintenance\" or \"Problematic\".")
     String ACTION_TYPE_FAILED_VDS_NOT_MATCH_VALID_STATUS();
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 7ce3478..4533d70 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -811,6 +811,7 @@
 VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM=Missing UserName or Password.
 ACTION_TYPE_FAILED_CANNOT_REMOVE_BUILTIN_GROUP_EVERYONE=Cannot remove the 
built-in group "Everyone".
 ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED=Importing data domain is 
prohibited.
+ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED=Cannot ${action} 
${type}. The operation is not supported for this cluster version.
 ACTION_TYPE_FAILED_VDS_NOT_MATCH_VALID_STATUS=Cannot ${action} ${type}. Valid 
Host statuses are "Non operational", "Maintenance" or "Connecting".
 CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID=Can not Remove Storage Domain - 
the underlying Host ID is invalid.
 ERROR_CANNOT_DEACTIVATE_MASTER_WITH_LOCKED_DOMAINS=You are trying to 
deactivate a Master storage domain while there are locked domains in the Data 
Center. Please wait for the operations on those domains to finish first.
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index bbb4944..e115242 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -838,6 +838,7 @@
 VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM=Missing UserName or Password.
 ACTION_TYPE_FAILED_CANNOT_REMOVE_BUILTIN_GROUP_EVERYONE=Cannot remove the 
built-in group "Everyone".
 ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_PROHIBITED=Importing data domain is 
prohibited.
+ACTION_TYPE_FAILED_IMPORT_DATA_DOMAIN_IS_NOT_SUPPORTED=Cannot ${action} 
${type}. The operation is not supported for this cluster version.
 ACTION_TYPE_FAILED_VDS_NOT_MATCH_VALID_STATUS=Cannot ${action} ${type}. Valid 
Host statuses are "Non operational", "Maintenance" or "Connecting".
 CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID=Can not Remove Storage Domain - 
the underlying Host ID is invalid.
 ERROR_CANNOT_DEACTIVATE_MASTER_WITH_LOCKED_DOMAINS=You are trying to 
deactivate a Master storage domain while there are locked domains in the Data 
Center. Please wait for the operations on those domains to finish first.
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 6539f56..e8f8be8 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -268,6 +268,12 @@
 select fn_db_add_config_value('IscsiMultipathingSupported','false','3.2');
 select fn_db_add_config_value('IscsiMultipathingSupported','false','3.3');
 
+select fn_db_add_config_value('ImportDataStorageDomain','false','3.0');
+select fn_db_add_config_value('ImportDataStorageDomain','false','3.1');
+select fn_db_add_config_value('ImportDataStorageDomain','false','3.2');
+select fn_db_add_config_value('ImportDataStorageDomain','false','3.3');
+select fn_db_add_config_value('ImportDataStorageDomain','false','3.4');
+
 -- Mixed domain types in a data center support
 select fn_db_add_config_value('MixedDomainTypesInDataCenter','false','3.0');
 select fn_db_add_config_value('MixedDomainTypesInDataCenter','false','3.1');


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

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

Reply via email to