Tomas Jelinek has uploaded a new change for review.

Change subject: core: added event log when mixing RHLE 6 and 7 in one cluster
......................................................................

core: added event log when mixing RHLE 6 and 7 in one cluster

It was already disabled to mix this two RHELs, but there was not added a
specific message in the event log. This patch adds it, an example:

"Not possible to mix RHEL 6x and 7x hosts in one cluster. Tried to add RHEL -
7Server - 7.5.0.1.el7 to cluster with RHEL - 6Server - 6.5.0.1.el6."

Change-Id: Ia8e58e10f181b6742b88b464739ed39610ac69de
Bug-Url: https://bugzilla.redhat.com/1154631
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java
2 files changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/35497/1

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 c2783f7..692fc70 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -892,4 +892,4 @@
 USER_FAILED_TO_REMOVE_CPU_PROFILE=Failed to remove CPU Profile ${ProfileName} 
(User: ${UserName}).
 USER_UPDATED_CPU_PROFILE=CPU Profile ${ProfileName} was successfully updated 
(User: ${UserName}).
 USER_FAILED_TO_UPDATE_CPU_PROFILE=Failed to update CPU Profile ${ProfileName} 
(User: ${UserName}).
-
+MIXING_RHEL_VERSIONS_IN_CLUSTER=Not possible to mix RHEL 6x and 7x hosts in 
one cluster. Tried to add ${addingRhel} to cluster with ${previousRhel}.
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java
index e8d834c..addf60b 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java
@@ -6,6 +6,7 @@
 import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
+import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.businessentities.NonOperationalReason;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -16,6 +17,8 @@
 import org.ovirt.engine.core.common.utils.ListUtils;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
+import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
 import org.ovirt.engine.core.dao.VdsDAO;
 import org.ovirt.engine.core.dao.VdsGroupDAO;
 
@@ -83,6 +86,7 @@
 
             vdsNonOperational(vds, 
NonOperationalReason.RNG_SOURCES_INCOMPATIBLE_WITH_CLUSTER, customLogValues);
             vds.setStatus(VDSStatus.NonOperational);
+
         }
     }
 
@@ -130,8 +134,16 @@
                 Map<String, String> customLogValues = new HashMap<>();
                 customLogValues.put("previousRhel", beforeRhel.getHostOs());
                 customLogValues.put("addingRhel", vds.getHostOs());
+
                 vdsNonOperational(vds, 
NonOperationalReason.MIXING_RHEL_VERSIONS_IN_CLUSTER, customLogValues);
                 vds.setStatus(VDSStatus.NonOperational);
+
+                AuditLogableBase auditLogable = new 
AuditLogableBase(vds.getId());
+                for (Map.Entry<String, String> customValue: 
customLogValues.entrySet()) {
+                    auditLogable.addCustomValue(customValue.getKey(), 
customValue.getValue());
+                }
+
+                AuditLogDirector.log(auditLogable, 
AuditLogType.MIXING_RHEL_VERSIONS_IN_CLUSTER);
             }
         }
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8e58e10f181b6742b88b464739ed39610ac69de
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to