<div dir="ltr"><div><div>Hi All,<br><br></div>ATM, there are 78 occurrences of "Injector.injectMembers(new AuditLogableBase())" in ovirt-engine project, which their main purpose is to ease the resolve of the placeholders of the audit log message while logging an event.<br><br></div>For instance AuditLogType.MAC_ADDRESS_IS_EXTERNAL is being used from ImportVmCommandBase.java in the following way:<br><br>private AuditLogableBase createExternalMacsAuditLog(VM vm, Set<String> externalMacs) {<br> AuditLogableBase logable = <b>Injector.injectMembers</b>(new AuditLogableBase());<br> logable.setVmId(vm.getId());<br> logable.setCustomCommaSeparatedValues("MACAddr", externalMacs);<br> return logable;<br> }<br clear="all"><div><div><div><br>The entry in the properties file is:<br>MAC_ADDRESS_IS_EXTERNAL=VM ${<b>VmName</b>} has MAC address(es) ${MACAddr}, which is/are out of its MAC pool definitions.<br><br></div><div>Therefore the only purpose of the injection is to allow the AuditLogDirector to resolve the ${<b>VmName</b>} which is already known at the time of creating the AuditLogableBase entry.<br></div><div><br></div><div>The result is injecting the DAOs for the AuditLogableBase instance and using the VM dao to retrieve the VM entry from the DB.<br></div><div>This is just a wastef of injection and DB access while both can be spared.<br><br></div><div>This could have been easily replaced by one of the following:<br><ul><li>auditLogableBase.setVmName(vm.getName());</li><li>auditLogableBase.addCustomValue("VmName", vm.getName());</li></ul><p>Please pick up any occurrence from your domain and send a patch to replace it where possible.<br></p></div><div>Thanks in advance,<br><div class="gmail_signature"><div dir="ltr">Moti<br></div></div>
</div></div></div></div>