Martin Peřina has uploaded a new change for review.

Change subject: core: Display warning when fencing is disabled in cluster
......................................................................

core: Display warning when fencing is disabled in cluster

Displays warning during add/update cluster if fencing is disabled in
fencing policy of the cluster.

Change-Id: I4853b349571523fbb4dac54cae45d9d6a9df01f3
Bug-Url: https://bugzilla.redhat.com/1120858
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
5 files changed, 19 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/31653/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java
index 2d1feae..ef151dd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java
@@ -14,6 +14,8 @@
 import org.ovirt.engine.core.common.businessentities.network.Network;
 import org.ovirt.engine.core.common.businessentities.network.NetworkCluster;
 import org.ovirt.engine.core.common.businessentities.network.NetworkStatus;
+import org.ovirt.engine.core.common.config.Config;
+import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.gluster.GlusterFeatureSupported;
 import org.ovirt.engine.core.common.validation.group.CreateEntity;
@@ -22,8 +24,6 @@
 import org.ovirt.engine.core.utils.NetworkUtils;
 import org.ovirt.engine.core.utils.linq.LinqUtils;
 import org.ovirt.engine.core.utils.linq.Predicate;
-import org.ovirt.engine.core.common.config.Config;
-import org.ovirt.engine.core.common.config.ConfigValues;
 
 public class AddVdsGroupCommand<T extends VdsGroupOperationParameters> extends
         VdsGroupOperationCommandBase<T> {
@@ -41,6 +41,8 @@
         getVdsGroup().setDetectEmulatedMachine(true);
         DbFacade.getInstance().getVdsGroupDao().save(getVdsGroup());
 
+        alertIfFencingDisabled();
+
         // add default network
         if (getParameters().getVdsGroup().getStoragePoolId() != null) {
             final String networkName = NetworkUtils.getEngineNetwork();
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
index c75cb0b..605a5cb 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java
@@ -115,6 +115,8 @@
                     true));
         }
 
+        alertIfFencingDisabled();
+
         setSucceeded(true);
     }
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
index 93f9bab..c117b73 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
@@ -9,6 +9,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.bll.scheduling.SchedulingManager;
+import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.VdsGroupOperationParameters;
 import org.ovirt.engine.core.common.businessentities.ArchitectureType;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -18,6 +19,8 @@
 import 
org.ovirt.engine.core.common.utils.customprop.SimpleCustomPropertiesUtil;
 import org.ovirt.engine.core.common.utils.customprop.ValidationError;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.dao.VdsGroupDAO;
 
 public abstract class VdsGroupOperationCommandBase<T extends 
VdsGroupOperationParameters> extends
@@ -132,4 +135,11 @@
         return (vdsGroups == null || vdsGroups.isEmpty());
     }
 
+    protected void alertIfFencingDisabled() {
+        if (!getVdsGroup().getFencingPolicy().isFencingEnabled()) {
+            AuditLogableBase alb = new AuditLogableBase();
+            alb.setVdsGroupId(getVdsGroup().getId());
+            AuditLogDirector.log(alb, 
AuditLogType.FENCING_DISABLED_IN_CLUSTER_POLICY);
+        }
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index fb7623e..dcbecd0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -904,6 +904,8 @@
     VDS_ALERT_FENCE_OPERATION_SKIPPED_BROKEN_CONNECTIVITY(9013, 
AuditLogSeverity.ALERT),
     VDS_ALERT_NOT_RESTARTED_DUE_TO_POLICY(9014, AuditLogSeverity.ALERT),
     VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY(9015, AuditLogSeverity.ALERT),
+    FENCING_DISABLED_IN_CLUSTER_POLICY(9016, AuditLogSeverity.ALERT),
+
 
     TASK_STOPPING_ASYNC_TASK(9500, AuditLogTimeInterval.MINUTE.getValue()),
     TASK_CLEARING_ASYNC_TASK(9501, AuditLogTimeInterval.MINUTE.getValue()),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index bfbce63..e144d4d 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -576,6 +576,7 @@
 NETWORK_COMMINT_NETWORK_CHANGES_FAILED=Failed to commit network changes on 
${VdsName}
 SYSTEM_VDS_RESTART=Host ${VdsName} was restarted by the engine.
 SYSTEM_FAILED_VDS_RESTART=A restart initiated by the engine to Host ${VdsName} 
has failed.
+FENCING_DISABLED_IN_CLUSTER_POLICY=Fencing is disabled in Fencing Policy of 
the Cluster ${VdsGroupName}, so HA VMs running on a non-responsive host will 
not be restarted elsewhere.
 VDS_TIME_DRIFT_ALERT=Host ${VdsName} has time-drift of ${Actual} seconds while 
maximum configured value is ${Max} seconds.
 PROXY_HOST_SELECTION=Host ${Proxy} from ${Origin} was chosen as a proxy to 
execute ${Command} command on Host ${VdsName}.
 RECONSTRUCT_MASTER_FAILED_NO_MASTER=No valid Data Storage Domains are 
available in Data Center ${StoragePoolName} (please check your storage 
infrastructure).


-- 
To view, visit http://gerrit.ovirt.org/31653
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4853b349571523fbb4dac54cae45d9d6a9df01f3
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

Reply via email to