<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Apr 5, 2017 at 11:34 PM Moti Asayag <<a href="mailto:masayag@redhat.com">masayag@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Wed, Apr 5, 2017 at 11:17 PM, Roy Golan <span dir="ltr" class="gmail_msg"><<a href="mailto:rgolan@redhat.com" class="gmail_msg" target="_blank">rgolan@redhat.com</a>></span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><span class="m_-6163671470618302110gmail- gmail_msg"><div dir="ltr" class="gmail_msg">On Wed, Apr 5, 2017 at 9:06 PM Moti Asayag <<a href="mailto:masayag@redhat.com" class="gmail_msg" target="_blank">masayag@redhat.com</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Hi All,<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></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 class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div>For instance AuditLogType.MAC_ADDRESS_IS_EXTERNAL is being used from ImportVmCommandBase.java in the following way:<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">private AuditLogableBase createExternalMacsAuditLog(VM vm, Set<String> externalMacs) {<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"> AuditLogableBase logable = <b class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Injector.injectMembers</b>(new AuditLogableBase());<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"> logable.setVmId(vm.getId());<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"> logable.setCustomCommaSeparatedValues("MACAddr", externalMacs);<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"> return logable;<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"> }<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg" clear="all"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">The entry in the properties file is:<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">MAC_ADDRESS_IS_EXTERNAL=VM ${<b class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">VmName</b>} has MAC address(es) ${MACAddr}, which is/are out of its MAC pool definitions.<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Therefore the only purpose of the injection is to allow the AuditLogDirector to resolve the ${<b class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">VmName</b>} which is already known at the time of creating the AuditLogableBase entry.<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">The result is injecting the DAOs for the AuditLogableBase instance and using the VM dao to retrieve the VM entry from the DB.<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">This is just a wastef of injection and DB access while both can be spared.<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">This could have been easily replaced by one of the following:<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><ul class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><li class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">auditLogableBase.setVmName(vm.getName());</li></ul></div></div></div></div></blockquote></span><div class="gmail_msg">- setVmName is protected so not usable as is <br class="gmail_msg"></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">It will become public if we agree on <br class="gmail_msg"><br class="gmail_msg"><a href="https://gerrit.ovirt.org/#/c/75244/2/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java" class="gmail_msg" target="_blank">https://gerrit.ovirt.org/#/c/75244/2/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogableBase.java</a><br class="gmail_msg"> <br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><ul class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><li class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">auditLogableBase.addCustomValue("VmName", vm.getName());</li></ul></div></div></div></div></blockquote><div class="gmail_msg">I prefer this, it is readable. and BTW it is fluent, it returns 'this' so use<br class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> AuditLogDirector(new AuditLogableBase(type)<br class="gmail_msg"> .addCustomValue("VmName", vm.getName()));</div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">I'm okay with this as well.<br class="gmail_msg"> <br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><span class="m_-6163671470618302110gmail- gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><p class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Please pick up any occurrence from your domain and send a patch to replace it where possible.<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></p></div><div class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Thanks in advance,<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div class="m_-6163671470618302110gmail-m_1772032661836158604m_5996702152823124421gmail_signature m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"><div dir="ltr" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">Moti<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div></div></div></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></span><div class="gmail_msg">+1<br class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Frankly the fact that all the DAOs sets protected access in AuditLogableBase is a total abuse. Every command should declare its own deps. <br class="gmail_msg"></div></div><span class="m_-6163671470618302110gmail- gmail_msg"><div class="gmail_quote gmail_msg"><br class="gmail_msg"></div></span></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">That will require a huge effort.<br class="gmail_msg"></div></div></div></div></blockquote><div><br></div><div>Removed them all, <a href="https://gerrit.ovirt.org/75262">https://gerrit.ovirt.org/75262</a> compile +1<br>Now need to fix the tests - I'd appreciate help here<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> <br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="gmail_msg"><span class="m_-6163671470618302110gmail- gmail_msg"><div class="gmail_quote gmail_msg"></div><div class="gmail_quote gmail_msg">_______________________________________________<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg"></div><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Devel mailing list<br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">
<a href="mailto:Devel@ovirt.org" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg" target="_blank">Devel@ovirt.org</a><br class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg">
<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" class="m_-6163671470618302110gmail-m_1772032661836158604gmail_msg gmail_msg" target="_blank">http://lists.ovirt.org/mailman/listinfo/devel</a></blockquote></div></span></div>
</blockquote></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><br class="gmail_msg"><br class="gmail_msg" clear="all"><br class="gmail_msg">-- <br class="gmail_msg"><div class="m_-6163671470618302110gmail_signature gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg">Regards,<br class="gmail_msg"></div>Moti<br class="gmail_msg"></div></div>
</div></div></blockquote></div></div>