Eli Mesika has uploaded a new change for review. Change subject: core: Skip fencing if network unstable ......................................................................
core: Skip fencing if network unstable Change-Id: I7a9c7db43b50421414ce9596137767b00cbfc2ae Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1120829 Signed-off-by: Eli Mesika <emes...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FencingPolicy.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/resources/fixtures.xml A packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_network_unstable.sql R packaging/dbscripts/upgrade/03_06_0130_skip_fencing_when_sd_is_alive.sql A packaging/dbscripts/upgrade/03_06_0160_skip_fencing_when_network_unstable.sql M packaging/dbscripts/vds_groups_sp.sql 7 files changed, 70 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/31303/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FencingPolicy.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FencingPolicy.java index 7f90645..bdeffdd 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FencingPolicy.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/FencingPolicy.java @@ -11,16 +11,22 @@ * Skip fencing of host of it's connected to at least one storage domain. */ private boolean skipFencingIfSDActive; + private boolean skipFencingIfNetworkUnstable; + private int hostsWithUnstableNetworkThreshold; public FencingPolicy() { skipFencingIfSDActive = false; + skipFencingIfNetworkUnstable = false; } public FencingPolicy(FencingPolicy fencingPolicy) { if (fencingPolicy == null) { skipFencingIfSDActive = false; + skipFencingIfNetworkUnstable = false; } else { skipFencingIfSDActive = fencingPolicy.skipFencingIfSDActive; + skipFencingIfNetworkUnstable = fencingPolicy.skipFencingIfNetworkUnstable; + hostsWithUnstableNetworkThreshold = fencingPolicy.hostsWithUnstableNetworkThreshold; } } @@ -32,6 +38,21 @@ this.skipFencingIfSDActive = skipFencingIfSDActive; } + public boolean isSkipFencingIfNetworkUnstable() { + return skipFencingIfNetworkUnstable; + } + + public void setSkipFencingIfNetworkUnstable(boolean skipFencingIfNetworkUnstable) { + this.skipFencingIfNetworkUnstable = skipFencingIfNetworkUnstable; + } + + public int getHostsWithUnstableNetworkThreshold() { + return hostsWithUnstableNetworkThreshold; + } + + public void setHostsWithUnstableNetworkThreshold(int hostsWithUnstableNetworkThreshold) { + this.hostsWithUnstableNetworkThreshold = hostsWithUnstableNetworkThreshold; + } @Override public boolean equals(Object obj) { if (this == obj) { @@ -42,7 +63,9 @@ } FencingPolicy other = (FencingPolicy) obj; - return skipFencingIfSDActive == other.skipFencingIfSDActive; + return skipFencingIfSDActive == other.skipFencingIfSDActive && + skipFencingIfNetworkUnstable == other.skipFencingIfNetworkUnstable && + hostsWithUnstableNetworkThreshold == other.hostsWithUnstableNetworkThreshold; } @Override @@ -50,6 +73,8 @@ final int prime = 31; int result = 1; result = prime * result + (skipFencingIfSDActive ? 1231 : 1237); + result = prime * result + (skipFencingIfNetworkUnstable ? 1231 : 1237); + result = prime * result + hostsWithUnstableNetworkThreshold; return result; } @@ -57,6 +82,10 @@ public String toString() { StringBuilder sb = new StringBuilder("{ skipFencingIfSDActive="); sb.append(skipFencingIfSDActive); + sb.append(", skipFencingIfNetworkUnstable="); + sb.append(skipFencingIfNetworkUnstable); + sb.append(", hostsWithUnstableNetworkThreshold="); + sb.append(hostsWithUnstableNetworkThreshold); sb.append(" }"); return sb.toString(); } 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 abfc3f2..6d3c19f 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 @@ -229,7 +229,9 @@ .addValue("spice_proxy", group.getSpiceProxy()) .addValue("serial_number_policy", group.getSerialNumberPolicy() == null ? null : group.getSerialNumberPolicy().getValue()) .addValue("custom_serial_number", group.getCustomSerialNumber()) - .addValue("skip_fencing_if_sd_active", group.getFencingPolicy().isSkipFencingIfSDActive()); + .addValue("skip_fencing_if_sd_active", group.getFencingPolicy().isSkipFencingIfSDActive()) + .addValue("skip_fencing_if_network_unstable", group.getFencingPolicy().isSkipFencingIfNetworkUnstable()) + .addValue("hosts_with_unstable_network_threshold", group.getFencingPolicy().getHostsWithUnstableNetworkThreshold()); return parameterSource; } @@ -291,6 +293,8 @@ entity.setSerialNumberPolicy(SerialNumberPolicy.forValue((Integer) rs.getObject("serial_number_policy"))); entity.setCustomSerialNumber(rs.getString("custom_serial_number")); entity.getFencingPolicy().setSkipFencingIfSDActive(rs.getBoolean("skip_fencing_if_sd_active")); + entity.getFencingPolicy().setSkipFencingIfNetworkUnstable(rs.getBoolean("skip_fencing_if_network_unstable")); + entity.getFencingPolicy().setHostsWithUnstableNetworkThreshold(rs.getInt("hosts_with_unstable_network_threshold")); return entity; } diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index 8de6a8e..928693e 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -743,6 +743,8 @@ <column>custom_serial_number</column> <column>required_rng_sources</column> <column>skip_fencing_if_sd_active</column> + <column>skip_fencing_if_network_unstable</column> + <column>hosts_with_unstable_network_threshold</column> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> <value>rhel6.iscsi</value> @@ -769,6 +771,8 @@ <null /> <value>RANDOM</value> <value>false</value> + <value>false</value> + <value>50</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d2</value> @@ -796,6 +800,8 @@ <null /> <value></value> <value>true</value> + <value>false</value> + <value>50</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d3</value> @@ -823,6 +829,8 @@ <null /> <value>HWRNG</value> <value>false</value> + <value>false</value> + <value>50</value> </row> <row> <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> @@ -850,6 +858,8 @@ <value>my custom serial number</value> <value>HWRNG,RANDOM</value> <value>true</value> + <value>false</value> + <value>50</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7c</value> @@ -877,6 +887,8 @@ <null /> <value>HWRNG,RANDOM</value> <value>false</value> + <value>false</value> + <value>50</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7d</value> @@ -904,6 +916,8 @@ <null /> <value>HWRNG,RANDOM</value> <value>false</value> + <value>false</value> + <value>50</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7e</value> @@ -931,6 +945,8 @@ <null /> <value>RANDOM</value> <value>true</value> + <value>false</value> + <value>50</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7f</value> @@ -958,6 +974,8 @@ <null /> <value>RANDOM</value> <value>false</value> + <value>false</value> + <value>50</value> </row> <row> <value>ae956031-6be2-43d6-bb8f-5191c9253314</value> @@ -985,6 +1003,8 @@ <null /> <value>RANDOM</value> <value>true</value> + <value>true</value> + <value>50</value> </row> </table> diff --git a/packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_network_unstable.sql b/packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_network_unstable.sql new file mode 100644 index 0000000..603bb06 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_network_unstable.sql @@ -0,0 +1,2 @@ +SELECT fn_db_add_column('vds_groups', 'skip_fencing_if_network_unstable', 'boolean DEFAULT false'); +SELECT fn_db_add_column('vds_groups', 'hosts_with_unstable_network_threshold', 'smallint DEFAULT 50'); diff --git a/packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_sd_is_alive.sql b/packaging/dbscripts/upgrade/03_06_0130_skip_fencing_when_sd_is_alive.sql similarity index 100% rename from packaging/dbscripts/upgrade/03_06_0120_skip_fencing_when_sd_is_alive.sql rename to packaging/dbscripts/upgrade/03_06_0130_skip_fencing_when_sd_is_alive.sql diff --git a/packaging/dbscripts/upgrade/03_06_0160_skip_fencing_when_network_unstable.sql b/packaging/dbscripts/upgrade/03_06_0160_skip_fencing_when_network_unstable.sql new file mode 100644 index 0000000..603bb06 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0160_skip_fencing_when_network_unstable.sql @@ -0,0 +1,2 @@ +SELECT fn_db_add_column('vds_groups', 'skip_fencing_if_network_unstable', 'boolean DEFAULT false'); +SELECT fn_db_add_column('vds_groups', 'hosts_with_unstable_network_threshold', 'smallint DEFAULT 50'); diff --git a/packaging/dbscripts/vds_groups_sp.sql b/packaging/dbscripts/vds_groups_sp.sql index 8831824..305e34f 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -37,17 +37,19 @@ v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_required_rng_sources varchar(255), - v_skip_fencing_if_sd_active BOOLEAN + v_skip_fencing_if_sd_active BOOLEAN, + v_skip_fencing_if_network_unstable BOOLEAN, + v_hosts_with_unstable_network_threshold SMALLINT ) 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, optional_reason, 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) + 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_network_unstable, hosts_with_unstable_network_threshold) 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_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_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_network_unstable, v_hosts_with_unstable_network_threshold); END; $procedure$ LANGUAGE plpgsql; @@ -84,7 +86,9 @@ v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_required_rng_sources varchar(255), - v_skip_fencing_if_sd_active BOOLEAN + v_skip_fencing_if_sd_active BOOLEAN, + v_skip_fencing_if_network_unstable BOOLEAN, + v_hosts_with_unstable_network_threshold SMALLINT ) RETURNS VOID @@ -104,7 +108,9 @@ optimization_type = v_optimization_type, spice_proxy = v_spice_proxy, enable_ksm = v_enable_ksm, serial_number_policy = v_serial_number_policy, custom_serial_number = v_custom_serial_number, required_rng_sources = v_required_rng_sources, - skip_fencing_if_sd_active = v_skip_fencing_if_sd_active + skip_fencing_if_sd_active = v_skip_fencing_if_sd_active, + skip_fencing_if_network_unstable = v_skip_fencing_if_network_unstable, + hosts_with_unstable_network_threshold = v_hosts_with_unstable_network_threshold WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/31303 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a9c7db43b50421414ce9596137767b00cbfc2ae Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches