Sahina Bose has uploaded a new change for review.

Change subject: engine: Version check for gluster network role feature
......................................................................

engine: Version check for gluster network role feature

Added a compat version check to see if the gluster
network role feature is supported.
This requires feature support from gluster to identify
a host with multiple names

Change-Id: I2cf926a5446b2489e65d844be692761e02e42639
Bug-Url: https://bugzilla.redhat.com/1049994
Signed-off-by: Sahina Bose <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.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/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.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/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
10 files changed, 41 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/40148/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
index 12523c8..afd7f7a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToVdsGroupCommand.java
@@ -110,6 +110,7 @@
         return (!NetworkUtils.isManagementNetwork(getNetwork())
                 || 
validate(validator.managementNetworkAttachment(getNetworkName())))
                 && 
validate(validator.migrationPropertySupported(getNetworkName()))
+                && validate(validator.glusterNetworkSupported())
                 && (!getPersistedNetwork().isExternal()
                 || validateExternalNetwork(validator));
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java
index 03555ee..5b484ec 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidator.java
@@ -4,6 +4,7 @@
 import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.businessentities.network.NetworkCluster;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.gluster.GlusterFeatureSupported;
 import org.ovirt.engine.core.compat.Version;
 
 /**
@@ -84,4 +85,17 @@
                 : ValidationResult.VALID;
     }
 
+    /**
+     * Make sure the gluster network is supported for the cluster version
+     *
+     * @param cluster
+     * @return error if gluster network role is not supported for the 
compatibility version
+     */
+    public ValidationResult glusterNetworkSupported() {
+        return networkCluster.isGluster()
+                && 
!GlusterFeatureSupported.glusterNetworkRoleSupported(version)
+                ? new 
ValidationResult(VdcBllMessages.GLUSTER_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL)
+                : ValidationResult.VALID;
+    }
 }
+
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java
index 28b2a41..afc09e9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java
@@ -116,6 +116,7 @@
         return (!NetworkUtils.isManagementNetwork(getNetwork())
                 || 
validate(validator.managementNetworkAttachment(getNetworkName())))
                 && 
validate(validator.migrationPropertySupported(getNetworkName()))
+                && validate(validator.glusterNetworkSupported())
                 && validate(glusterNetworkInUseAndUnset(getVdsGroup()))
                 && (!getNetwork().isExternal() || 
validateExternalNetwork(validator));
     }
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 01b3791..10c6951 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
@@ -1492,6 +1492,10 @@
     @DefaultValueAttribute("300")
     GlusterRefreshRateGeoRepStatusInSecs,
 
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("true")
+    GlusterNetworkRoleSupported,
+
     @TypeConverterAttribute(String.class)
     @DefaultValueAttribute("AttestationService/resources/PollHosts")
     PollUri,
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 89d412b..6359a33 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
@@ -978,6 +978,7 @@
     ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED(ErrorType.BAD_PARAMETERS),
     
ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE(ErrorType.BAD_PARAMETERS),
+    GLUSTER_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL(ErrorType.NOT_SUPPORTED),
 
     // OpenStack Glance
     ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
index d08bcd2..be73278 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/gluster/GlusterFeatureSupported.java
@@ -112,4 +112,16 @@
   public static boolean glusterBrickProvisioning(Version version) {
         return supportedInConfig(ConfigValues.GlusterBrickProvisioningEnabled, 
version);
   }
+
+  /**
+  *
+  * @param version
+  *            Compatibility version to check for.
+  * @return <code>true</code> if gluster supports peer probing by multiple 
interfaces via gluster network role
+  *         <code>false</code> if it's not.
+  */
+  public static boolean glusterNetworkRoleSupported(Version version) {
+      return supportedInConfig(ConfigValues.GlusterNetworkRoleSupported, 
version);
+  }
+
 }
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 793dfac..4518971 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1032,6 +1032,7 @@
 ACTION_TYPE_FAILED_BASE_TEMPLATE_DOES_NOT_EXIST=Cannot ${action} ${type}. Base 
Template does not exist for this Template Version.
 
 NON_VM_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL=Non-VM networks are not supported 
in this Data-Center.
+GLUSTER_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL=Gluster networks are not 
supported in this cluster compatibility version.
 
 VM_SLA_POLICY_NOT_SUPPORTED=VM SLA Policy is not supported in this Cluster.
 # Gluster Error Messages
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 59b0e43..47c46f8 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
@@ -2789,6 +2789,9 @@
     @DefaultStringValue("Non-VM networks are not supported in this 
Data-Center.")
     String NON_VM_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL();
 
+    @DefaultStringValue("Gluster networks are not supported in this cluster 
compatibility version.")
+    String GLUSTER_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL();
+
     @DefaultStringValue("Disk description must be formed only from 
alpha-numeric characters and special characters that conform to the standard 
ASCII character set.")
     String VALIDATION_DISK_DESCRIPTION_INVALID();
 
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 b4071be..595aa63 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
@@ -1025,6 +1025,7 @@
 ACTION_TYPE_FAILED_NETWORK_NOT_IN_CLUSTER=Failed ${action} ${type}. The 
following networks (${networks}) are not defined in the cluster.
 ACTION_TYPE_FAILED_INTERFACE_NETWORK_NOT_CONFIGURED=Failed ${action} ${type}. 
One or more network interfaces have incomplete network configuration. Please 
configure these interfaces and try again.
 NON_VM_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL=Non-VM networks are not supported 
in this Data-Center.
+GLUSTER_NETWORK_NOT_SUPPORTED_FOR_POOL_LEVEL=Gluster networks are not 
supported in this cluster compatibility version.
 VMPAYLOAD_INVALID_PAYLOAD_TYPE=VM Payload only supported in CDROM or Floppy 
devices
 VMPAYLOAD_SIZE_EXCEEDED=Payload is limited to ${size}K
 VMPAYLOAD_FLOPPY_EXCEEDED=Payload Floppy cannot be used when using an 
additional Floppy
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index d129e49..0c3c450 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -215,6 +215,9 @@
 select 
fn_db_add_config_value('GlusterDefaultBrickMountPoint','/gluster-bricks','general');
 
 
+-- Gluster Network Role --
+select 
fn_db_add_config_value_for_versions_up_to('GlusterNetworkRoleSupported', 
'false', '3.5');
+
 -- OpenStack related
 select fn_db_add_config_value('KeystoneAuthUrl', '', 'general');
 


-- 
To view, visit https://gerrit.ovirt.org/40148
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cf926a5446b2489e65d844be692761e02e42639
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Sahina Bose <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to