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_06_0140_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/55/31255/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..c435502 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,20 +8,36 @@ */ 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; public FencingPolicy() { + fencingEnabled = true; skipFencingIfSDActive = false; } public FencingPolicy(FencingPolicy fencingPolicy) { if (fencingPolicy == null) { + fencingEnabled = true; skipFencingIfSDActive = false; } else { + fencingEnabled = fencingPolicy.fencingEnabled; skipFencingIfSDActive = fencingPolicy.skipFencingIfSDActive; } + } + + public boolean isFencingEnabled() { + return fencingEnabled; + } + + public void setFencingEnabled(boolean fencingEnabled) { + this.fencingEnabled = fencingEnabled; } public boolean isSkipFencingIfSDActive() { @@ -42,20 +58,24 @@ } FencingPolicy other = (FencingPolicy) obj; - return skipFencingIfSDActive == other.skipFencingIfSDActive; + return fencingEnabled == other.fencingEnabled && + skipFencingIfSDActive == other.skipFencingIfSDActive; } @Override public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + (fencingEnabled ? 1231 : 1237); result = prime * result + (skipFencingIfSDActive ? 1231 : 1237); return result; } @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(" }"); 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..0068219 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,8 @@ .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("fencing_enabled", group.getFencingPolicy().isFencingEnabled()); return parameterSource; } @@ -291,6 +292,7 @@ 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().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 0b19e74..407271a 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -743,6 +743,7 @@ <column>custom_serial_number</column> <column>required_rng_sources</column> <column>skip_fencing_if_sd_active</column> + <column>fencing_enabled</column> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value> <value>rhel6.iscsi</value> @@ -769,6 +770,7 @@ <null /> <value>RANDOM</value> <value>false</value> + <value>true</value> </row> <row> <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d2</value> @@ -795,6 +797,7 @@ <value>0</value> <null /> <value></value> + <value>true</value> <value>true</value> </row> <row> @@ -823,6 +826,7 @@ <null /> <value>HWRNG</value> <value>false</value> + <value>true</value> </row> <row> <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value> @@ -849,6 +853,7 @@ <value>2</value> <value>my custom serial number</value> <value>HWRNG,RANDOM</value> + <value>true</value> <value>true</value> </row> <row> @@ -877,6 +882,7 @@ <null /> <value>HWRNG,RANDOM</value> <value>false</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7d</value> @@ -903,6 +909,7 @@ <null /> <null /> <value>HWRNG,RANDOM</value> + <value>false</value> <value>false</value> </row> <row> @@ -931,6 +938,7 @@ <null /> <value>RANDOM</value> <value>true</value> + <value>true</value> </row> <row> <value>eba797fb-8e3b-4777-b63c-92e7a5957d7f</value> @@ -958,6 +966,7 @@ <null /> <value>RANDOM</value> <value>false</value> + <value>true</value> </row> <row> <value>ae956031-6be2-43d6-bb8f-5191c9253314</value> @@ -985,6 +994,7 @@ <null /> <value>RANDOM</value> <value>true</value> + <value>false</value> </row> </table> diff --git a/packaging/dbscripts/upgrade/03_06_0140_disable_fencing_in_cluster.sql b/packaging/dbscripts/upgrade/03_06_0140_disable_fencing_in_cluster.sql new file mode 100644 index 0000000..d7a7d8f --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0140_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 8831824..b264bef 100644 --- a/packaging/dbscripts/vds_groups_sp.sql +++ b/packaging/dbscripts/vds_groups_sp.sql @@ -37,17 +37,18 @@ 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_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) + 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, 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_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_fencing_enabled); END; $procedure$ LANGUAGE plpgsql; @@ -84,7 +85,8 @@ 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_fencing_enabled BOOLEAN ) RETURNS VOID @@ -104,7 +106,8 @@ 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, + fencing_enabled = v_fencing_enabled WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/31255 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I587d7d40bc010196f916525ec3da7b1d821689d9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
