Kobi Ianko has uploaded a new change for review. Change subject: engine: Adding a down event for HA Reservation ......................................................................
engine: Adding a down event for HA Reservation Adding a down event to HA Reservation, this event will be triggered only in case the current status of the Cluster was changed from not HA safe to HA safe. This is done to ensure that the user is notified that his action (freeing resources) have made the Cluster HA safe. Change-Id: Iebc82d3cc190d439b77e45e7e6b3eb7451f71c3c Bug-Url: https://bugzilla.redhat.com/1076211 Signed-off-by: Kobi Ianko <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.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/VdcEventNotificationUtils.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java M frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties 6 files changed, 24 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/25949/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java index a466193..36cd8f7 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java @@ -88,6 +88,8 @@ private final VdsFreeMemoryChecker noWaitingMemoryChecker = new VdsFreeMemoryChecker(new NonWaitingDelayer()); private MigrationHandler migrationHandler; + private Map<Guid, Boolean> clusterId2isHaReservationSafe = new HashMap<>(); + private SchedulingManager() { policyMap = new ConcurrentHashMap<Guid, ClusterPolicy>(); policyUnits = new ConcurrentHashMap<Guid, PolicyUnitImpl>(); @@ -800,6 +802,22 @@ AlertDirector.Alert(logable, AuditLogType.CLUSTER_ALERT_HA_RESERVATION); log.infoFormat("Cluster: {0} fail to pass HA reservation check.", cluster.getName()); } + + boolean oldStatus = + clusterId2isHaReservationSafe.containsKey(cluster.getId()) ? clusterId2isHaReservationSafe.get(cluster.getId()) + : true; + + // Update the status map with the new status + clusterId2isHaReservationSafe.put(cluster.getId(), status); + + // Create Alert if the status was changed from false to true + if (!oldStatus && status) { + AuditLogableBase logable = new AuditLogableBase(); + logable.setVdsGroupId(cluster.getId()); + logable.addCustomValue("ClusterName", cluster.getName()); + AlertDirector.Alert(logable, AuditLogType.CLUSTER_ALERT_HA_RESERVATION_DOWN); + log.infoFormat("Cluster: {0} pass HA reservation check.", cluster.getName()); + } } } } 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 5fff6fb..d0655f4f 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 @@ -946,6 +946,7 @@ // HA Reservation CLUSTER_ALERT_HA_RESERVATION(10300, AuditLogSeverity.ALERT, AuditLogTimeInterval.HOUR.getValue()), + CLUSTER_ALERT_HA_RESERVATION_DOWN(10301, AuditLogSeverity.ALERT), //affinity groups USER_ADDED_AFFINITY_GROUP(10350), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java index 05f8b2c..ab20f38 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java @@ -17,6 +17,7 @@ AddEventNotificationEntry(EventNotificationEntity.Engine, AuditLogType.VDC_STOP); // VDS GROUP AddEventNotificationEntry(EventNotificationEntity.VdsGroup, AuditLogType.CLUSTER_ALERT_HA_RESERVATION); + AddEventNotificationEntry(EventNotificationEntity.VdsGroup, AuditLogType.CLUSTER_ALERT_HA_RESERVATION_DOWN); // VDS AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_FAILURE); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE); 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 109ff5a..90e4666 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -777,6 +777,7 @@ VM_CONSOLE_DISCONNECTED=User ${UserName} got disconnected from VM ${VmName}. VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE=Failed to change status of host '${VdsName}' due to a failure to stop the spm. CLUSTER_ALERT_HA_RESERVATION=Cluster ${ClusterName} failed the HA Reservation check, HA VMs on host(s): ${Hosts} will fail to migrate in case of a failover, consider adding resources or shutting down unused VMs. +CLUSTER_ALERT_HA_RESERVATION_DOWN=Cluster ${ClusterName} passed the HA Reservation check. PM_POLICY_UP_TO_MAINTENANCE=Host ${Host} is not currently needed, activating maintenance mode in preparation for shutdown. PM_POLICY_MAINTENANCE_TO_DOWN=Host ${Host} is not currently needed, shutting down. PM_POLICY_TO_UP=Reactivating host ${Host} according to the current power management policy. diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java index a6128fa..ee091bd 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java @@ -270,6 +270,8 @@ String AuditLogType___CLUSTER_ALERT_HA_RESERVATION(); + String AuditLogType___CLUSTER_ALERT_HA_RESERVATION_DOWN(); + // Gluster Audit log types String AuditLogType___GLUSTER_VOLUME_CREATE(); diff --git a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties index c3c0a96..149d8c4 100644 --- a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties +++ b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties @@ -131,6 +131,7 @@ AuditLogType___IRS_DISK_SPACE_LOW_ERROR=Critically low disk space AuditLogType___VDC_STOP=Engine has stopped AuditLogType___CLUSTER_ALERT_HA_RESERVATION=HA Reservation check has failed +AuditLogType___CLUSTER_ALERT_HA_RESERVATION_DOWN=HA Reservation check has passed AuditLogType___VDS_NETWORK_MTU_DIFFER_FROM_LOGICAL_NETWORK=The MTU value of the Host network differs from logical network AuditLogType___GLUSTER_VOLUME_CREATE=Gluster Volume Created AuditLogType___GLUSTER_VOLUME_CREATE_FAILED=Gluster Volume could not be created -- To view, visit http://gerrit.ovirt.org/25949 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iebc82d3cc190d439b77e45e7e6b3eb7451f71c3c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kobi Ianko <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
