Greg Padgett has uploaded a new change for review. Change subject: WIP core: Logic for CPU Overcommit fields (2/5) ......................................................................
WIP core: Logic for CPU Overcommit fields (2/5) This patch series adds support for CPU Overcommitment based on counting host threads as cores for the purpose of VM startup/shutdown/migration. Patch 2: add code in engine-core to support CPU Overcommitment in business entities, object serialization (test), and VdsBroker. Change-Id: Ic0587423ad20529a5fdfd79050ea839ba1ddecf3 Signed-off-by: Greg Padgett <gpadg...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.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/businessentities/VdsDynamic.java M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java 6 files changed, 82 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/10167/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java index bdd4414..fa26587 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java @@ -158,8 +158,9 @@ } public VDS(Guid vds_group_id, String vds_group_name, String vds_group_description, Guid vds_id, String vds_name, - String ip, String host_name, int port, int status, Integer cpu_cores, String cpu_model, - Double cpu_speed_mh, String if_total_speed, Boolean kvm_enabled, Integer physical_mem_mb, + String ip, String host_name, int port, int status, Integer cpu_cores, + Boolean cpu_ht_enabled, String cpu_model, Double cpu_speed_mh, + Boolean vdsm_count_threads_as_cores, String if_total_speed, Boolean kvm_enabled, Integer physical_mem_mb, Double cpu_idle, Double cpu_load, Double cpu_sys, Double cpu_user, Integer mem_commited, Integer vm_active, int vm_count, Integer vm_migrating, Integer usage_mem_percent, Integer usage_cpu_percent, Integer usage_network_percent, @@ -184,8 +185,10 @@ this.setport(port); this.setstatus(VDSStatus.forValue(status)); this.setcpu_cores(cpu_cores); + this.setcpu_ht_enabled(cpu_ht_enabled); this.setcpu_model(cpu_model); this.setcpu_speed_mh(cpu_speed_mh); + this.setvdsm_count_threads_as_cores(vdsm_count_threads_as_cores); this.setif_total_speed(if_total_speed); this.setkvm_enabled(kvm_enabled); this.setphysical_mem_mb(physical_mem_mb); @@ -238,8 +241,10 @@ getport(), getstatus().getValue(), getcpu_cores(), + getcpu_ht_enabled(), getcpu_model(), getcpu_speed_mh(), + getvdsm_count_threads_as_cores(), getif_total_speed(), getkvm_enabled(), getphysical_mem_mb(), @@ -438,6 +443,14 @@ this.mVdsDynamic.setcpu_cores(value); } + public Boolean getcpu_ht_enabled() { + return this.mVdsDynamic.getcpu_ht_enabled(); + } + + public void setcpu_ht_enabled(Boolean value) { + this.mVdsDynamic.setcpu_ht_enabled(value); + } + public Integer getcpu_sockets() { return this.mVdsDynamic.getcpu_sockets(); } @@ -462,6 +475,14 @@ this.mVdsDynamic.setcpu_speed_mh(value); } + public Boolean getvdsm_count_threads_as_cores() { + return this.mVdsDynamic.getvdsm_count_threads_as_cores(); + } + + public void setvdsm_count_threads_as_cores(Boolean value) { + this.mVdsDynamic.setvdsm_count_threads_as_cores(value); + } + public String getif_total_speed() { return this.mVdsDynamic.getif_total_speed(); } 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 afece18..e41048f 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 @@ -86,6 +86,9 @@ @Column(name = "max_vds_memory_over_commit") private int max_vds_memory_over_commit = 0; + @Column(name = "count_threads_as_cores") + private boolean count_threads_as_cores = false; + @Size(max = BusinessEntitiesDefinitions.GENERAL_VERSION_SIZE) @Column(name = "compatibility_version") private String compatibility_version; @@ -210,6 +213,14 @@ this.max_vds_memory_over_commit = value; } + public boolean getcount_threads_as_cores() { + return this.count_threads_as_cores; + } + + public void setcount_threads_as_cores(boolean value) { + this.count_threads_as_cores = value; + } + public Version getcompatibility_version() { return compatVersion; } @@ -235,7 +246,7 @@ private static final java.util.ArrayList<String> _vmProperties = new java.util.ArrayList<String>( java.util.Arrays.asList(new String[] { "name", "description", "cpu_name", "cpu_over_commit_duration_minutes", "low_utilization", "high_utilization", "selection_algorithm", - "max_vds_memory_over_commit", "storage_pool_id", "compatibility_version", + "max_vds_memory_over_commit", "max_cpu_over_commit", "storage_pool_id", "compatibility_version", "TransparentHugepages", "MigrateOnError" })); @Override @@ -283,6 +294,7 @@ result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + low_utilization; result = prime * result + max_vds_memory_over_commit; + result = prime * result + (count_threads_as_cores ? 1231 : 1237); result = prime * result + ((migrateOnError == null) ? 0 : migrateOnError.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((selection_algorithm == null) ? 0 : selection_algorithm.hashCode()); @@ -334,6 +346,8 @@ return false; if (max_vds_memory_over_commit != other.max_vds_memory_over_commit) return false; + if (count_threads_as_cores != other.count_threads_as_cores) + return false; if (migrateOnError != other.migrateOnError) return false; if (name == null) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java index 87d9bb1..a74addb 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java @@ -38,11 +38,17 @@ @Column(name = "cpu_cores") private Integer cpu_cores; + @Column(name = "cpu_ht_enabled") + private Boolean cpu_ht_enabled; + @Column(name = "cpu_model") private String cpu_model; @Column(name = "cpu_speed_mh", scale = 18, precision = 0) private BigDecimal cpu_speed_mh = BigDecimal.valueOf(0.0); + + @Column(name = "vdsm_count_threads_as_cores") + private Boolean vdsm_count_threads_as_cores; @Column(name = "if_total_speed") private String if_total_speed; @@ -166,7 +172,8 @@ transparentHugePagesState = VdsTransparentHugePagesState.Never; } - public VdsDynamic(Integer cpu_cores, String cpu_model, Double cpu_speed_mh, String if_total_speed, + public VdsDynamic(Integer cpu_cores, Boolean cpu_ht_enabled, + String cpu_model, Double cpu_speed_mh, Boolean vdsm_count_threads_as_cores, String if_total_speed, Boolean kvm_enabled, Integer mem_commited, Integer physical_mem_mb, int status, Guid vds_id, Integer vm_active, int vm_count, Integer vm_migrating, Integer reserved_mem, Integer guest_overhead, VDSStatus previous_status, String software_version, String version_name, String build_name, @@ -174,8 +181,10 @@ Integer pending_vmem_sizeField, Boolean net_config_dirty) { rpmVersion = new RpmVersion(); this.cpu_cores = cpu_cores; + this.cpu_ht_enabled = cpu_ht_enabled; this.cpu_model = cpu_model; this.cpu_speed_mh = BigDecimal.valueOf(cpu_speed_mh); + this.vdsm_count_threads_as_cores = vdsm_count_threads_as_cores; this.if_total_speed = if_total_speed; this.kvm_enabled = kvm_enabled; this.mem_commited = mem_commited; @@ -205,6 +214,14 @@ this.cpu_cores = value; } + public Boolean getcpu_ht_enabled() { + return this.cpu_ht_enabled; + } + + public void setcpu_ht_enabled(Boolean value) { + this.cpu_ht_enabled = value; + } + public Integer getcpu_sockets() { return this.cpu_sockets; } @@ -227,6 +244,14 @@ public void setcpu_speed_mh(Double value) { this.cpu_speed_mh = BigDecimal.valueOf(value); + } + + public Boolean getvdsm_count_threads_as_cores() { + return this.vdsm_count_threads_as_cores; + } + + public void setvdsm_count_threads_as_cores(Boolean value) { + this.vdsm_count_threads_as_cores = value; } public String getif_total_speed() { @@ -545,11 +570,13 @@ result = prime * result + anonymousHugePages; result = prime * result + ((buildName == null) ? 0 : buildName.hashCode()); result = prime * result + ((cpu_cores == null) ? 0 : cpu_cores.hashCode()); + result = prime * result + ((cpu_ht_enabled == null) ? 0 : cpu_ht_enabled.hashCode()); result = prime * result + ((cpu_flags == null) ? 0 : cpu_flags.hashCode()); result = prime * result + ((cpu_model == null) ? 0 : cpu_model.hashCode()); result = prime * result + ((cpu_over_commit_time_stamp == null) ? 0 : cpu_over_commit_time_stamp.hashCode()); result = prime * result + ((cpu_sockets == null) ? 0 : cpu_sockets.hashCode()); result = prime * result + ((cpu_speed_mh == null) ? 0 : cpu_speed_mh.hashCode()); + result = prime * result + ((vdsm_count_threads_as_cores == null) ? 0 : vdsm_count_threads_as_cores.hashCode()); result = prime * result + ((guest_overhead == null) ? 0 : guest_overhead.hashCode()); result = prime * result + ((hooksStr == null) ? 0 : hooksStr.hashCode()); result = prime * result + ((host_os == null) ? 0 : host_os.hashCode()); @@ -614,6 +641,11 @@ return false; } else if (!cpu_cores.equals(other.cpu_cores)) return false; + if (cpu_ht_enabled == null) { + if (other.cpu_ht_enabled != null) + return false; + } else if (!cpu_ht_enabled.equals(other.cpu_ht_enabled)) + return false; if (cpu_flags == null) { if (other.cpu_flags != null) return false; @@ -639,6 +671,11 @@ return false; } else if (!cpu_speed_mh.equals(other.cpu_speed_mh)) return false; + if (vdsm_count_threads_as_cores == null) { + if (other.vdsm_count_threads_as_cores != null) + return false; + } else if (!vdsm_count_threads_as_cores.equals(other.vdsm_count_threads_as_cores)) + return false; if (guest_overhead == null) { if (other.guest_overhead != null) return false; diff --git a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java index e020b0c..96ae36c 100644 --- a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java +++ b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java @@ -60,8 +60,10 @@ new Object[][] { { vdsStatic }, { new VdsDynamic(random.nextInt(), + random.nextBoolean(), random.nextString(10), random.nextDouble(), + random.nextBoolean(), random.nextString(10), random.nextBoolean(), random.nextInt(), diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java index 9c8d3fe..4cf850d 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java @@ -299,9 +299,11 @@ updateNetworkData(vds, xmlRpcStruct); vds.setcpu_cores(AssignIntValue(xmlRpcStruct, VdsProperties.cpu_cores)); + vds.setcpu_ht_enabled(AssignBoolValue(xmlRpcStruct, VdsProperties.cpu_ht_enabled)); vds.setcpu_sockets(AssignIntValue(xmlRpcStruct, VdsProperties.cpu_sockets)); vds.setcpu_model(AssignStringValue(xmlRpcStruct, VdsProperties.cpu_model)); vds.setcpu_speed_mh(AssignDoubleValue(xmlRpcStruct, VdsProperties.cpu_speed_mh)); + vds.setvdsm_count_threads_as_cores(AssignBoolValue(xmlRpcStruct, VdsProperties.vdsm_count_threads_as_cores)); vds.setphysical_mem_mb(AssignIntValue(xmlRpcStruct, VdsProperties.physical_mem_mb)); vds.setkvm_enabled(AssignBoolValue(xmlRpcStruct, VdsProperties.kvm_enabled)); 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 7dd9825..c5fada4 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 @@ -26,9 +26,11 @@ public static final String SpiceSecureChannels = "spiceSecureChannels"; public static final String cpu_cores = "cpuCores"; + public static final String cpu_ht_enabled = "cpuHtEnabled"; public static final String cpu_sockets = "cpuSockets"; public static final String cpu_model = "cpuModel"; public static final String cpu_speed_mh = "cpuSpeed"; + public static final String vdsm_count_threads_as_cores = "reportHostThreadsAsCores"; public static final String if_total_speed = "eth0Speed"; public static final String kvm_enabled = "kvmEnabled"; public static final String physical_mem_mb = "memSize"; -- To view, visit http://gerrit.ovirt.org/10167 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic0587423ad20529a5fdfd79050ea839ba1ddecf3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Padgett <gpadg...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches