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

Change subject: core: Suppress VdsNotResponding execution if fencing is disabled
......................................................................

core: Suppress VdsNotResponding execution if fencing is disabled

Suppress VdsNotRespondingCommand execution if fencing is disabled in
fencing policy of the cluster.

Change-Id: I784564e41c89b4a95eff3377cd6545cf907ecdce
Bug-Url: https://bugzilla.redhat.com/1120858
Signed-off-by: Martin Perina <mper...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
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
8 files changed, 33 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/31652/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
index 1ac5c49..5994060 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsNotRespondingTreatmentCommand.java
@@ -66,6 +66,25 @@
         return new FenceExecutor(getVds(), getParameters().getAction());
     }
 
+    private boolean shouldFencingBeSkipped(VDS vds) {
+        // check if fencing in cluster is enabled
+        VDSGroup vdsGroup = 
getDbFacade().getVdsGroupDao().get(vds.getVdsGroupId());
+        if (vdsGroup != null && 
!vdsGroup.getFencingPolicy().isFencingEnabled()) {
+            AuditLogDirector.log(
+                    new AuditLogableBase(vds.getId()),
+                    AuditLogType.VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY);
+            return true;
+        }
+
+        // check if connectivity is not broken
+        if (isConnectivityBrokenThresholdReached(getVds())) {
+            return true;
+        }
+
+        // fencing will be executed
+        return false;
+    }
+
     /**
      * Only fence the host if the VDS is down, otherwise it might have gone 
back up until this command was executed. If
      * the VDS is not fenced then don't send an audit log event.
@@ -79,9 +98,13 @@
             getReturnValue().setSucceeded(false);
             return;
         }
-        if (isConnectivityBrokenThresholdReached(getVds())) {
+
+        if (shouldFencingBeSkipped(getVds())) {
+            setSucceeded(false);
+            setCommandShouldBeLogged(false);
             return;
         }
+
         VdsValidator validator = new VdsValidator(getVds());
         boolean shouldBeFenced = validator.shouldVdsBeFenced();
         if (shouldBeFenced) {
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 aa57264..fb7623e 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
@@ -903,6 +903,7 @@
     VDS_ALERT_PM_HEALTH_CHECK_FAILED_FOR_CON_SECONDARY_AGENT(9012, 
AuditLogSeverity.ALERT),
     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),
 
     TASK_STOPPING_ASYNC_TASK(9500, AuditLogTimeInterval.MINUTE.getValue()),
     TASK_CLEARING_ASYNC_TASK(9501, AuditLogTimeInterval.MINUTE.getValue()),
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 e835a4d..4dc8112 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
@@ -320,6 +320,7 @@
     VDS_FAILED_FENCE_VIA_PROXY_CONNECTION(ErrorType.CONFLICT),
     VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL(ErrorType.CONFLICT),
     VDS_FENCE_DISABLED_AT_QUIET_TIME(ErrorType.CONFLICT),
+    VDS_FENCE_DISABLED_BY_CLUSTER_POLICY(ErrorType.CONFLICT),
     VDS_STATUS_NOT_VALID_FOR_UPDATE(ErrorType.CONFLICT),
     VDS_EMPTY_NAME_OR_ID(ErrorType.BAD_PARAMETERS),
     VDS_TRY_CREATE_WITH_EXISTING_PARAMS(ErrorType.BAD_PARAMETERS),
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 46a01b1..5f48dfc 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -120,6 +120,7 @@
 VDS_FENCE_DISABLED=Cannot fence Host, Host fence is disabled.
 VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL=Fence is disabled due to the 
Engine Service start up sequence.
 VDS_FENCE_DISABLED_AT_QUIET_TIME=Another Power Management operation is still 
running, please retry in ${seconds} Sec.
+VDS_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} became Non Responsive and 
was not restarted due to disabled fencing in the Cluster Fencing Policy.
 TEMPLATE_IMAGE_NOT_EXIST=Cannot ${action} ${type}. Template's image doesn't 
exist.
 VM_CANNOT_REMOVE_VDS_GROUP_VMS_DETECTED=Cannot ${action} ${type}. One or more 
VMs are still assigned to the Cluster
 VMT_CANNOT_REMOVE_VDS_GROUP_VMTS_DETECTED=Cannot ${action} ${type}. One or 
more Template(s) are still associated with it
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 d19d835..bfbce63 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -619,6 +619,7 @@
 VDS_ALERT_PM_HEALTH_CHECK_FAILED_FOR_SEQ_SECONDARY_AGENT=Health check failed 
on Host ${VdsName} secondary sequential agent, future fence operations may fail 
if primary agent is not defined properly.
 VDS_ALERT_FENCE_OPERATION_SKIPPED_BROKEN_CONNECTIVITY=Host ${VdsName} became 
non responsive and was not restarted due to Fencing Policy: ${Percents} 
percents of the Hosts in the Cluster have connectivity issues.
 VDS_ALERT_NOT_RESTARTED_DUE_TO_POLICY=Host ${VdsName} became non responsive 
and was not restarted due to the Cluster Fencing Policy.
+VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} became Non 
Responsive and was not restarted due to disabled fencing in the Cluster Fencing 
Policy.
 VDS_HOST_NOT_RESPONDING_CONNECTING=Host ${VdsName} is not responding. It will 
stay in Connecting state for a grace period of ${Seconds} seconds and after 
that an attempt to fence the host will be issued.
 TASK_STOPPING_ASYNC_TASK=Stopping async task ${CommandName} that started at 
${Date}
 REFRESH_REPOSITORY_IMAGE_LIST_FAILED=Refresh image list failed for domain(s): 
${imageDomains}. Please check domain activity.
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 93834ef..cc39bab 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
@@ -301,6 +301,9 @@
     @DefaultStringValue(" Power Management operation ${operation} is still 
running, please retry in ${seconds} Sec.")
     String VDS_FENCE_DISABLED_AT_QUIET_TIME();
 
+    @DefaultStringValue("Host ${VdsName} became Non Responsive and was not 
restarted due to disabled fencing in the Cluster Fencing Policy.")
+    String VDS_FENCE_DISABLED_BY_CLUSTER_POLICY();
+
     @DefaultStringValue("Cannot ${action} ${type}. Template's image doesn't 
exist.")
     String TEMPLATE_IMAGE_NOT_EXIST();
 
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 33111ad..7aed7d2 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
@@ -111,6 +111,7 @@
 VDS_FENCE_DISABLED=Cannot fence Host, Host fence is disabled.
 VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL=Fence is disabled due to the 
Engine Service start up sequence.
 VDS_FENCE_DISABLED_AT_QUIET_TIME=Another Power Management operation is still 
running, please retry in ${seconds} Sec.
+VDS_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} became Non Responsive and 
was not restarted due to disabled fencing in the Cluster Fencing Policy.
 TEMPLATE_IMAGE_NOT_EXIST=Cannot ${action} ${type}. Template's image doesn't 
exist.
 VM_CANNOT_REMOVE_VDS_GROUP_VMS_DETECTED=Cannot ${action} ${type}. One or more 
VMs are still assigned to the Cluster
 VMT_CANNOT_REMOVE_VDS_GROUP_VMTS_DETECTED=Cannot ${action} ${type}. One or 
more Template(s) are still associated with it
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 4a9205f..7f8fc91 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
@@ -119,6 +119,7 @@
 VDS_FENCE_DISABLED=Cannot fence Host, Host fence is disabled.
 VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL=Fence is disabled due to the 
Engine Service start up sequence.
 VDS_FENCE_DISABLED_AT_QUIET_TIME=Another Power Management operation is still 
running, please retry in ${seconds} Sec.
+VDS_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} became Non Responsive and 
was not restarted due to disabled fencing in the Cluster Fencing Policy.
 TEMPLATE_IMAGE_NOT_EXIST=Cannot ${action} ${type}. Template's image doesn't 
exist.
 VM_CANNOT_REMOVE_VDS_GROUP_VMS_DETECTED=Cannot ${action} ${type}. One or more 
VMs are still assigned to the Cluster
 VMT_CANNOT_REMOVE_VDS_GROUP_VMTS_DETECTED=Cannot ${action} ${type}. One or 
more Template(s) are still associated with it


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I784564e41c89b4a95eff3377cd6545cf907ecdce
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to