Kanagaraj M has uploaded a new change for review. Change subject: engine: Cluster with Virt and Gluster enabled - configurable ......................................................................
engine: Cluster with Virt and Gluster enabled - configurable A new configuration property is added vdc_options named 'AllowClusterWithVirtGlusterEnabled'. It is to determine whether the user is allowed to create a cluster with both Virt and Gluster services enable or not. It will have the default value as true, so that user can have a cluster with Virt and Gluster enabled. Change-Id: I63c501501545f35ee445861f71ec3c7197d66e06 Signed-off-by: Kanagaraj M <[email protected]> --- M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.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/queries/ConfigurationValues.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java 11 files changed, 51 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/7453/1 diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql index cae394d..a30311a 100644 --- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -38,6 +38,7 @@ select fn_db_add_config_value('AdvancedNFSOptionsEnabled','true','3.1'); select fn_db_add_config_value('AdvancedNFSOptionsEnabled','true','3.2'); select fn_db_add_config_value('AgentAppName','RHEV-Agent','general'); +select fn_db_add_config_value('AllowClusterWithVirtGlusterEnabled','false','general'); select fn_db_add_config_value('AllowDuplicateMacAddresses','false','general'); select fn_db_add_config_value('ApplicationMode','255','general'); select fn_db_add_config_value('AsyncPollingCyclesBeforeCallbackCleanup','120','general'); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java index 8d869be..447b6d6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java @@ -168,6 +168,10 @@ if(!(getVdsGroup().supportsGlusterService() || getVdsGroup().supportsVirtService())) { addCanDoActionMessage(VdcBllMessages.VDS_GROUP_AT_LEAST_ONE_SERVICE_MUST_BE_ENABLED); result = false; + } else if (getVdsGroup().supportsGlusterService() && getVdsGroup().supportsVirtService() + && !isAllowClusterWithVirtGluster()) { + addCanDoActionMessage(VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED); + result = false; } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java index 94340e7..266a929 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java @@ -294,6 +294,11 @@ addCanDoActionMessage(VdcBllMessages.VDS_GROUP_AT_LEAST_ONE_SERVICE_MUST_BE_ENABLED); result = false; } + else if (getVdsGroup().supportsGlusterService() && getVdsGroup().supportsVirtService() + && !isAllowClusterWithVirtGluster()) { + addCanDoActionMessage(VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED); + result = false; + } } if (result && hasVms && !getVdsGroup().supportsVirtService()) { addCanDoActionMessage(VdcBllMessages.VDS_GROUP_CANNOT_DISABLE_VIRT_WHEN_CLUSTER_CONTAINS_VMS); @@ -343,6 +348,7 @@ return getDbFacade().getVdsStaticDAO(); } + @Override protected NetworkDAO getNetworkDAO() { return getDbFacade().getNetworkDAO(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java index fdc2e37..aa89d85 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java @@ -79,4 +79,12 @@ return result; } + + protected boolean isAllowClusterWithVirtGluster() { + Boolean allowVirGluster = Config.<Boolean> GetValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); + if (allowVirGluster == null) { + allowVirGluster = Boolean.TRUE; + } + return allowVirGluster; + } } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java index 629bb3d..fa52b78 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommandTest.java @@ -200,6 +200,17 @@ } @Test + public void vdsGroupWithVirtGlusterServicesNotAllowed() { + createCommandWithVirtGlusterEnabled(); + when(vdsGroupDAO.get(any(Guid.class))).thenReturn(createVdsGroupWithNoCpuName()); + when(vdsGroupDAO.getByName(anyString())).thenReturn(createVdsGroupWithNoCpuName()); + when(cmd.isAllowClusterWithVirtGluster()).thenReturn(false); + cpuExists(); + allQueriesEmpty(); + canDoActionFailedWithReason(VdcBllMessages.VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED); + } + + @Test public void disableVirtWhenVmsExist() { createCommandWithGlusterEnabled(); when(vdsGroupDAO.get(any(Guid.class))).thenReturn(createVdsGroupWithNoCpuName()); @@ -266,6 +277,10 @@ createCommand(createVdsGroupWith(false, true)); } + private void createCommandWithVirtGlusterEnabled() { + createCommand(createVdsGroupWith(true, true)); + } + private void createCommand(final VDSGroup group) { setValidCpuVersionMap(); VdsGroupOperationParameters params = new VdsGroupOperationParameters(group); 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 494ac71..05e0b71 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 @@ -1442,6 +1442,13 @@ @DefaultValueAttribute("ovirt-engine") SSHKeyAlias(377), + /* + * Whether to allow a cluster with both Virt and Gluster services enabled + */ + @TypeConverterAttribute(Boolean.class) + @DefaultValueAttribute("true") + AllowClusterWithVirtGlusterEnabled(378), + Invalid(65535); private int intValue; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java index cdca3a9..aea6c96 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java @@ -78,7 +78,8 @@ WANDisableEffects(ConfigAuthType.User), WANColorDepth(ConfigAuthType.User), SupportForceCreateVG, - NetworkConnectivityCheckTimeoutInSeconds; + NetworkConnectivityCheckTimeoutInSeconds, + AllowClusterWithVirtGlusterEnabled; public static enum ConfigAuthType { Admin, diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java index e75c4e6..3105209 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java @@ -523,6 +523,7 @@ VDS_GROUP_CPU_HIGH_UTILIZATION_PERCENTAGE_MUST_BE_DEFINED_WHEN_USING_EVENLY_DISTRIBUTED, VDS_GROUP_BOTH_LOW_AND_HIGH_CPU_UTILIZATION_PERCENTAGE_MUST_BE_DEFINED_WHEN_USING_POWER_SAVING, VDS_GROUP_AT_LEAST_ONE_SERVICE_MUST_BE_ENABLED, + VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED, VDS_GROUP_CANNOT_DISABLE_VIRT_WHEN_CLUSTER_CONTAINS_VMS, VDS_GROUP_CANNOT_DISABLE_GLUSTER_WHEN_CLUSTER_CONTAINS_VOLUMES, VDS_CANNOT_UPDATE_CLUSTER, diff --git a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties index f6a38f8..fa179eb 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties @@ -346,4 +346,5 @@ VM_WITH_SAME_NAME_EXIST=VM with the same name already exists. SNAPSHOT_FAILED=Live snapshot failed. # Gluster engine errors -NO_UP_SERVER_FOUND=No server found in Up status. +NO_UP_SERVER_FOUND=No server found in Up status. +VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED = Creating a Cluster with both Virt and Gluster services enabled is not supported 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 561bd29..5158836 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 @@ -2026,4 +2026,7 @@ @DefaultStringValue("Migrating a VM in paused status is unsupported.") String MIGRATE_PAUSED_VM_IS_UNSUPPORTED(); + + @DefaultStringValue("Cannot ${action} ${type}. Enabling both Virt and Gluster services is not allowed.") + String VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED(); } diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java index cd5f9bf..8b44d9e 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java @@ -686,4 +686,6 @@ @DefaultStringValue("Gluster Host Remove Failed.") String GlusterHostRemoveFailed(); + + String VDS_GROUP_ENABLING_BOTH_VIRT_AND_GLUSTER_SERVICES_NOT_ALLOWED(); } -- To view, visit http://gerrit.ovirt.org/7453 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63c501501545f35ee445861f71ec3c7197d66e06 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
