Shahar Havivi has uploaded a new change for review. Change subject: core: Add Audit log for failed to run prestarted VMs ......................................................................
core: Add Audit log for failed to run prestarted VMs Currently we are only logging to the engine.log, adding audit log for the specific Host and VM. Change-Id: I32b3fa9d24a24042a62ce464642b74118f0ff61e Bug-Url: https://bugzilla.redhat.com/1046411 Signed-off-by: Shahar Havivi <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/MemoryPolicyUnit.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties 3 files changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/43/27943/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/MemoryPolicyUnit.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/MemoryPolicyUnit.java index cc1e5b9..f044857 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/MemoryPolicyUnit.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/MemoryPolicyUnit.java @@ -5,6 +5,7 @@ import java.util.Map; import org.ovirt.engine.core.bll.scheduling.PolicyUnitImpl; +import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; @@ -12,6 +13,8 @@ import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.scheduling.PolicyUnit; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector; +import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; public class MemoryPolicyUnit extends PolicyUnitImpl { @@ -35,6 +38,12 @@ if (!memoryChecker.evaluate(vds, vm)) { log.debugFormat("host '{0}' has insufficient memory to run the VM", vds.getName()); messages.add(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_MEMORY.toString()); + AuditLogableBase log = new AuditLogableBase(); + log.addCustomValue("VdsName", vds.getName()); + log.addCustomValue("VmName", vm.getName()); + log.setVdsId(vds.getId()); + log.setVmId(vm.getId()); + AuditLogDirector.log(log, AuditLogType.VDS_INSUFFICIENT_MEMORY_TO_RUN_VM); continue; } list.add(vds); 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 24e0024..e2db925 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 @@ -107,6 +107,8 @@ VDS_TIME_DRIFT_ALERT(604, AuditLogSeverity.WARNING, AuditLogTimeInterval.MINUTE.getValue() * 60), + VDS_INSUFFICIENT_MEMORY_TO_RUN_VM(613, AuditLogSeverity.WARNING), + // Proxy host selection PROXY_HOST_SELECTION(605), 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 cc11e53..ca215f8 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -220,6 +220,7 @@ VDS_ACTIVATE_MANUAL_HA_ASYNC=Host ${VdsName} was autorecovered, but the Hosted Engine HA service may still be in maintenance mode. If necessary, please correct this manually. VDS_ACTIVATE_FAILED=Failed to activate Host ${VdsName}.(User: ${UserName}). VDS_ACTIVATE_FAILED_ASYNC=Failed to autorecover Host ${VdsName}. +VDS_INSUFFICIENT_MEMORY_TO_RUN_VM=Host ${VdsName} has insufficient memory to run the VM ${VmName}. HOST_REFRESHED_CAPABILITIES=Successfully refreshed the capabilities of host ${VdsName}. HOST_REFRESH_CAPABILITIES_FAILED=Failed to refresh the capabilities of host ${VdsName}. HOST_INTERFACE_STATE_UP=Interface ${InterfaceName} on host ${VdsName}, changed state to up -- To view, visit http://gerrit.ovirt.org/27943 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I32b3fa9d24a24042a62ce464642b74118f0ff61e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
