Jiří Moskovčák has uploaded a new change for review. Change subject: core: added ksm support ......................................................................
core: added ksm support Since vdsm 3.3 the ksm is controlled via MoM and there should be a way to control it from the engine. This patch ads the initial support to the engine core. Change-Id: I719d0b130fda26894db9fdaf892fd6da28bb648b Bug-Url: https://bugzilla.redhat.com/1026980 Signed-off-by: Jiri Moskovcak <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateMomPolicyCommand.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/errors/VdcBllMessages.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MomPolicyVDSParameters.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetMOMPolicyParametersVDSCommand.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java A packaging/dbscripts/upgrade/03_04_0480_add_enable_ksm_to_vds_groups.sql M packaging/dbscripts/vds_groups_sp.sql 10 files changed, 43 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/23358/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java index 0035055..d10077e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InitVdsOnUpCommand.java @@ -267,7 +267,8 @@ if (cluster.getcompatibility_version().compareTo(Version.v3_3) >= 0) { try { returnValue = runVdsCommand(VDSCommandType.SetMOMPolicyParameters, - new MomPolicyVDSParameters(vds, cluster.isEnableBallooning())); + new MomPolicyVDSParameters(vds, cluster.isEnableBallooning(), cluster.isEnableKsm()) + ); } catch (VdcBLLException e) { log.errorFormat("Could not update MoM policy on host {0}", vds.getName()); returnValue.setSucceeded(false); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateMomPolicyCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateMomPolicyCommand.java index 7a1da67..33ef712 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateMomPolicyCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateMomPolicyCommand.java @@ -26,7 +26,9 @@ boolean succeeded = false; try { succeeded = runVdsCommand(VDSCommandType.SetMOMPolicyParameters, - new MomPolicyVDSParameters(getVds(), getVdsGroup().isEnableBallooning())).getSucceeded(); + new MomPolicyVDSParameters(getVds(), getVdsGroup().isEnableBallooning(), + getVdsGroup().isEnableKsm()) + ).getSucceeded(); } catch (VdcBLLException e) { log.errorFormat("Could not update MoM policy on host {0}", getVdsName()); } 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 8ff574f..d04514c 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 @@ -46,6 +46,8 @@ private boolean enableBallooning; + private boolean enableKsm; + private boolean countThreadsAsCores; @Size(max = BusinessEntitiesDefinitions.GENERAL_VERSION_SIZE) @@ -277,6 +279,14 @@ this.clusterPolicyProperties = clusterPolicyProperties; } + public boolean isEnableKsm() { + return enableKsm; + } + + public void setEnableKsm(boolean enableKsm) { + this.enableKsm = enableKsm; + } + public boolean isEnableBallooning() { return enableBallooning; } @@ -341,6 +351,7 @@ result = prime * result + (haReservation ? 1231 : 1237); result = prime * result + ((clusterPolicyName == null) ? 0 : clusterPolicyName.hashCode()); result = prime * result + (clusterPolicyProperties == null ? 0 : clusterPolicyProperties.hashCode()); + result = prime * result + (enableKsm ? 1231 : 1237); result = prime * result + (enableBallooning ? 1231 : 1237); result = prime * result + ((optimizationType == null) ? 0 : optimizationType.hashCode()); return result; @@ -379,6 +390,7 @@ && ObjectUtils.objectsEqual(clusterPolicyId, other.clusterPolicyId) && ObjectUtils.objectsEqual(clusterPolicyName, other.clusterPolicyName) && ObjectUtils.objectsEqual(clusterPolicyProperties, other.clusterPolicyProperties) + && enableKsm == other.enableKsm && enableBallooning == other.enableBallooning && detectEmulatedMachine == other.detectEmulatedMachine && optimizationType == other.optimizationType); 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 76d94fc..88a98da 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 @@ -898,6 +898,9 @@ SCHEDULING_ALL_HOSTS_FILTERED_OUT(ErrorType.CONFLICT), // memory QOS features + KSM_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS), + + // memory QOS features QOS_BALLOON_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS), // CPU QoS features diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MomPolicyVDSParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MomPolicyVDSParameters.java index 051ea41..1b2b6c7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MomPolicyVDSParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MomPolicyVDSParameters.java @@ -7,10 +7,12 @@ */ public class MomPolicyVDSParameters extends VdsIdVDSCommandParametersBase { private boolean enableBalloon; + private boolean enableKsm; - public MomPolicyVDSParameters(VDS vds, boolean enableBalloon) { + public MomPolicyVDSParameters(VDS vds, boolean enableBalloon, boolean enableKsm) { super(vds.getId()); this.enableBalloon = enableBalloon; + this.enableKsm = enableKsm; } public MomPolicyVDSParameters() { @@ -23,4 +25,12 @@ public void setEnableBalloon(boolean enableBalloon) { this.enableBalloon = enableBalloon; } + + public boolean isEnableKsm() { + return enableKsm; + } + + public void setEnableKsm(boolean enableKsm) { + this.enableKsm = enableKsm; + } } 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 91bceb6..aa7154c 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 @@ -195,7 +195,7 @@ .addValue("architecture", group.getArchitecture()) .addValue("enable_balloon", group.isEnableBallooning()) .addValue("optimization_type", group.getOptimizationType()) - .addValue("enable_balloon", group.isEnableBallooning()) + .addValue("enable_ksm", group.isEnableKsm()) .addValue("spice_proxy", group.getSpiceProxy()); return parameterSource; } @@ -236,6 +236,7 @@ entity.setClusterPolicyProperties(SerializationFactory.getDeserializer() .deserializeOrCreateNew(rs.getString("cluster_policy_custom_properties"), LinkedHashMap.class)); entity.setEnableBallooning(rs.getBoolean("enable_balloon")); + entity.setEnableKsm(rs.getBoolean("enable_ksm")); entity.setArchitecture(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setOptimizationType(OptimizationType.from(rs.getInt("optimization_type"))); entity.setSpiceProxy(rs.getString("spice_proxy")); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetMOMPolicyParametersVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetMOMPolicyParametersVDSCommand.java index f041162..7e9123b 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetMOMPolicyParametersVDSCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetMOMPolicyParametersVDSCommand.java @@ -27,6 +27,7 @@ protected Map<String, Object> initDeviceStructure() { Map<String, Object> deviceStruct = new HashMap<>(); deviceStruct.put(VdsProperties.balloonEnabled, getParameters().isEnableBalloon()); + deviceStruct.put(VdsProperties.ksmEnabled, getParameters().isEnableKsm()); return deviceStruct; } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java index 5560cfe..c980e69 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java @@ -326,6 +326,7 @@ // MoM policy tuning public static final String balloonEnabled = "balloonEnabled"; + public static final String ksmEnabled = "ksmEnabled"; // properties for ServerConnectionListReturnForXmlRpc public static final String serverType = "serverType"; diff --git a/packaging/dbscripts/upgrade/03_04_0480_add_enable_ksm_to_vds_groups.sql b/packaging/dbscripts/upgrade/03_04_0480_add_enable_ksm_to_vds_groups.sql new file mode 100644 index 0000000..e97ffb3 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_04_0480_add_enable_ksm_to_vds_groups.sql @@ -0,0 +1 @@ +select fn_db_add_column('vds_groups', 'enable_ksm', 'boolean not null default true'); diff --git a/packaging/dbscripts/vds_groups_sp.sql b/packaging/dbscripts/vds_groups_sp.sql index ba25f6e..47200b5 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -31,16 +31,17 @@ v_enable_balloon BOOLEAN, v_architecture INTEGER, v_optimization_type SMALLINT, - v_spice_proxy VARCHAR(255)) + v_spice_proxy VARCHAR(255), + v_enable_ksm BOOLEAN) RETURNS VOID AS $procedure$ BEGIN 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, cluster_policy_id, - cluster_policy_custom_properties, enable_balloon, architecture, optimization_type, spice_proxy) + cluster_policy_custom_properties, enable_balloon, architecture, optimization_type, spice_proxy, enable_ksm) 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_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon, - v_architecture, v_optimization_type, v_spice_proxy); + v_architecture, v_optimization_type, v_spice_proxy, v_enable_ksm); END; $procedure$ LANGUAGE plpgsql; @@ -71,7 +72,8 @@ v_enable_balloon BOOLEAN, v_architecture INTEGER, v_optimization_type SMALLINT, - v_spice_proxy VARCHAR(255) + v_spice_proxy VARCHAR(255), + v_enable_ksm BOOLEAN ) RETURNS VOID @@ -88,7 +90,7 @@ virt_service = v_virt_service, gluster_service = v_gluster_service, tunnel_migration = v_tunnel_migration, emulated_machine = v_emulated_machine, detect_emulated_machine = v_detect_emulated_machine, trusted_service = v_trusted_service, ha_reservation = v_ha_reservation , cluster_policy_id = v_cluster_policy_id, cluster_policy_custom_properties = v_cluster_policy_custom_properties, enable_balloon = v_enable_balloon, architecture = v_architecture, - optimization_type = v_optimization_type, spice_proxy = v_spice_proxy + optimization_type = v_optimization_type, spice_proxy = v_spice_proxy, enable_ksm = v_enable_ksm WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/23358 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I719d0b130fda26894db9fdaf892fd6da28bb648b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Jiří Moskovčák <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
