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, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/31257/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 7f797b4..5a15f4e 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
@@ -17,9 +17,14 @@
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import org.ovirt.engine.core.common.businessentities.FencingPolicy;
 import org.ovirt.engine.core.common.businessentities.StoragePoolStatus;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VdsSpmStatus;
 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.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.utils.ThreadUtils;
 
 /**
@@ -57,6 +62,23 @@
         return new FenceExecutor(getVds(), getParameters().getAction());
     }
 
+    @Override
+    protected boolean canDoAction() {
+        VDS vds = getVds();
+
+        if (vds != null) {
+            VDSGroup vdsGroup = 
getDbFacade().getVdsGroupDao().get(vds.getVdsGroupId());
+            if (vdsGroup != null && 
!vdsGroup.getFencingPolicy().isFencingEnabled()) {
+                AuditLogableBase alb = new AuditLogableBase();
+                alb.setVds(vds);
+                AuditLogDirector.log(alb, 
AuditLogType.VDS_FENCE_DISABLED_BY_CLUSTER_POLICY);
+                
addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_BY_CLUSTER_POLICY);
+                return false;
+            }
+        }
+        return super.canDoAction();
+    }
+
     /**
      * 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.
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 09f43f5..f19fb4d 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
@@ -104,6 +104,7 @@
     SYSTEM_FAILED_VDS_RESTART(122, AuditLogSeverity.ERROR,
             AuditLogTimeInterval.MINUTE.getValue()),
     VDS_NOT_RESTARTED_DUE_TO_POLICY(618),
+    VDS_FENCE_DISABLED_BY_CLUSTER_POLICY(620),
 
     // Host time drift Alert
     VDS_TIME_DRIFT_ALERT(604, AuditLogSeverity.WARNING,
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 844ce8d..551c3dd 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 ef765fa..b0f3975 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -125,6 +125,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} was not fenced, fencing 
is disabled in Fencing Policy of the Cluster.
 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 bbcf2d6..74193bb 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.
+VDS_FENCE_DISABLED_BY_CLUSTER_POLICY=Host ${VdsName} was not fenced, fencing 
is disabled in Fencing Policy of the Cluster.
 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).
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 013b7ff..b568ee2 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
@@ -316,6 +316,9 @@
     @DefaultStringValue(" Power Management operation ${operation} is still 
running, please retry in ${seconds} Sec.")
     String VDS_FENCE_DISABLED_AT_QUIET_TIME();
 
+    @DefaultStringValue("Host ${VdsName} was not fenced, fencing is disabled 
in Fencing Policy of the Cluster.")
+    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 874e28a..f201e74 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
@@ -110,6 +110,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} was not fenced, fencing 
is disabled in Fencing Policy of the Cluster.
 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 8aa2dc6..a0d58db 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
@@ -124,6 +124,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} was not fenced, fencing 
is disabled in Fencing Policy of the Cluster.
 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/31257
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I784564e41c89b4a95eff3377cd6545cf907ecdce
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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