anmolbabu has uploaded a new change for review. Change subject: webadmin,engine : allow user to set tuned profile ......................................................................
webadmin,engine : allow user to set tuned profile Allow user to set tuned profile. Change-Id: I4ef3f957dfcc40cef8de541898fbc08d698d0ce7 Signed-off-by: Anmol Babu <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterTunedProfilesQuery.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.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/VdcQueryType.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml M packaging/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql A packaging/dbscripts/upgrade/03_06_1190_add_tuned_profile_column_to_vds_groups.sql M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql M packaging/dbscripts/vds_groups_sp.sql 15 files changed, 113 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/39769/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java index a9a75dd..a9da7e2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java @@ -476,6 +476,16 @@ return true; }}, new Callable<Boolean>() { public Boolean call() throws Exception { + VDSGroup vdsGroup = DbFacade.getInstance().getVdsGroupDao().get( + _vds.getVdsGroupId() + ); + _parser.cliEnvironmentSet( + TuneEnv.TUNED_PROFILE, + vdsGroup.getTunedProfile() + ); + return true; + }}, + new Callable<Boolean>() { public Boolean call() throws Exception { /** * Legacy logic * Force reboot only if not node. diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterTunedProfilesQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterTunedProfilesQuery.java new file mode 100644 index 0000000..40d626c --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterTunedProfilesQuery.java @@ -0,0 +1,21 @@ +package org.ovirt.engine.core.bll.gluster; + +import java.util.Arrays; + +import org.ovirt.engine.core.bll.QueriesCommandBase; +import org.ovirt.engine.core.common.config.Config; +import org.ovirt.engine.core.common.config.ConfigValues; +import org.ovirt.engine.core.common.queries.VdcQueryParametersBase; + +public class GetGlusterTunedProfilesQuery<P extends VdcQueryParametersBase> extends QueriesCommandBase<P> { + + public GetGlusterTunedProfilesQuery(P parameters) { + super(parameters); + } + + @Override + protected void executeQueryCommand() { + getQueryReturnValue().setReturnValue(Arrays.asList(Config.<String> getValue(ConfigValues.GlusterTunedProfile).split(","))); + } + +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java index b198c34..8fa92b0 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java @@ -110,6 +110,8 @@ private Boolean migrateCompressed; + private String tunedProfile; + public VDSGroup() { migrateOnError = MigrateOnErrorOptions.YES; name = ""; @@ -424,6 +426,14 @@ this.groupHostsAndVms = groupHostsAndVms; } + public String getTunedProfile() { + return tunedProfile; + } + + public void setTunedProfile(String tunedProfile) { + this.tunedProfile = tunedProfile; + } + @Override public int hashCode() { final int prime = 31; @@ -458,6 +468,7 @@ result = prime * result + (fencingPolicy == null ? 0 : fencingPolicy.hashCode()); result = prime * result + (autoConverge == null ? 0 : autoConverge.hashCode()); result = prime * result + (migrateCompressed == null ? 0 : migrateCompressed.hashCode()); + result = prime * result + (tunedProfile == null ? 0 : tunedProfile.hashCode()); result = prime * result + (maintenanceReasonRequired ? 1231 : 1237); return result; } @@ -505,6 +516,7 @@ && ObjectUtils.objectsEqual(fencingPolicy, other.fencingPolicy) && ObjectUtils.objectsEqual(autoConverge, other.autoConverge) && ObjectUtils.objectsEqual(migrateCompressed, other.migrateCompressed) + && ObjectUtils.objectsEqual(tunedProfile, other.tunedProfile) && ObjectUtils.objectsEqual(maintenanceReasonRequired, other.maintenanceReasonRequired); } 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 d360d0f..e2c6464 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 @@ -1168,12 +1168,12 @@ @Reloadable @TypeConverterAttribute(String.class) @DefaultValueAttribute( - "umask 0077; " + - "MYTMP=\"$(TMPDIR=\"${OVIRT_TMPDIR}\" mktemp -d -t ovirt-XXXXXXXXXX)\"; " + - "trap \"chmod -R u+rwX \\\"${MYTMP}\\\" > /dev/null 2>&1; rm -fr \\\"${MYTMP}\\\" > /dev/null 2>&1\" 0; " + - "tar --warning=no-timestamp -C \"${MYTMP}\" -x && " + - "@ENVIRONMENT@ \"${MYTMP}\"/setup DIALOG/dialect=str:machine DIALOG/customization=bool:True" - ) + "umask 0077; " + + "MYTMP=\"$(TMPDIR=\"${OVIRT_TMPDIR}\" mktemp -d -t ovirt-XXXXXXXXXX)\"; " + + "trap \"chmod -R u+rwX \\\"${MYTMP}\\\" > /dev/null 2>&1; rm -fr \\\"${MYTMP}\\\" > /dev/null 2>&1\" 0; " + + "tar --warning=no-timestamp -C \"${MYTMP}\" -x && " + + "@ENVIRONMENT@ \"${MYTMP}\"/setup DIALOG/dialect=str:machine DIALOG/customization=bool:True" + ) BootstrapCommand, @TypeConverterAttribute(Integer.class) @@ -1453,6 +1453,10 @@ @TypeConverterAttribute(Boolean.class) @DefaultValueAttribute("true") GlusterGeoReplicationEnabled, + + @TypeConverterAttribute(String.class) + @DefaultValueAttribute("rhs-high-throughput,rhs-virtualization") + GlusterTunedProfile, @TypeConverterAttribute(Boolean.class) @DefaultValueAttribute("true") @@ -2041,8 +2045,8 @@ MaxWriteIopsUpperBoundQosValue, /** - * Defines the number of history values storable by the engine for cpu/network/memory usage of a VM - */ + * Defines the number of history values storable by the engine for cpu/network/memory usage of a VM + */ @TypeConverterAttribute(Integer.class) @DefaultValueAttribute("40") UsageHistoryLimit, diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java index f858899..b371fb92 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java @@ -370,6 +370,7 @@ GetGlusterStorageDevices, GetGlusterVolumeSnapshotScheduleByVolumeId, GetUnusedGlusterBricks, + GetGlusterTunedProfiles, GetDefaultConfigurationVersion(VdcQueryAuthType.User), OsRepository(VdcQueryAuthType.User), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java index 8f7e169..3e769ca 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java @@ -234,7 +234,8 @@ .addValue("hosts_with_broken_connectivity_threshold", group.getFencingPolicy().getHostsWithBrokenConnectivityThreshold()) .addValue("fencing_enabled", group.getFencingPolicy().isFencingEnabled()) .addValue("is_auto_converge", group.getAutoConverge()) - .addValue("is_migrate_compressed", group.getMigrateCompressed()); + .addValue("is_migrate_compressed", group.getMigrateCompressed()) + .addValue("tuned_profile", group.getTunedProfile()); return parameterSource; } @@ -302,6 +303,7 @@ entity.getFencingPolicy().setFencingEnabled(rs.getBoolean("fencing_enabled")); entity.setAutoConverge((Boolean) rs.getObject("is_auto_converge")); entity.setMigrateCompressed((Boolean) rs.getObject("is_migrate_compressed")); + entity.setTunedProfile(rs.getString("tuned_profile")); return entity; } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java index a015c1d..5475e84 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java @@ -721,6 +721,7 @@ cluster.setAutoConverge(model.getAutoConverge().getSelectedItem()); cluster.setMigrateCompressed(model.getMigrateCompressed().getSelectedItem()); + cluster.setTunedProfile(model.getTunedProfile().getSelectedItem()); cluster.getRequiredRngSources().clear(); if (Boolean.TRUE.equals(model.getRngRandomSourceRequired().getEntity())) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java index d5c7749..12bbcba 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java @@ -62,6 +62,16 @@ private Map<Guid, Network> defaultManagementNetworkCache = new HashMap<>(); private Boolean detached; + private ListModel<String> tunedProfile; + + public ListModel<String> getTunedProfile() { + return tunedProfile; + } + + public void setTunedProfile(ListModel<String> tunedProfile) { + this.tunedProfile = tunedProfile; + } + public ListModel<ClusterPolicy> getClusterPolicy() { return clusterPolicy; } @@ -862,6 +872,24 @@ public ClusterModel() { super(); + if(ApplicationModeHelper.isModeSupported(ApplicationMode.GlusterOnly)) { + initTunedProfiles(); + } + } + + private void initTunedProfiles() { + this.startProgress(null); + Frontend.getInstance().runQuery(VdcQueryType.GetGlusterTunedProfiles, new VdcQueryParametersBase(), new AsyncQuery(new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object returnValue) { + ClusterModel.this.stopProgress(); + List<String> tunedProfiles = new ArrayList<>(); + if (((VdcQueryReturnValue) returnValue).getSucceeded()) { + tunedProfiles.addAll(Arrays.asList(((String)((VdcQueryReturnValue) returnValue).getReturnValue()).split(",")));//$NON-NLS-1$ + } + tunedProfile.setItems(tunedProfiles); + } + })); } public void init(final boolean isEdit) { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index 3808af5..d206e3b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -827,6 +827,9 @@ @DefaultStringValue("General") String clusterPopupGeneralTabLabel(); + @DefaultStringValue("Tuned Profile") + String tunedProfileLabel(); + @DefaultStringValue("Data Center") String clusterPopupDataCenterLabel(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java index e07d600..c191f16 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java @@ -206,6 +206,11 @@ EntityModelCheckBoxEditor rngHwrngSourceRequired; @UiField + @Path(value = "tunedProfile.selectedItem") + @WithElementId + ListModelListBoxEditor<String> tunedProfileEditor; + + @UiField @WithElementId DialogTab optimizationTab; @@ -430,6 +435,11 @@ localize(); driver.initialize(this); applyModeCustomizations(); + setVisibilities(); + } + + private void setVisibilities() { + tunedProfileEditor.setVisible(ApplicationModeHelper.isModeSupported(ApplicationMode.GlusterOnly)); } @Override @@ -469,6 +479,7 @@ enableGlusterServiceEditor.setLabel(constants.clusterEnableGlusterServiceLabel()); enableOvirtServiceOptionEditor.setLabel(constants.clusterEnableOvirtServiceLabel()); enableGlusterServiceOptionEditor.setLabel(constants.clusterEnableGlusterServiceLabel()); + tunedProfileEditor.setLabel(constants.tunedProfileLabel()); importGlusterConfigurationEditor.setLabel(constants.clusterImportGlusterConfigurationLabel()); importGlusterExplanationLabel.setText(constants.clusterImportGlusterConfigurationExplanationLabel()); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml index 166b53d..4079d25 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml @@ -196,6 +196,7 @@ <ge:EntityModelCheckBoxEditor ui:field="rngRandomSourceRequired" /> <ge:EntityModelCheckBoxEditor ui:field="rngHwrngSourceRequired" /> </g:FlowPanel> + <e:ListModelListBoxEditor ui:field="tunedProfileEditor" /> </g:FlowPanel> </t:content> </t:DialogTab> diff --git a/packaging/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql b/packaging/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql index a72baab..e434f18 100644 --- a/packaging/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql +++ b/packaging/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql @@ -1,2 +1 @@ select fn_db_add_column('gluster_georep_session', 'user_name', 'VARCHAR(255)'); - diff --git a/packaging/dbscripts/upgrade/03_06_1190_add_tuned_profile_column_to_vds_groups.sql b/packaging/dbscripts/upgrade/03_06_1190_add_tuned_profile_column_to_vds_groups.sql new file mode 100644 index 0000000..07a314d --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_1190_add_tuned_profile_column_to_vds_groups.sql @@ -0,0 +1 @@ +select fn_db_add_column('vds_groups', 'tuned_profile', 'VARCHAR(50)'); \ No newline at end of file diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index 6d94283..ae2da3c 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -165,6 +165,7 @@ select fn_db_add_config_value_for_versions_up_to('GlusterGeoReplicationEnabled', 'false', '3.5'); select fn_db_add_config_value('GlusterRefreshRateGeoRepDiscoveryInSecs', '3600', 'general'); select fn_db_add_config_value('GlusterRefreshRateGeoRepStatusInSecs', '300', 'general'); +select fn_db_add_config_value('GlusterTunedProfile', 'rhs-high-throughput,rhs-virtualization', 'general'); -- Gluster Volume Snapshots -- select fn_db_add_config_value_for_versions_up_to('GlusterVolumeSnapshotSupported', 'false', '3.5'); diff --git a/packaging/dbscripts/vds_groups_sp.sql b/packaging/dbscripts/vds_groups_sp.sql index 397f15f..5828aa7 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -43,7 +43,8 @@ v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, - v_is_migrate_compressed BOOLEAN + v_is_migrate_compressed BOOLEAN, + v_tuned_profile VARCHAR(50) ) RETURNS VOID AS $procedure$ @@ -51,11 +52,11 @@ INSERT INTO vds_groups(vds_group_id,description, name, free_text_comment, cpu_name, storage_pool_id, max_vds_memory_over_commit, count_threads_as_cores, compatibility_version, transparent_hugepages, migrate_on_error, virt_service, gluster_service, tunnel_migration, emulated_machine, detect_emulated_machine, trusted_service, ha_reservation, optional_reason, maintenance_reason_required, cluster_policy_id, cluster_policy_custom_properties, enable_balloon, architecture, optimization_type, spice_proxy, enable_ksm, serial_number_policy, custom_serial_number, required_rng_sources, skip_fencing_if_sd_active, skip_fencing_if_connectivity_broken, hosts_with_broken_connectivity_threshold, fencing_enabled, - is_auto_converge, is_migrate_compressed) + is_auto_converge, is_migrate_compressed, tuned_profile) VALUES(v_vds_group_id,v_description, v_name, v_free_text_comment, v_cpu_name, v_storage_pool_id, v_max_vds_memory_over_commit, v_count_threads_as_cores, v_compatibility_version, v_transparent_hugepages, v_migrate_on_error, v_virt_service, v_gluster_service, v_tunnel_migration, v_emulated_machine, v_detect_emulated_machine, v_trusted_service, v_ha_reservation, v_optional_reason, v_maintenance_reason_required, v_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon, v_architecture, v_optimization_type, v_spice_proxy, v_enable_ksm, v_serial_number_policy, v_custom_serial_number, v_required_rng_sources, v_skip_fencing_if_sd_active, v_skip_fencing_if_connectivity_broken, v_hosts_with_broken_connectivity_threshold, v_fencing_enabled, - v_is_auto_converge, v_is_migrate_compressed); + v_is_auto_converge, v_is_migrate_compressed, v_tuned_profile); END; $procedure$ LANGUAGE plpgsql; @@ -98,7 +99,8 @@ v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, - v_is_migrate_compressed BOOLEAN + v_is_migrate_compressed BOOLEAN, + v_tuned_profile VARCHAR(50) ) RETURNS VOID @@ -123,7 +125,8 @@ hosts_with_broken_connectivity_threshold = v_hosts_with_broken_connectivity_threshold, fencing_enabled = v_fencing_enabled, is_auto_converge = v_is_auto_converge, - is_migrate_compressed = v_is_migrate_compressed + is_migrate_compressed = v_is_migrate_compressed, + tuned_profile = v_tuned_profile WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit https://gerrit.ovirt.org/39769 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4ef3f957dfcc40cef8de541898fbc08d698d0ce7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
