<div dir="ltr"><br><div><div><div><div><div class="gmail_extra"><div class="gmail_quote">On Tue, May 30, 2017 at 11:28 AM, Juan Hernández <span dir="ltr">&lt;<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 05/30/2017 09:38 AM, Tomas Jelinek wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, May 30, 2017 at 9:16 AM, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</span><span class="gmail-">&gt; &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 05/30/2017 08:55 AM, Tomas Jelinek wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; On Tue, May 30, 2017 at 7:20 AM, Michal Skrivanek &lt;<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a> &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a>&gt;<br>
</span><span class="gmail-">&gt;     &gt; &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a> &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt; On 29 May 2017, at 11:44, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;<br>
</span><span class="gmail-">&gt;     &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;&gt; On 05/29/2017 11:27 AM, Michal Skrivanek wrote:<br>
&gt;     &gt;     &gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; On 29 May 2017, at 10:39, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;<br>
</span><div><div class="gmail-h5">&gt;     &gt;     &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Hello,<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; It has been recently requested that the API provides event<br>
&gt;     types:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; [RFE] Expose event types to API<br>
&gt;     &gt;     &gt;&gt;&gt; <a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a><br>
&gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a>&gt;<br>
&gt;     &gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a><br>
&gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a>&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Currently the API provides the event code and description, for<br>
&gt;     &gt;     example:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; There is no documentation of what is the meaning of codes,<br>
&gt;     &gt;     except the<br>
&gt;     &gt;     &gt;&gt;&gt; source code of the engine itself. This forces some<br>
&gt;     applications<br>
&gt;     &gt;     to add<br>
&gt;     &gt;     &gt;&gt;&gt; their own code to name mapping. For example, the &#39;ovirt&#39; Ruby<br>
&gt;     &gt;     gem used<br>
&gt;     &gt;     &gt;&gt;&gt; by older versions of ManageIQ to interact with oVirt contains<br>
&gt;     &gt;     the following:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;<br>
&gt;      <a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a>&gt;<br>
&gt;     &gt;<br>
&gt;      &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a>&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; We could avoid this by adding to the API a new event<br>
&gt;     attribute that<br>
&gt;     &gt;     &gt;&gt;&gt; indicates the type:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;type&gt;host_recover_failure&lt;/<wbr>type&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Ideally this should be defined as an enum, so that it will be<br>
&gt;     &gt;     &gt;&gt;&gt; represented as an enum in the SDKs. Alternatively it could<br>
&gt;     just<br>
&gt;     &gt;     be an<br>
&gt;     &gt;     &gt;&gt;&gt; string, and we could reuse the &#39;name&#39; attribute:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;name&gt;host_recover_failure&lt;/<wbr>name&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; However, the key point to making this useful would be to keep<br>
&gt;     &gt;     the types<br>
&gt;     &gt;     &gt;&gt;&gt; (or names) backwards compatible, so that users of the API can<br>
&gt;     &gt;     rely on<br>
&gt;     &gt;     &gt;&gt;&gt; their values and meanings.<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; So this is my question to you: can we commit to keep the<br>
&gt;     names and<br>
&gt;     &gt;     &gt;&gt;&gt; meanings of the backend event types backwards compatible?<br></div></div></blockquote><div><br><div>we can maintain the mapping layer between backend event types to restapi event types<br></div><div>on the restapi side. This is currently done on the ovirt-gem, and once ovirt-gem is depracated<br></div><div>we could rely the manageiq-providers-ovirt code on the api/sdk which will expose the event name.<br></div><div>Having a single api maintainer will ease the maintenance of it and will allow a better control of<br></div><div>changes to that part. <br></div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
&gt;     &gt;     &gt;&gt;<br>
&gt;     &gt;     &gt;&gt; Do we even have to make it bw compatible?<br>
&gt;     &gt;     &gt;&gt; I guess it depends on the actual usage of those names…<br>
&gt;     &gt;     &gt;&gt; The ovirt ruby gem itself doesn’t do much with it<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; We need to make keep it backwards compatible or else tell<br>
&gt;     users &quot;don&#39;t<br>
&gt;     &gt;     &gt; rely on these values, as they may change without notice&quot;.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; The &#39;ovirt&#39; gem doesn&#39;t do anything special, it just creates<br>
&gt;     its own<br>
&gt;     &gt;     &gt; code to name mapping. But the users of the &#39;ovirt&#39; gem (the<br>
&gt;     ManageIQ<br>
&gt;     &gt;     &gt; oVirt provider) do rely on the name. For example:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     <a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a>&gt;<br>
&gt;     &gt;<br>
&gt;      &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a>&gt;&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; hmmm, while we are on topic, this pretty much looks like that manageiq<br>
&gt;     &gt; does not only rely on the code but also on the actual value of it<br>
&gt;     since<br>
&gt;     &gt; it is parsing it:<br>
&gt;     &gt;<br>
&gt;     &gt; # sample message: &quot;Interface nic1 (VirtIO) was added to VM v5. (User:<br>
&gt;     &gt; admin@internal-authz)&quot; message.split(/\s/)[7][0...-1]<br>
&gt;     &gt;<br>
&gt;     &gt; Is this something we commit to maintain? Or should we commit to<br>
&gt;     maintain it?<br>
&gt;     &gt;<br>
&gt;<br>
&gt;     That is a good point, that isn&#39;t very future proof. We should also find<br>
&gt;     a way to make less fragile. Any suggestion?<br>
&gt;<br>
&gt;<br>
&gt; The only doable thing which comes to my mind is something like this:<br>
&gt; The msg is defined like this:<br>
&gt; USER_ADD_VM_POOL_WITH_VMS_<wbr>FAILED=Failed to create VM Pool ${VmPoolName}<br>
&gt; (User: ${UserName}).<br>
&gt;<br>
&gt; e.g. the msg type and the variables. If we could expose in the api not<br>
&gt; only the substituted msg but also the variable/value binding, we could<br>
&gt; commit to keep the variable names backward compatible.<br>
&gt;<br>
&gt; So, something like:<br>
&gt;<br>
&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;    &lt;code&gt;19&lt;/code&gt;<br>
&gt;    &lt;type&gt;USER_ADD_VM_POOL_WITH_<wbr>VMS_FAILED&lt;/type&gt;<br>
&gt;    &lt;description&gt;the substituted msg.&lt;/description&gt;<br>
&gt;    &lt;parameters&gt;<br>
&gt;      &lt;parameter&gt;<br>
&gt;         &lt;key&gt;VmPoolName&lt;/key&gt;<br>
&gt;         &lt;value&gt;The Pool Name&lt;value&gt;<br>
&gt;      &lt;/parameter&gt;<br>
&gt; ...<br>
&gt;    &lt;/parameters&gt;<br>
&gt; &lt;/event&gt;<br>
&gt;<br>
&gt; Not really rock solid since the variables would still be defined in the<br>
&gt; AuditLogMessages.properties but still better and still easier to parse<br>
&gt; on the client side.<br>
&gt;<br>
<br>
</div></div>That makes sense to me. I have opened the following bug to track that:<br>
<br>
  [RFE] Add properties to events<br>
  <a href="https://bugzilla.redhat.com/1456711" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1456711</a><br>
<br></blockquote><div><br></div><div>I don&#39;t think we should expose the internal implementation of the audit-logging mechanism via the api.<br></div><div>This is unreliable and not the recommended way IMO to obtain data related to the event.<br><br></div><div>If the concern is for the entities names, we can extend the returned event element in the response<br>to include also the name:<br><br><div><div><div>&lt;event&gt;<br></div>  &lt;vm id=&quot;...&quot; href=&quot;...&quot;&gt;<br></div>    &lt;name&gt;abc&lt;/name&gt;<br></div>  &lt;/vm&gt;<br><br></div><div>This can be applied to all of the main entities without penalty in data retrieval from the database, since<br></div><div>the names of the entities should also be available on the audit-log entity.<br><br></div><div>However, for all of the other placesholders - this is a coupling of the restapi event structure to the<br>implementation of the auditlogging:<br></div><div>With the current code we don&#39;t store as part of the event data all of the raw material of the event, <br>specifically any variable being set via the AuditLogable.#customValues().<br></div><div>Therefore some of the data won&#39;t be available for the returned event.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Note that for the particular case of the VM name, which is what ManageIQ<br>
is trying to do in that code, the current best way is to use the &lt;vm<br>
.../&gt; link that is part of the event. I have opened the following<br>
ManageIQ issue to track it:<br>
<br>
  Avoid parsing the descriptions of events<br>
  <a href="https://github.com/ManageIQ/manageiq-providers-ovirt/issues/45" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/<wbr>issues/45</a><br>
<span class="gmail-"><br>
&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; That means that if we ever change the meaning of a code the ManageIQ<br>
&gt;     &gt;     &gt; provider, for example, will break.<br>
&gt;     &gt;<br>
&gt;     &gt;     Right,then it indeed needs to stay stable.<br>
&gt;     &gt;     But how is maintaining the enum string different from the code? It is<br>
&gt;     &gt;     the same information, so if MIQ doesn&#39;t use the name directly then it<br>
&gt;     &gt;     doesn&#39;t really matter if it&#39;s a code or string.<br>
&gt;     &gt;     Perhaps deprecate the code and keep the name fixed?<br>
&gt;     &gt;<br>
&gt;     &gt;     Thanks,<br>
&gt;     &gt;     michal<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Regards,<br>
&gt;     &gt;     &gt;&gt;&gt; Juan Hernandez<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;     &gt;     &gt;&gt;&gt; Devel mailing list<br>
&gt;     &gt;     &gt;&gt;&gt; <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;<br>
</span>&gt;     &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;&gt;<br>
<span class="gmail-">&gt;     &gt;     &gt;&gt;&gt; <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;&gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     ______________________________<wbr>_________________<br>
&gt;     &gt;     Devel mailing list<br>
&gt;     &gt;     <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;<br>
</span>&gt;     &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;&gt;<br>
<span class="gmail-">&gt;     &gt;     <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;<br>
&gt;<br>
<br>
______________________________<wbr>_________________<br>
Devel mailing list<br>
<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
</span><a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards,<br></div>Moti<br></div></div>
</div></div></div></div></div></div>