Moti Asayag has uploaded a new change for review. Change subject: engine: Allow to subscribe for 'host available update' event ......................................................................
engine: Allow to subscribe for 'host available update' event Change-Id: Ia8d484d3f5ca90e79349fc19e9ea9c1e3a0a69b0 Bug-Url: https://bugzilla.redhat.com/1226811 Signed-off-by: Moti Asayag <masa...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/HostUpgradeManager.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 backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java 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 7 files changed, 17 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/42012/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/HostUpgradeManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/HostUpgradeManager.java index 9ce8cda..0a10709 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/HostUpgradeManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/host/HostUpgradeManager.java @@ -33,7 +33,9 @@ return updatesAvailable; } catch (final Exception e) { - log.error("Failed to refresh host '{}' packages '{}'.", host.getName(), StringUtils.join(packages, ", ")); + log.error("Failed to refresh host '{}' packages '{}' availability.", + host.getName(), + StringUtils.join(packages, ", ")); log.error("Exception", e); throw new RuntimeException(e.getMessage(), e); 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 a5a1758..be1872d 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 @@ -679,6 +679,7 @@ HOST_UPGRADE_STARTED(840), HOST_UPGRADE_FAILED(841, AuditLogSeverity.ERROR), HOST_UPGRADE_FINISHED(842), + HOST_UPDATES_ARE_AVAILABLE(843, AuditLogSeverity.NORMAL, AuditLogTimeInterval.DAY.getValue() * 1), CERTIFICATE_FILE_NOT_FOUND(817, AuditLogSeverity.ERROR), RUN_VM_FAILED(818, AuditLogSeverity.ERROR), MAC_ADDRESSES_POOL_NOT_INITIALIZED(837, AuditLogSeverity.WARNING, 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 860df74..68d7fa1d 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 @@ -26,6 +26,7 @@ AddEventNotificationEntry(EventNotificationEntity.VdsGroup, AuditLogType.CLUSTER_ALERT_HA_RESERVATION_DOWN); // VDS AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_FAILURE); + AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.HOST_UPDATES_ARE_AVAILABLE); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE_MANUAL_HA); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE_MIGRATION_FAILED); 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 01959e3..3c13b4c 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -998,6 +998,7 @@ VM_ADD_HOST_DEVICES=Host devices ${NamesAdded} were attached to Vm ${VmName} by User ${UserName}. VM_REMOVE_HOST_DEVICES=Host devices ${NamesRemoved} were detached from Vm ${VmName} by User ${UserName}. HOST_AVAILABLE_UPDATES_FAILED=Failed to check for available updates on host '${VdsName}' with message '${Message}'. +HOST_UPDATES_ARE_AVAILABLE=Host '${VdsName}' has available updates. HOST_UPGRADE_STARTED=Host ${VdsName} upgrade was started (User: ${UserName}). HOST_UPGRADE_FAILED=Failed to upgrade Host ${VdsName} (User: ${UserName}). HOST_UPGRADE_FINISHED=Host ${VdsName} upgrade was completed successfully. diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java index 54ee076..7624b34 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java @@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.businessentities.NonOperationalReason; @@ -310,10 +311,9 @@ updateAvailable = resourceManager.isUpdateAvailable(cachedVds); } catch (Exception e) { log.error("Failed to check if updates are available for host '{}'", cachedVds.getName()); - AuditLogableBase auditLog = new AuditLogableBase(); auditLog.setVds(cachedVds); - auditLog.addCustomValue("Message", e.getMessage()); + auditLog.addCustomValue("Message", StringUtils.defaultString(e.getMessage(), e.getCause().toString())); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_FAILED); return; } @@ -324,6 +324,12 @@ dbFacade.getVdsDynamicDao().updateUpdateAvailable(cachedVds.getId(), updateAvailable); } } + + if (updateAvailable) { + AuditLogableBase auditLog = new AuditLogableBase(); + auditLog.setVds(cachedVds); + auditLogDirector.log(auditLog, AuditLogType.HOST_UPDATES_ARE_AVAILABLE); + } } /** 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 ae4c9c8..4d75dec 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 @@ -250,6 +250,8 @@ String AuditLogType___VDS_FAILURE(); + String AuditLogType___HOST_UPDATES_ARE_AVAILABLE(); + String AuditLogType___USER_VDS_MAINTENANCE(); String AuditLogType___USER_VDS_MAINTENANCE_MANUAL_HA(); 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 be7e1aa..8d14a79 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 @@ -125,6 +125,7 @@ EventNotificationEntity___GlusterHook=Gluster Hook Events: EventNotificationEntity___GlusterService=Gluster Service: AuditLogType___VDS_FAILURE=Host is non responsive +AuditLogType___HOST_UPDATES_ARE_AVAILABLE=Host has available updates AuditLogType___USER_VDS_MAINTENANCE=Host was switched to Maintenance Mode (Reason: ${Reason}). AuditLogType___USER_VDS_MAINTENANCE_MANUAL_HA=Host was switched to Maintenance Mode, but Hosted Engine HA maintenance mode could not be enabled AuditLogType___USER_VDS_MAINTENANCE_MIGRATION_FAILED=Failed to switch Host to Maintenance mode -- To view, visit https://gerrit.ovirt.org/42012 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia8d484d3f5ca90e79349fc19e9ea9c1e3a0a69b0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches