Oved Ourfali has uploaded a new change for review. Change subject: core: adding HA score with proper scheduling policies ......................................................................
core: adding HA score with proper scheduling policies This patch adds the HA score to VdsStatistics, filling it up where relevant, and using it when scheduling the hosted engine VM. Change-Id: I24879ed64cab829969556fd71786b32d3aaaf0c7 Signed-off-by: Oved Ourfali <oourf...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterFilterPolicyUnit.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterWeightPolicyUnit.java 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/VdsStatistics.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M backend/manager/modules/dal/src/test/resources/fixtures.xml M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.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 M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M packaging/dbscripts/create_views.sql A packaging/dbscripts/upgrade/03_03_0980_add_ha_score_to_vds_statistics.sql A packaging/dbscripts/upgrade/03_03_0990_add_ha_policy_units.sql M packaging/dbscripts/vds_sp.sql 20 files changed, 169 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/20234/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java index a93d8cb..9711328 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java @@ -9,6 +9,8 @@ import org.ovirt.engine.core.bll.scheduling.policyunits.CpuLevelFilterPolicyUnit; import org.ovirt.engine.core.bll.scheduling.policyunits.EvenDistributionBalancePolicyUnit; import org.ovirt.engine.core.bll.scheduling.policyunits.EvenDistributionWeightPolicyUnit; +import org.ovirt.engine.core.bll.scheduling.policyunits.HostedEngineHAClusterFilterPolicyUnit; +import org.ovirt.engine.core.bll.scheduling.policyunits.HostedEngineHAClusterWeightPolicyUnit; import org.ovirt.engine.core.bll.scheduling.policyunits.MemoryPolicyUnit; import org.ovirt.engine.core.bll.scheduling.policyunits.NetworkPolicyUnit; import org.ovirt.engine.core.bll.scheduling.policyunits.NoneBalancePolicyUnit; @@ -41,6 +43,12 @@ return new MemoryPolicyUnit(policyUnit); case "Network": return new NetworkPolicyUnit(policyUnit); + case "HA": + if (policyUnit.getPolicyUnitType() == PolicyUnitType.Weight) { + return new HostedEngineHAClusterWeightPolicyUnit(policyUnit); + } else if (policyUnit.getPolicyUnitType() == PolicyUnitType.Filter) { + return new HostedEngineHAClusterFilterPolicyUnit(policyUnit); + } case "CPU-Level": return new CpuLevelFilterPolicyUnit(policyUnit); case "None": diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterFilterPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterFilterPolicyUnit.java new file mode 100644 index 0000000..ef3e95f --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterFilterPolicyUnit.java @@ -0,0 +1,46 @@ +package org.ovirt.engine.core.bll.scheduling.policyunits; + +import org.ovirt.engine.core.bll.scheduling.PolicyUnitImpl; +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VM; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.common.scheduling.PolicyUnit; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HostedEngineHAClusterFilterPolicyUnit extends PolicyUnitImpl { + public HostedEngineHAClusterFilterPolicyUnit(PolicyUnit policyUnit) { + super(policyUnit); + } + + @Override + public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { + + // The filter is relevant only for Hosted Engine VM + if (vm.isHostedEngine()) { + + List<VDS> hostsToRunOn = new ArrayList<VDS>(); + for (VDS host : hosts) { + int haScore = host.getHighlyAvailableScore(); + if (haScore > 0) { + hostsToRunOn.add(host); + log.debugFormat("Host {0} wasn't filtered out as it has a score of {1}", + host.getName(), + haScore); + } else { + log.debugFormat("Host {0} was filtered out as it doesn't have a positive score (the score is {1})", host.getName(), haScore); + } + } + + if (hostsToRunOn.isEmpty()) { + messages.add(VdcBllMessages.ACTION_TYPE_FAILED_NO_HA_VDS.name()); + } + + return hostsToRunOn; + } else { + return hosts; + } + } +} diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterWeightPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterWeightPolicyUnit.java new file mode 100644 index 0000000..b42d1dd --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/HostedEngineHAClusterWeightPolicyUnit.java @@ -0,0 +1,45 @@ +package org.ovirt.engine.core.bll.scheduling.policyunits; + +import org.ovirt.engine.core.bll.scheduling.PolicyUnitImpl; +import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.VM; +import org.ovirt.engine.core.common.scheduling.PolicyUnit; +import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.compat.Guid; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HostedEngineHAClusterWeightPolicyUnit extends PolicyUnitImpl { + private static int DEFAULT_WEIGHT = 1; + private static int MAXIMUM_HA_SCORE = 2400; + + public HostedEngineHAClusterWeightPolicyUnit(PolicyUnit policyUnit) { + super(policyUnit); + } + + void fillDefaultScores(List<VDS> hosts, List<Pair<Guid, Integer>> scores) { + for (VDS host : hosts) { + scores.add(new Pair<Guid, Integer>(host.getId(), DEFAULT_WEIGHT)); + } + } + + @Override + public List<Pair<Guid, Integer>> score(List<VDS> hosts, VM vm, Map<String, String> parameters) { + List<Pair<Guid, Integer>> scores = new ArrayList<Pair<Guid, Integer>>(); + boolean isHostedEngine = vm.isHostedEngine(); + + if (isHostedEngine) { + // If the max HA score is higher than the max weight, then we normalize. Otherwise the ratio is 1, keeping the value as is + float ratio = MAXIMUM_HA_SCORE > MaxSchedulerWeight ? ((float) MaxSchedulerWeight / MAXIMUM_HA_SCORE) : 1; + for (VDS host : hosts) { + scores.add(new Pair<Guid, Integer>(host.getId(), MaxSchedulerWeight - Math.round(host.getHighlyAvailableScore() * ratio))); + } + } else { + fillDefaultScores(hosts, scores); + } + return scores; + } + +} 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 dd2baee..952478e 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 @@ -556,6 +556,14 @@ this.mVdsDynamic.setvm_active(value); } + public Integer getHighlyAvailableScore() { + return this.mVdsStatistics.getHighlyAvailableScore(); + } + + public void setHighlyAvailableScore(Integer value) { + this.mVdsStatistics.setHighlyAvailableScore(value); + } + public int getVmCount() { return this.mVdsDynamic.getvm_count(); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java index bea873b..457377e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsStatistics.java @@ -24,6 +24,10 @@ private Integer ksm_cpu_percent; private Long ksm_pages; private Boolean ksm_state; + // Score in a hosted engine environment + // Score 0 means no HA agents are on this host + // Positive score means there is an agent + private Integer highlyAvailableScore; public VdsStatistics() { this.cpu_idle = BigDecimal.ZERO; @@ -36,6 +40,7 @@ swap_free = 0L; swap_total = 0L; ksm_pages = 0L; + highlyAvailableScore = 0; } @Override @@ -57,6 +62,7 @@ result = prime * result + ((ksm_cpu_percent == null) ? 0 : ksm_cpu_percent.hashCode()); result = prime * result + ((swap_total == null) ? 0 : swap_total.hashCode()); result = prime * result + ((swap_free == null) ? 0 : swap_free.hashCode()); + result = prime * result + ((highlyAvailableScore == null) ? 0 : highlyAvailableScore.hashCode()); return result; } @@ -86,7 +92,8 @@ && ObjectUtils.objectsEqual(ksm_pages, other.ksm_pages) && ObjectUtils.objectsEqual(ksm_cpu_percent, other.ksm_cpu_percent) && ObjectUtils.objectsEqual(swap_total, other.swap_total) - && ObjectUtils.objectsEqual(swap_free, other.swap_free)); + && ObjectUtils.objectsEqual(swap_free, other.swap_free) + && ObjectUtils.objectsEqual(highlyAvailableScore, other.highlyAvailableScore)); } public Double getcpu_idle() { @@ -232,4 +239,12 @@ this.ksm_state = value; } + public Integer getHighlyAvailableScore() { + return highlyAvailableScore; + } + + public void setHighlyAvailableScore(Integer value) { + highlyAvailableScore = value; + } + } 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 a5d6f6e..3aaf8a6 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 @@ -182,6 +182,7 @@ ACTION_TYPE_FAILED_VDS_VM_CPU_LEVEL(ErrorType.CONFLICT), ACTION_TYPE_FAILED_VDS_VM_NETWORKS(ErrorType.CONFLICT), ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK(ErrorType.CONFLICT), + ACTION_TYPE_FAILED_NO_HA_VDS(ErrorType.CONFLICT), ACTION_TYPE_FAILED_NO_VDS_AVAILABLE_IN_CLUSTER(ErrorType.CONFLICT), ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE(ErrorType.CONFLICT), ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE(ErrorType.CONFLICT), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java index 2b09bfb..e5d1662 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDAODbFacadeImpl.java @@ -337,6 +337,7 @@ entity.setHBAs(new JsonObjectDeserializer().deserialize(rs.getString("hbas"), HashMap.class)); entity.setConsoleAddress(rs.getString("console_address")); entity.setSupportedEmulatedMachines(rs.getString("supported_emulated_machines")); + entity.setHighlyAvailableScore(rs.getInt("ha_score")); entity.calculateFreeVirtualMemory(); return entity; } diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java index aa0cf9b..a1244a8 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsStatisticsDAODbFacadeImpl.java @@ -78,7 +78,8 @@ .addValue("swap_total", stats.getswap_total()) .addValue("ksm_cpu_percent", stats.getksm_cpu_percent()) .addValue("ksm_pages", stats.getksm_pages()) - .addValue("ksm_state", stats.getksm_state()); + .addValue("ksm_state", stats.getksm_state()) + .addValue("ha_score", stats.getHighlyAvailableScore()); getCallsHandler().executeModification("InsertVdsStatistics", parameterSource); } @@ -102,7 +103,8 @@ .addValue("swap_total", stats.getswap_total()) .addValue("ksm_cpu_percent", stats.getksm_cpu_percent()) .addValue("ksm_pages", stats.getksm_pages()) - .addValue("ksm_state", stats.getksm_state()); + .addValue("ksm_state", stats.getksm_state()) + .addValue("ha_score", stats.getHighlyAvailableScore()); getCallsHandler().executeModification("UpdateVdsStatistics", parameterSource); } 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 4326536..e014df0 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -192,6 +192,7 @@ ACTION_TYPE_FAILED_VDS_VM_CPU_LEVEL=Cannot ${action} ${type}. The host has lower CPU level than the VM was run with. ACTION_TYPE_FAILED_VDS_VM_NETWORKS=Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM. ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK=Cannot ${action} ${type}. There are no available running Hosts with the cluster's display network. +ACTION_TYPE_FAILED_NO_HA_VDS=Cannot ${action} ${type}. There are no available HA hosts in the VM's Cluster. CANNOT_MAINTENANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS=The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}. Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}. ACTION_TYPE_FAILED_VDS_VM_VERSION=Cannot ${action} ${type}. VM's tools version (${toolsVersion}) mismatch with the Host's (${serverVersion}) version. diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index a24b2d9..4489964 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -2314,6 +2314,7 @@ <column>ksm_pages</column> <column>ksm_state</column> <column>_update_date</column> + <column>ha_score</column> <row> <value>afce7a39-8e8c-4819-ba9c-796d316592e6</value> <value>100</value> @@ -2331,6 +2332,7 @@ <value>64</value> <value>0</value> <null /> + <value>0</value> </row> <row> <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value> @@ -2349,6 +2351,7 @@ <value>64</value> <value>0</value> <null /> + <value>0</value> </row> <row> <value>afce7a39-8e8c-4819-ba9c-796d316592e8</value> @@ -2367,6 +2370,7 @@ <value>64</value> <value>0</value> <null /> + <value>0</value> </row> <row> <value>23f6d691-5dfb-472b-86dc-9e1d2d3c18f3</value> @@ -2385,6 +2389,7 @@ <value>64</value> <value>0</value> <null /> + <value>0</value> </row> <row> <value>2001751e-549b-4e7a-aff6-32d36856c125</value> @@ -2403,6 +2408,7 @@ <value>64</value> <value>0</value> <null /> + <value>0</value> </row> </table> diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index 2b64237..62efa31 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -21,6 +21,7 @@ import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.DiskImageDynamic; import org.ovirt.engine.core.common.businessentities.Entities; +import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.OriginType; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; @@ -1567,6 +1568,7 @@ if (StringUtils.equals(HOSTED_ENGINE_VM_NAME, vmNameOnHost)) { vmStatic.setName(vmNameOnHost); vmStatic.setOrigin(OriginType.HOSTED_ENGINE); + vmStatic.setMigrationSupport(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); } else { vmStatic.setName(String.format(EXTERNAL_VM_NAME_FORMAT, vmNameOnHost)); vmStatic.setOrigin(OriginType.EXTERNAL); 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 e1e6ae5..bfc5820 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 @@ -627,6 +627,8 @@ vds.setVmMigrating(AssignIntValue(xmlRpcStruct, VdsProperties.vm_migrating)); updateVDSDomainData(vds, xmlRpcStruct); updateLocalDisksUsage(vds, xmlRpcStruct); + Integer haScore = AssignIntValue(xmlRpcStruct, VdsProperties.ha_score); + vds.setHighlyAvailableScore(haScore != null ? haScore : 0); } /** 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 e388ab4..209db3c 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 @@ -66,6 +66,7 @@ public static final String vm_migrating = "vmMigrating"; public static final String images_last_check = "imagesLastCheck"; public static final String images_last_delay = "imagesLastDelay"; + public static final String ha_score = "haScore"; public static final String INTERFACE = "iface"; 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 b06dc95..02787c3 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 @@ -517,6 +517,9 @@ @DefaultStringValue("Cannot ${action} ${type}. There are no available running Hosts with the cluster's display network.") String ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK(); + @DefaultStringValue("Cannot ${action} ${type}. There are no available HA hosts in the VM's Cluster.") + String ACTION_TYPE_FAILED_NO_HA_VDS(); + @DefaultStringValue("The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}.Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}.") String CANNOT_MAINTENANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS(); diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index d621b8c..b73d738 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -188,6 +188,7 @@ ACTION_TYPE_FAILED_VDS_VM_CPU_LEVEL=Cannot ${action} ${type}. The host has lower CPU level than the VM was run with. ACTION_TYPE_FAILED_VDS_VM_NETWORKS=Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM. ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK=Cannot ${action} ${type}. There are no available running Hosts with the cluster's display network. +ACTION_TYPE_FAILED_NO_HA_VDS=Cannot ${action} ${type}. There are no available HA hosts in the VM's Cluster. CANNOT_MAINTENANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS=The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}. Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}. ACTION_TYPE_FAILED_VDS_VM_VERSION=Cannot ${action} ${type}. VM's tools version (${toolsVersion}) mismatch with the Host's (${serverVersion}) version. 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 e042e4f..53bf5e1 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 @@ -190,6 +190,7 @@ ACTION_TYPE_FAILED_VDS_VM_CPU_LEVEL=Cannot ${action} ${type}. The host has lower CPU level than the VM was run with. ACTION_TYPE_FAILED_VDS_VM_NETWORKS=Cannot ${action} ${type}. There are no available running Hosts with all the networks used by the VM. ACTION_TYPE_FAILED_MISSING_DISPLAY_NETWORK=Cannot ${action} ${type}. There are no available running Hosts with the cluster's display network. +ACTION_TYPE_FAILED_NO_HA_VDS=Cannot ${action} ${type}. There are no available HA hosts in the VM's Cluster. CANNOT_MAINTENANCE_VDS_RUN_VMS_NO_OTHER_RUNNING_VDS=The following Hosts have running VMs and cannot be switched to maintenance mode: ${HostsList}. Please ensure that the following Clusters have at least one Host in UP state: ${ClustersList}. ACTION_TYPE_FAILED_VDS_VM_VERSION=Cannot ${action} ${type}. VM's tools version (${toolsVersion}) mismatch with the Host's (${serverVersion}) version. diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index b3893b4..94874a2 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -668,7 +668,7 @@ vds_dynamic.transparent_hugepages_state as transparent_hugepages_state, vds_dynamic.anonymous_hugepages as anonymous_hugepages, vds_dynamic.non_operational_reason as non_operational_reason, vds_static.recoverable as recoverable, vds_static.sshKeyFingerprint as sshKeyFingerprint, vds_dynamic.hw_manufacturer as hw_manufacturer, vds_dynamic.hw_product_name as hw_product_name, vds_dynamic.hw_version as hw_version, vds_dynamic.hw_serial_number as hw_serial_number, vds_dynamic.hw_uuid as hw_uuid, vds_dynamic.hw_family as hw_family, vds_static.console_address as console_address, - vds_dynamic.hbas as hbas, vds_dynamic.supported_emulated_machines as supported_emulated_machines, vds_static.ssh_port as ssh_port, vds_static.ssh_username as ssh_username + vds_dynamic.hbas as hbas, vds_dynamic.supported_emulated_machines as supported_emulated_machines, vds_static.ssh_port as ssh_port, vds_static.ssh_username as ssh_username, vds_statistics.ha_score as ha_score FROM vds_groups INNER JOIN vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN @@ -709,7 +709,7 @@ vds_groups.compatibility_version AS vds_group_compatibility_version, vds_dynamic.host_os, vds_dynamic.kvm_version, vds_dynamic.libvirt_version, vds_dynamic.spice_version, vds_dynamic.kernel_version, vds_dynamic.iscsi_initiator_name, vds_dynamic.transparent_hugepages_state, vds_dynamic.anonymous_hugepages, vds_dynamic.non_operational_reason, - storage_pool_iso_map.storage_id, vds_static.ssh_port, vds_static.ssh_username + storage_pool_iso_map.storage_id, vds_static.ssh_port, vds_static.ssh_username, vds_statistics.ha_score as ha_score FROM vds_groups INNER JOIN vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN diff --git a/packaging/dbscripts/upgrade/03_03_0980_add_ha_score_to_vds_statistics.sql b/packaging/dbscripts/upgrade/03_03_0980_add_ha_score_to_vds_statistics.sql new file mode 100644 index 0000000..d7c2176 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_03_0980_add_ha_score_to_vds_statistics.sql @@ -0,0 +1,3 @@ + +select fn_db_add_column('vds_statistics', 'ha_score', 'INTEGER NOT NULL DEFAULT 0'); + diff --git a/packaging/dbscripts/upgrade/03_03_0990_add_ha_policy_units.sql b/packaging/dbscripts/upgrade/03_03_0990_add_ha_policy_units.sql new file mode 100644 index 0000000..e0391b3 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_03_0990_add_ha_policy_units.sql @@ -0,0 +1,11 @@ + +INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('e659c871-0bf1-4ccc-b748-f28f5d08dffd', 'HA', true, NULL, 0, true, 'Runs the hosted engine VM only on hosts with a positive score'); +INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('98e92667-6161-41fb-b3fa-34f820ccbc4b', 'HA', true, NULL, 1, true, 'Weights hosts according to their HA score'); + +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); + +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); +INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); diff --git a/packaging/dbscripts/vds_sp.sql b/packaging/dbscripts/vds_sp.sql index 5781ce9..fbf9aea 100644 --- a/packaging/dbscripts/vds_sp.sql +++ b/packaging/dbscripts/vds_sp.sql @@ -23,14 +23,15 @@ v_swap_total BIGINT , v_ksm_cpu_percent INTEGER , v_ksm_pages BIGINT , - v_ksm_state BOOLEAN) + v_ksm_state BOOLEAN, + v_ha_score INTEGER) RETURNS VOID AS $procedure$ BEGIN BEGIN -INSERT INTO vds_statistics(cpu_idle, cpu_load, cpu_sys, cpu_user, usage_cpu_percent, usage_mem_percent, usage_network_percent, vds_id, mem_available, mem_free, mem_shared,swap_free,swap_total,ksm_cpu_percent,ksm_pages,ksm_state) - VALUES(v_cpu_idle, v_cpu_load, v_cpu_sys, v_cpu_user, v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_vds_id, v_mem_available, v_mem_free, v_mem_shared,v_swap_free,v_swap_total,v_ksm_cpu_percent,v_ksm_pages,v_ksm_state); +INSERT INTO vds_statistics(cpu_idle, cpu_load, cpu_sys, cpu_user, usage_cpu_percent, usage_mem_percent, usage_network_percent, vds_id, mem_available, mem_free, mem_shared,swap_free,swap_total,ksm_cpu_percent,ksm_pages,ksm_state, ha_score) + VALUES(v_cpu_idle, v_cpu_load, v_cpu_sys, v_cpu_user, v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_vds_id, v_mem_available, v_mem_free, v_mem_shared,v_swap_free,v_swap_total,v_ksm_cpu_percent,v_ksm_pages,v_ksm_state, v_ha_score); END; RETURN; @@ -56,7 +57,8 @@ v_swap_total BIGINT , v_ksm_cpu_percent INTEGER , v_ksm_pages BIGINT , - v_ksm_state BOOLEAN) + v_ksm_state BOOLEAN, + v_ha_score INTEGER) RETURNS VOID --The [vds_dynamic] table doesn't have a timestamp column. Optimistic concurrency logic cannot be generated @@ -70,7 +72,7 @@ usage_network_percent = v_usage_network_percent, mem_available = v_mem_available, mem_free = v_mem_free, mem_shared = v_mem_shared, swap_free = v_swap_free,swap_total = v_swap_total,ksm_cpu_percent = v_ksm_cpu_percent, - ksm_pages = v_ksm_pages,ksm_state = v_ksm_state, _update_date = LOCALTIMESTAMP + ksm_pages = v_ksm_pages,ksm_state = v_ksm_state, ha_score = v_ha_score, _update_date = LOCALTIMESTAMP WHERE vds_id = v_vds_id; END; -- To view, visit http://gerrit.ovirt.org/20234 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I24879ed64cab829969556fd71786b32d3aaaf0c7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Oved Ourfali <oourf...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches