Martin Peřina has uploaded a new change for review. Change subject: core: Add option disable fencing in cluster ......................................................................
core: Add option disable fencing in cluster Adds option to cluster fencing policy which disabled fencing for all hosts in cluster. By default fencing in cluster is enabled. Change-Id: I587d7d40bc010196f916525ec3da7b1d821689d9 Bug-Url: https://bugzilla.redhat.com/1120858 Signed-off-by: Martin Perina <[email protected]> --- 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_05_0910_disable_fencing_in_cluster.sql M packaging/dbscripts/vds_groups_sp.sql 5 files changed, 45 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/31650/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 edf0055..6813c8c 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 @@ -8,6 +8,11 @@ */ public class FencingPolicy implements Serializable { /** + * Enable fencing + */ + private boolean fencingEnabled; + + /** * Skip fencing of host of it's connected to at least one storage domain. */ private boolean skipFencingIfSDActive; @@ -15,6 +20,7 @@ private int hostsWithBrokenConnectivityThreshold; public FencingPolicy() { + fencingEnabled = true; skipFencingIfSDActive = false; skipFencingIfConnectivityBroken = false; hostsWithBrokenConnectivityThreshold = 50; @@ -22,13 +28,23 @@ public FencingPolicy(FencingPolicy fencingPolicy) { if (fencingPolicy == null) { + fencingEnabled = true; skipFencingIfSDActive = false; skipFencingIfConnectivityBroken = false; } else { + fencingEnabled = fencingPolicy.fencingEnabled; skipFencingIfSDActive = fencingPolicy.skipFencingIfSDActive; skipFencingIfConnectivityBroken = fencingPolicy.skipFencingIfConnectivityBroken; hostsWithBrokenConnectivityThreshold = fencingPolicy.hostsWithBrokenConnectivityThreshold; } + } + + public boolean isFencingEnabled() { + return fencingEnabled; + } + + public void setFencingEnabled(boolean fencingEnabled) { + this.fencingEnabled = fencingEnabled; } public boolean isSkipFencingIfSDActive() { @@ -64,7 +80,8 @@ } FencingPolicy other = (FencingPolicy) obj; - return skipFencingIfSDActive == other.skipFencingIfSDActive && + return fencingEnabled == other.fencingEnabled && + skipFencingIfSDActive == other.skipFencingIfSDActive && skipFencingIfConnectivityBroken == other.skipFencingIfConnectivityBroken && hostsWithBrokenConnectivityThreshold == other.hostsWithBrokenConnectivityThreshold; } @@ -73,6 +90,7 @@ public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + (fencingEnabled ? 1231 : 1237); result = prime * result + (skipFencingIfSDActive ? 1231 : 1237); result = prime * result + (skipFencingIfConnectivityBroken ? 1231 : 1237); result = prime * result + hostsWithBrokenConnectivityThreshold; @@ -81,7 +99,9 @@ @Override public String toString() { - StringBuilder sb = new StringBuilder("{ skipFencingIfSDActive="); + StringBuilder sb = new StringBuilder("{ fencingEnabled="); + sb.append(fencingEnabled); + sb.append(", skipFencingIfSDActive="); sb.append(skipFencingIfSDActive); sb.append(", skipFencingIfConnectivityBroken="); sb.append(skipFencingIfConnectivityBroken); 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 7c6d778..57b6607 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 @@ -231,7 +231,8 @@ .addValue("custom_serial_number", group.getCustomSerialNumber()) .addValue("skip_fencing_if_sd_active", group.getFencingPolicy().isSkipFencingIfSDActive()) .addValue("skip_fencing_if_connectivity_broken", group.getFencingPolicy().isSkipFencingIfConnectivityBroken()) - .addValue("hosts_with_broken_connectivity_threshold", group.getFencingPolicy().getHostsWithBrokenConnectivityThreshold()); + .addValue("hosts_with_broken_connectivity_threshold", group.getFencingPolicy().getHostsWithBrokenConnectivityThreshold()) + .addValue("fencing_enabled", group.getFencingPolicy().isFencingEnabled()); return parameterSource; } @@ -295,6 +296,7 @@ entity.getFencingPolicy().setSkipFencingIfSDActive(rs.getBoolean("skip_fencing_if_sd_active")); entity.getFencingPolicy().setSkipFencingIfConnectivityBroken(rs.getBoolean("skip_fencing_if_connectivity_broken")); entity.getFencingPolicy().setHostsWithBrokenConnectivityThreshold(rs.getInt("hosts_with_broken_connectivity_threshold")); + entity.getFencingPolicy().setFencingEnabled(rs.getBoolean("fencing_enabled")); 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 f02e928..4454a67 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -671,6 +671,7 @@ <column>skip_fencing_if_sd_active</column> <column>skip_fencing_if_connectivity_broken</column> <column>hosts_with_broken_connectivity_threshold</column> + <column>fencing_enabled</column> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> <value>rhel6.iscsi</value> @@ -699,6 +700,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d2</value> @@ -728,6 +730,7 @@ <value>true</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d3</value> @@ -757,6 +760,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> @@ -786,6 +790,7 @@ <value>true</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7c</value> @@ -815,6 +820,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7d</value> @@ -844,6 +850,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>false</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7e</value> @@ -873,6 +880,7 @@ <value>true</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7f</value> @@ -902,6 +910,7 @@ <value>false</value> <value>false</value> <value>50</value> + <value>true</value> </row> <row> <value>ae956031-6be2-43d6-bb8f-5191c9253314</value> @@ -931,6 +940,7 @@ <value>true</value> <value>true</value> <value>50</value> + <value>false</value> </row> </table> diff --git a/packaging/dbscripts/upgrade/03_05_0910_disable_fencing_in_cluster.sql b/packaging/dbscripts/upgrade/03_05_0910_disable_fencing_in_cluster.sql new file mode 100644 index 0000000..d7a7d8f --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_0910_disable_fencing_in_cluster.sql @@ -0,0 +1,2 @@ +-- By default set to false not to break upgrade +SELECT fn_db_add_column('vds_groups', 'fencing_enabled', 'boolean DEFAULT true'); diff --git a/packaging/dbscripts/vds_groups_sp.sql b/packaging/dbscripts/vds_groups_sp.sql index aae26fe..10d7dac 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -39,17 +39,18 @@ v_required_rng_sources varchar(255), v_skip_fencing_if_sd_active BOOLEAN, v_skip_fencing_if_connectivity_broken BOOLEAN, - v_hosts_with_broken_connectivity_threshold SMALLINT + v_hosts_with_broken_connectivity_threshold SMALLINT, + v_fencing_enabled 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, 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, skip_fencing_if_connectivity_broken, hosts_with_broken_connectivity_threshold) + 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) 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_skip_fencing_if_connectivity_broken, v_hosts_with_broken_connectivity_threshold); + 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); END; $procedure$ LANGUAGE plpgsql; @@ -88,7 +89,8 @@ v_required_rng_sources varchar(255), v_skip_fencing_if_sd_active BOOLEAN, v_skip_fencing_if_connectivity_broken BOOLEAN, - v_hosts_with_broken_connectivity_threshold SMALLINT + v_hosts_with_broken_connectivity_threshold SMALLINT, + v_fencing_enabled BOOLEAN ) RETURNS VOID @@ -110,7 +112,8 @@ required_rng_sources = v_required_rng_sources, skip_fencing_if_sd_active = v_skip_fencing_if_sd_active, skip_fencing_if_connectivity_broken = v_skip_fencing_if_connectivity_broken, - hosts_with_broken_connectivity_threshold = v_hosts_with_broken_connectivity_threshold + hosts_with_broken_connectivity_threshold = v_hosts_with_broken_connectivity_threshold, + fencing_enabled = v_fencing_enabled WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/31650 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I587d7d40bc010196f916525ec3da7b1d821689d9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Martin Peřina <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
